This is the mail archive of the gcc-bugs@gcc.gnu.org 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]

[Bug c++/86368] an unknown [[attribute]] should not trigger a warning in C++17


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86368

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Hannes Hauswedell from comment #3)
> BUT if this code generates warnings there is a problem: obviously I don't
> want to tell downstream developers that "it's ok, just ignore the warnings"
> (since I have a header-only library I cannot pre-decide this). And I cannot
> workaround this in code short of introducing a MACRO.

Strictly speaking, you can:

#ifdef __has_cpp_attribute
# if __has_cpp_attribute(likely)
    [[likely]]
# endif
#endif
    statement;

It might be ugly, but it doesn't introduce any macro.

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