This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC][4.4] Conversion of tree.h STRIP_* macros into static inline functions

On Tue, 18 Dec 2007, Simon Baldwin wrote:

> Attached is a revised version of this patch, incorporating review
> comments; thanks for the feedback.
> + static inline tree __attribute__((warn_unused_result))
> + STRIP_NOPS (const_tree exp)

You can't use a naked __attribute__ keyword like that because that will
break bootrapping with non-gcc compilers.  It will also break
bootstrapping with gcc versions released prior to adding the
__warn_unused_result__ feature.

I suggest adding a macro ATTRIBUTE_WARN_UNUSED_RESULT in
include/ansidecl.h like so:

/* Attribute __warn_unused_result__ on functions was valid as of gcc 3.4.  */
# if (GCC_VERSION >= 3004)
#  define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
# else
# endif /* GNUC >= 3.4 */

I.e. follow the existing pattern in ansidecl.h.  Then use the new macro in
lieu of __attribute__ directly.

Note: I *think* __warn_unused_result__ appeared in gcc-3.4, but double

Note2: I used __warn_unused_result__, not warn_unused_result to avoid
namespace conflicts.

Would you please revise your patch with this suggestion?

Kaveh R. Ghazi

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]