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.

Reply via email to