[Bug c++/114309] Undesirable warning with [[unlikely]]

2024-03-12 Thread terra at gnome dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114309 --- Comment #11 from M Welinder --- > Anyway, in GCC's testcase we have: > > 9 if (a == 123) > 10 [[likely]] c = 5; // { dg-warning "both" } > 11 else > 12 [[likely]] b = 77; > Here we have two possible paths, and

[Bug c++/114309] Undesirable warning with [[unlikely]]

2024-03-11 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114309 --- Comment #10 from Jonathan Wakely --- (In reply to Andrew Pinski from comment #6) > Maybe it should have its own enable/disable and not tied to -Wattribute > though. Yes, -Wattributes is going to keep covering more and more different things

[Bug c++/114309] Undesirable warning with [[unlikely]]

2024-03-11 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114309 --- Comment #9 from Jonathan Wakely --- (In reply to M Welinder from comment #0) > The standard, quoted from > https://en.cppreference.com/w/cpp/language/attributes/likely, clearly > contemplates this case: N.B. cppreference is not the

[Bug c++/114309] Undesirable warning with [[unlikely]]

2024-03-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114309 Andrew Pinski changed: What|Removed |Added Resolution|--- |INVALID Status|UNCONFIRMED

[Bug c++/114309] Undesirable warning with [[unlikely]]

2024-03-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114309 --- Comment #7 from Andrew Pinski --- Also this works just fine to disable the warning around the unlikely: #define push_warning _Pragma("GCC diagnostic push") #define pop_warning _Pragma("GCC diagnostic pop") #define disable_warning

[Bug c++/114309] Undesirable warning with [[unlikely]]

2024-03-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114309 --- Comment #6 from Andrew Pinski --- (In reply to Jakub Jelinek from comment #4) > I think the warning is very much desirable. It is not an error, just a > warning that the code does something weird. Maybe it should have its own

[Bug c++/114309] Undesirable warning with [[unlikely]]

2024-03-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114309 --- Comment #5 from Andrew Pinski --- Speficially this email: https://gcc.gnu.org/pipermail/gcc-patches/2018-November/511208.html

[Bug c++/114309] Undesirable warning with [[unlikely]]

2024-03-11 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114309 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment

[Bug c++/114309] Undesirable warning with [[unlikely]]

2024-03-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114309 --- Comment #3 from Andrew Pinski --- https://gcc.gnu.org/pipermail/gcc-patches/2018-November/510776.html ``` Would you please consider an error diagnostics for situations written in test4.C? Such situation is then silently ignored in

[Bug c++/114309] Undesirable warning with [[unlikely]]

2024-03-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114309 --- Comment #2 from Andrew Pinski --- The warning was added when this attribute was added in r9-4186-g2674fa47de9ecf and even added a testcase for this warning g++.dg/cpp2a/attr-likely4.C .

[Bug c++/114309] Undesirable warning with [[unlikely]]

2024-03-11 Thread terra at gnome dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114309 --- Comment #1 from M Welinder --- Created attachment 57672 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57672=edit Preprocessed source code