diff options
author | Jonathan Wakely <redi@gcc.gnu.org> | 2017-02-19 14:13:53 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2017-02-19 14:13:53 +0000 |
commit | 7dfa657b5bae61a458721d079320fb82401ed58b (patch) | |
tree | 63b66797d444b78821a16bdf2a2bbcb21ad89939 /gcc | |
parent | ff7da2b6cf045cd8a3c12dadb79133b76fe15d11 (diff) | |
download | gcc-7dfa657b5bae61a458721d079320fb82401ed58b.zip gcc-7dfa657b5bae61a458721d079320fb82401ed58b.tar.gz gcc-7dfa657b5bae61a458721d079320fb82401ed58b.tar.bz2 |
PR c++/69523 make -Wliteral-suffix control warning
gcc:
PR c++/69523
* doc/invoke.texi (C++ Dialect Options) [-Wliteral-suffix]: Update
description.
gcc/cp:
2017-02-19 Eric Fiselier <eric@efcs.ca>
Jonathan Wakely <jwakely@redhat.com>
PR c++/69523
* parser.c (cp_parser_unqualified_id): Use OPT_Wliteral_suffix to
control warning about literal suffix identifiers without a leading
underscore.
gcc/testsuite:
2017-02-19 Eric Fiselier <eric@efcs.ca>
Jonathan Wakely <jwakely@redhat.com>
PR c++/69523
* g++.dg/cpp0x/Wliteral-suffix2.C: New test.
From-SVN: r245574
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/parser.c | 5 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/Wliteral-suffix2.C | 11 |
6 files changed, 39 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4b7bc56..d404f8f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-02-19 Jonathan Wakely <jwakely@redhat.com> + + PR c++/69523 + * doc/invoke.texi (C++ Dialect Options) [-Wliteral-suffix]: Update + description. + 2017-02-19 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> * gimple-pretty-print.c (dump_ternary_rhs): Adjust gimple dump format diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8dce6d1..d0803bf 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2017-02-19 Eric Fiselier <eric@efcs.ca> + Jonathan Wakely <jwakely@redhat.com> + + PR c++/69523 + * parser.c (cp_parser_unqualified_id): Use OPT_Wliteral_suffix to + control warning about literal suffix identifiers without a leading + underscore. + 2017-02-17 Jason Merrill <jason@redhat.com> PR c++/79508 - lookup error with member template diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 92d8cce..feeafce 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -5812,8 +5812,9 @@ cp_parser_unqualified_id (cp_parser* parser, const char *name = UDLIT_OP_SUFFIX (id); if (name[0] != '_' && !in_system_header_at (input_location) && declarator_p) - warning (0, "literal operator suffixes not preceded by %<_%>" - " are reserved for future standardization"); + warning (OPT_Wliteral_suffix, + "literal operator suffixes not preceded by %<_%>" + " are reserved for future standardization"); } return id; diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index c65086c..6e219da 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -2852,6 +2852,11 @@ int main() @{ In this case, @code{PRId64} is treated as a separate preprocessing token. +Additionally, warn when a user-defined literal operator is declared with +a literal suffix identifier that doesn't begin with an underscore. Literal +suffix identifiers that don't begin with an underscore are reserved for +future standardization. + This warning is enabled by default. @item -Wlto-type-mismatch diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 97f392a..c98d774 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-02-19 Eric Fiselier <eric@efcs.ca> + Jonathan Wakely <jwakely@redhat.com> + + PR c++/69523 + * g++.dg/cpp0x/Wliteral-suffix2.C: New test. + 2017-02-19 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> * gcc.dg/gimplefe-26.c: New test. diff --git a/gcc/testsuite/g++.dg/cpp0x/Wliteral-suffix2.C b/gcc/testsuite/g++.dg/cpp0x/Wliteral-suffix2.C new file mode 100644 index 0000000..129947d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/Wliteral-suffix2.C @@ -0,0 +1,11 @@ +// { dg-do compile { target c++11 } } +// { dg-options "-Wno-literal-suffix" } + +// Test user-defined literals. +// Test "-Wno-literal-suffix" suppresses warnings on declaration without +// leading underscore. + +long double operator"" nounder(long double); // { dg-bogus "" } + +template<char...> + int operator"" nounder(); // { dg-bogus "" } |