Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP5:Update
python-sip
0002-Added_the_NoSetter_variable_annotation.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0002-Added_the_NoSetter_variable_annotation.patch of Package python-sip
# HG changeset patch # User Phil Thompson <phil@riverbankcomputing.com> # Date 1400002994 -3600 # Node ID 422cc3b4ee5b2c1fb81c1fe7a521f81bab231c07 # Parent dd6840986c03feff52343fd2a6e03087fa4cad28 Added the /NoSetter/ variable annotation. diff -r dd6840986c03 -r 422cc3b4ee5b sipgen/gencode.c --- a/sipgen/gencode.c Tue May 13 18:04:58 2014 +0100 +++ b/sipgen/gencode.c Tue May 13 18:43:14 2014 +0100 @@ -31,7 +31,7 @@ #define smtypeName(sm) (strrchr((sm)->name->text, '.') + 1) /* Return TRUE if a wrapped variable can be set. */ -#define canSetVariable(vd) ((vd)->type.nrderefs != 0 || !isConstArg(&(vd)->type)) +#define canSetVariable(vd) (!noSetter(vd) && ((vd)->type.nrderefs != 0 || !isConstArg(&(vd)->type))) /* Control what generateCalledArgs() actually generates. */ diff -r dd6840986c03 -r 422cc3b4ee5b sipgen/metasrc/parser.y --- a/sipgen/metasrc/parser.y Tue May 13 18:04:58 2014 +0100 +++ b/sipgen/metasrc/parser.y Tue May 13 18:43:14 2014 +0100 @@ -3915,6 +3915,7 @@ const char *annos[] = { "DocType", "Encoding", + "NoSetter", "PyInt", "PyName", NULL @@ -6611,6 +6612,9 @@ if (isstatic || (escope != NULL && escope->iff->type == namespace_iface)) setIsStaticVar(var); + if (getOptFlag(of, "NoSetter", bool_flag) != NULL) + setNoSetter(var); + addVariable(pt, var); } diff -r dd6840986c03 -r 422cc3b4ee5b sipgen/sip.h.in --- a/sipgen/sip.h Tue May 13 18:04:58 2014 +0100 +++ b/sipgen/sip.h Tue May 13 18:43:14 2014 +0100 @@ -368,12 +368,15 @@ /* Handle variable flags. */ #define VAR_IS_STATIC 0x01 /* It is a static variable. */ -#define VAR_NEEDS_HANDLER 0x02 /* It the variable needs a handler. */ +#define VAR_NEEDS_HANDLER 0x02 /* The variable needs a handler. */ +#define VAR_NO_SETTER 0x04 /* The variable has no setter. */ #define isStaticVar(v) ((v)->varflags & VAR_IS_STATIC) #define setIsStaticVar(v) ((v)->varflags |= VAR_IS_STATIC) #define needsHandler(v) ((v)->varflags & VAR_NEEDS_HANDLER) #define setNeedsHandler(v) ((v)->varflags |= VAR_NEEDS_HANDLER) +#define noSetter(v) ((v)->varflags & VAR_NO_SETTER) +#define setNoSetter(v) ((v)->varflags |= VAR_NO_SETTER) /* Handle argument flags. */ diff -r dd6840986c03 -r 422cc3b4ee5b sphinx/annotations.rst --- a/sphinx/annotations.rst Tue May 13 18:04:58 2014 +0100 +++ b/sphinx/annotations.rst Tue May 13 18:43:14 2014 +0100 @@ -1043,6 +1043,16 @@ argument annotation when applied to the type of the variable being defined. +.. variable-annotation:: NoSetter + + .. versionadded:: 4.16 + + This boolean annotation specifies that the variable will have no setter and + will be read-only. Because SIP does not fully understand C/C++ types + (particularly ``const`` arrays) it is sometimes necessary to explicitly + annotate a variable as being read-only. + + .. variable-annotation:: PyInt .. versionadded:: 4.12
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor