diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2014-01-08 06:15:00 -0800 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2014-01-08 06:15:00 -0800 |
commit | 6a8e8d661f07f2599a6eca0b06f7ba25ef92e1c0 (patch) | |
tree | 410f9ee991634aaaa908ae1cfcfb39cdd097b946 | |
parent | cbd03b0516c5a699604ef278781e9d458fad6530 (diff) |
experimental: nonnull function attributenonnull
Was meant to suppress a clang scan-tool false positive,
but did not help in that case. Might still be useful, though.
-rwxr-xr-x | src/sysync/mimedirprofile.h | 2 | ||||
-rwxr-xr-x | src/sysync_SDK/Sources/generic_types.h | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/sysync/mimedirprofile.h b/src/sysync/mimedirprofile.h index f8453b5..287254d 100755 --- a/src/sysync/mimedirprofile.h +++ b/src/sysync/mimedirprofile.h @@ -241,7 +241,7 @@ public: class TPropertyDefinition : noncopyable { public: // constructor/destructor - TPropertyDefinition(const char* aName, sInt16 aNumVals, bool aMandatory, bool aShowInCTCap, bool aSuppressEmpty, uInt16 aDelayedProcessing, char aValuesep, char aAltValuesep, uInt16 aPropertyGroupID, bool aCanFilter, TMimeDirMode aModeDep, sInt16 aGroupFieldID, bool aAllowFoldAtSep); + TPropertyDefinition(const char* aName, sInt16 aNumVals, bool aMandatory, bool aShowInCTCap, bool aSuppressEmpty, uInt16 aDelayedProcessing, char aValuesep, char aAltValuesep, uInt16 aPropertyGroupID, bool aCanFilter, TMimeDirMode aModeDep, sInt16 aGroupFieldID, bool aAllowFoldAtSep) SYSYNC_NONNULL((2)); ~TPropertyDefinition(); // tools TParameterDefinition *addParam(const char *aName, bool aDefault, bool aExtendsName, bool aShowNonEmpty=false, bool aShowInCTCap=false, TMimeDirMode aModeDep=numMimeModes); diff --git a/src/sysync_SDK/Sources/generic_types.h b/src/sysync_SDK/Sources/generic_types.h index 4223e48..ac3bf67 100755 --- a/src/sysync_SDK/Sources/generic_types.h +++ b/src/sysync_SDK/Sources/generic_types.h @@ -139,6 +139,27 @@ typedef unsigned long CVersion; typedef sInt32 ssize_t; #endif +/* - function attributes, to be used only for declarations */ +#ifdef __GNUC__ +# ifdef __clang_analyzer__ +/* + * Mark one or more parameters as not allowing NULL ptr. + * Example: SYSYNC_NONNULL(1,3) - first and third parameter must not be NULL. + * + * Because this is getting added late in the SyncEvolution release cycle, + * it is only active when doing static code analysis with clang's scan-build. + * The compiler is not told about it when generating code, because the result + * might be different. + * + * TODO: enable unconditionally also for code generation. + */ +# define SYSYNC_NONNULL(_x) __attribute__((nonnull _x)) +# else +# define SYSYNC_NONNULL(_x) +# endif +#else +# define SYSYNC_NONNULL(_x) +#endif #ifdef __cplusplus } // namespace |