Re: [Doxygen-users] Issue with __attribute__ of gcc
Brought to you by:
dimitri
From: Dave D. <do...@do...> - 2006-05-30 22:41:06
|
On Mon, May 22, 2006 at 09:49:31AM +0200, Emil Maskovsky wrote: > > At least you can try to use macro expansion for __attribute__(something) > - and then not expand that macro during doxygen processing. [...] > PRINTFLIKE(1,2) char* MyPrintF( const char * const sFormat, ... ); Seconding this technique. Note that if you have EXPAND_ONLY_PREDEF set to YES then you'll need to put the no-op versions of the macros into the PREDEFINED list: PREDEFINED = \ "PRINTFLIKE(x,y)=" > Anyway, if you try to write portable code, you should not have in-place > compiler extensions, which __attribute__ surely is (that means, very few > C/C++ compilers other than gcc will support that keyword). Most attributes are just compiler hints and can safely be dropped without breaking things. For example I normally compile with warnings cranked way up and there are some functions that (for API reasons) have unused arguments. I use a macro to apply the "unused" attribute so that gcc doesn't issue a warning about them. Things like packing and alignment attributes are trickier, because the program could potentially malfunction without them. For example the data might be used with some assembly code that requires more precise alignment than the C ABI can normally guarantee. In these cases I'd still use a macro, but have the code issue an #error if the compiler can't support the extension. -Dave Dodge |