This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/86368] an unknown [[attribute]] should not trigger a warning in C++17
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 03 Jul 2018 15:38:05 +0000
- Subject: [Bug c++/86368] an unknown [[attribute]] should not trigger a warning in C++17
- Auto-submitted: auto-generated
- References: <bug-86368-4@http.gcc.gnu.org/bugzilla/>
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.