Re: [AD] warn_unused_result GCC attribute?

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Chris wrote:
I ran across this while compiling my new 2.6 kernel. Apparently GCC has a warn_unused_result attribute that produces a warning when the return value of a function isn't used (checked or put into a variable).

I don't know what version of GCC introduced it, but I think it'd be useful for things like install_allegro, set_gfx_mode, etc.. which you should always check. Normally I wouldn't really like the extra warnings, but considering the number of newbs that neglect return values, and even experienced programmers that can let them slip by in error, it might be better to add it.


that is an option for the users compiled program no?

how can you add a warn_unused to a library ?




I would also like to suggest going through the GCC manual and finding useful function, variable, and type attributes and adding them where appropriate, for optimization purposes. Though perhaps this could wait and just add them as the new API is written up.


aren't many of them GCC specific ?



aj.





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/