public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/103355] New: libcpp/lex.c:1289:9: warning: use of the 'likely' attribute is a C++20 extension [-Wc++20-extensions]
@ 2021-11-22 8:49 marxin at gcc dot gnu.org
2021-11-22 8:58 ` [Bug preprocessor/103355] " pinskia at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-22 8:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103355
Bug ID: 103355
Summary: libcpp/lex.c:1289:9: warning: use of the 'likely'
attribute is a C++20 extension [-Wc++20-extensions]
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: preprocessor
Assignee: unassigned at gcc dot gnu.org
Reporter: marxin at gcc dot gnu.org
CC: mpolacek at gcc dot gnu.org
Target Milestone: ---
Right now, we require for building of GCC ISO C++11 compiler. However,
[[likely]] and [[unlikely]] come from C++20, or?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug preprocessor/103355] libcpp/lex.c:1289:9: warning: use of the 'likely' attribute is a C++20 extension [-Wc++20-extensions]
2021-11-22 8:49 [Bug preprocessor/103355] New: libcpp/lex.c:1289:9: warning: use of the 'likely' attribute is a C++20 extension [-Wc++20-extensions] marxin at gcc dot gnu.org
@ 2021-11-22 8:58 ` pinskia at gcc dot gnu.org
2021-11-22 9:12 ` redi at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-22 8:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103355
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The question becomes unknown attributes don't do anything right? If so the
warning on an attribute like this seems over the top.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug preprocessor/103355] libcpp/lex.c:1289:9: warning: use of the 'likely' attribute is a C++20 extension [-Wc++20-extensions]
2021-11-22 8:49 [Bug preprocessor/103355] New: libcpp/lex.c:1289:9: warning: use of the 'likely' attribute is a C++20 extension [-Wc++20-extensions] marxin at gcc dot gnu.org
2021-11-22 8:58 ` [Bug preprocessor/103355] " pinskia at gcc dot gnu.org
@ 2021-11-22 9:12 ` redi at gcc dot gnu.org
2021-11-22 15:33 ` mpolacek at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-22 9:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103355
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2021-11-22
Status|UNCONFIRMED |NEW
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #0)
> [[likely]] and [[unlikely]] come from C++20, or?
Yes. It should really be guarded by #if __has_cpp_attribute(likely)
Or use [[__likely__]] which recent versions of GCC will accept in C++11 mode,
but non-GCC compilers will warn about.
Or both:
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -1286,7 +1286,14 @@ namespace bidi {
case kind::RTL:
/* These aren't popped by a PDF/PDI. */
break;
- [[likely]] case kind::NONE:
+#ifdef __has_cpp_attribute
+# if __has_cpp_attribute(likely)
+ [[likely]]
+# elif __has_cpp_attribute(__likely__)
+ [[__likely__]]
+# endif
+#endif
+ case kind::NONE:
break;
default:
abort ();
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug preprocessor/103355] libcpp/lex.c:1289:9: warning: use of the 'likely' attribute is a C++20 extension [-Wc++20-extensions]
2021-11-22 8:49 [Bug preprocessor/103355] New: libcpp/lex.c:1289:9: warning: use of the 'likely' attribute is a C++20 extension [-Wc++20-extensions] marxin at gcc dot gnu.org
2021-11-22 8:58 ` [Bug preprocessor/103355] " pinskia at gcc dot gnu.org
2021-11-22 9:12 ` redi at gcc dot gnu.org
@ 2021-11-22 15:33 ` mpolacek at gcc dot gnu.org
2021-11-22 15:35 ` marxin at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-11-22 15:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103355
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Mine, but I'll just use Jon's patch.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug preprocessor/103355] libcpp/lex.c:1289:9: warning: use of the 'likely' attribute is a C++20 extension [-Wc++20-extensions]
2021-11-22 8:49 [Bug preprocessor/103355] New: libcpp/lex.c:1289:9: warning: use of the 'likely' attribute is a C++20 extension [-Wc++20-extensions] marxin at gcc dot gnu.org
` (2 preceding siblings ...)
2021-11-22 15:33 ` mpolacek at gcc dot gnu.org
@ 2021-11-22 15:35 ` marxin at gcc dot gnu.org
2021-11-23 2:44 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-22 15:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103355
--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #3)
> Mine, but I'll just use Jon's patch.
That's a reasonable solution for me ;)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug preprocessor/103355] libcpp/lex.c:1289:9: warning: use of the 'likely' attribute is a C++20 extension [-Wc++20-extensions]
2021-11-22 8:49 [Bug preprocessor/103355] New: libcpp/lex.c:1289:9: warning: use of the 'likely' attribute is a C++20 extension [-Wc++20-extensions] marxin at gcc dot gnu.org
` (3 preceding siblings ...)
2021-11-22 15:35 ` marxin at gcc dot gnu.org
@ 2021-11-23 2:44 ` cvs-commit at gcc dot gnu.org
2021-11-23 2:44 ` mpolacek at gcc dot gnu.org
2021-11-23 16:11 ` cvs-commit at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-23 2:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103355
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:630686f93f0018fa1ef128aa673fddd302cc83e1
commit r12-5459-g630686f93f0018fa1ef128aa673fddd302cc83e1
Author: Marek Polacek <polacek@redhat.com>
Date: Mon Nov 22 11:29:40 2021 -0500
libcpp: Use [[likely]] conditionally
Let's hide [[likely]] behind a macro, to suppress warnings if the
compiler doesn't support it.
Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
PR preprocessor/103355
libcpp/ChangeLog:
* lex.c: Use ATTR_LIKELY instead of [[likely]].
* system.h (ATTR_LIKELY): Define.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug preprocessor/103355] libcpp/lex.c:1289:9: warning: use of the 'likely' attribute is a C++20 extension [-Wc++20-extensions]
2021-11-22 8:49 [Bug preprocessor/103355] New: libcpp/lex.c:1289:9: warning: use of the 'likely' attribute is a C++20 extension [-Wc++20-extensions] marxin at gcc dot gnu.org
` (4 preceding siblings ...)
2021-11-23 2:44 ` cvs-commit at gcc dot gnu.org
@ 2021-11-23 2:44 ` mpolacek at gcc dot gnu.org
2021-11-23 16:11 ` cvs-commit at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-11-23 2:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103355
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug preprocessor/103355] libcpp/lex.c:1289:9: warning: use of the 'likely' attribute is a C++20 extension [-Wc++20-extensions]
2021-11-22 8:49 [Bug preprocessor/103355] New: libcpp/lex.c:1289:9: warning: use of the 'likely' attribute is a C++20 extension [-Wc++20-extensions] marxin at gcc dot gnu.org
` (5 preceding siblings ...)
2021-11-23 2:44 ` mpolacek at gcc dot gnu.org
@ 2021-11-23 16:11 ` cvs-commit at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-23 16:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103355
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Christophe Lyon <clyon@gcc.gnu.org>:
https://gcc.gnu.org/g:46d3cfd29dc701e1e0d18b0380d6299fce7944f2
commit r12-5472-g46d3cfd29dc701e1e0d18b0380d6299fce7944f2
Author: Christophe Lyon <christophe.lyon@foss.st.com>
Date: Tue Nov 23 16:06:42 2021 +0000
libcpp: Fix ATTR_LIKELY definition PR preprocessor/103355
Fix the definition of ATTR_LIKELY when __has_cpp_attribute is not
defined, as it is the case with old compilers such as gcc-4.8.5.
libcpp/:
PR preprocessor/103355
* system.h (ATTR_LIKELY): Fix definition.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-11-23 16:11 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-22 8:49 [Bug preprocessor/103355] New: libcpp/lex.c:1289:9: warning: use of the 'likely' attribute is a C++20 extension [-Wc++20-extensions] marxin at gcc dot gnu.org
2021-11-22 8:58 ` [Bug preprocessor/103355] " pinskia at gcc dot gnu.org
2021-11-22 9:12 ` redi at gcc dot gnu.org
2021-11-22 15:33 ` mpolacek at gcc dot gnu.org
2021-11-22 15:35 ` marxin at gcc dot gnu.org
2021-11-23 2:44 ` cvs-commit at gcc dot gnu.org
2021-11-23 2:44 ` mpolacek at gcc dot gnu.org
2021-11-23 16:11 ` cvs-commit at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).