diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2012-10-09 14:50:19 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-10-09 17:25:27 +0200 |
commit | 13e39545eac66b628f9ef3c89cc03d2003e5d317 (patch) | |
tree | 0b29dc22c823d46c69782c5510bc0a340fcf9abe /sal/inc | |
parent | 02a8d36ebf3d54784903f2899eafe010bedf2f4c (diff) |
compiler check for unused variables
This is for variables that the compiler itself cannot figure out
(e.g. non-trivial ctors). The classes need to be marked manually.
Change-Id: I0109972e11e20578b1adc32065f701a871ee21aa
Diffstat (limited to 'sal/inc')
-rw-r--r-- | sal/inc/sal/types.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sal/inc/sal/types.h b/sal/inc/sal/types.h index f97ecc701438..0baf3d19cb1c 100644 --- a/sal/inc/sal/types.h +++ b/sal/inc/sal/types.h @@ -489,6 +489,26 @@ template< typename T1, typename T2 > inline T1 static_int_cast(T2 n) { #endif #endif +/** + + Annotate classes where a compiler should warn if an instance is unused. + + The compiler cannot warn about unused instances if they have non-trivial + or external constructors or destructors. Classes marked with SAL_WARN_UNUSED + will be warned about. + + Currently implemented by a Clang compiler plugin. + + @since LibreOffice 3.7 + +*/ + +#if defined __clang__ +#define SAL_WARN_UNUSED __attribute__((annotate("lo_warn_unused"))) +#else +#define SAL_WARN_UNUSED +#endif + #endif /*_SAL_TYPES_H_ */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |