Commit 7dfa657b by Jonathan Wakely

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
parent ff7da2b6
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> 2017-02-19 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
* gimple-pretty-print.c (dump_ternary_rhs): Adjust gimple dump format * gimple-pretty-print.c (dump_ternary_rhs): Adjust gimple dump format
......
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> 2017-02-17 Jason Merrill <jason@redhat.com>
PR c++/79508 - lookup error with member template PR c++/79508 - lookup error with member template
......
...@@ -5812,8 +5812,9 @@ cp_parser_unqualified_id (cp_parser* parser, ...@@ -5812,8 +5812,9 @@ cp_parser_unqualified_id (cp_parser* parser,
const char *name = UDLIT_OP_SUFFIX (id); const char *name = UDLIT_OP_SUFFIX (id);
if (name[0] != '_' && !in_system_header_at (input_location) if (name[0] != '_' && !in_system_header_at (input_location)
&& declarator_p) && declarator_p)
warning (0, "literal operator suffixes not preceded by %<_%>" warning (OPT_Wliteral_suffix,
" are reserved for future standardization"); "literal operator suffixes not preceded by %<_%>"
" are reserved for future standardization");
} }
return id; return id;
...@@ -2852,6 +2852,11 @@ int main() @{ ...@@ -2852,6 +2852,11 @@ int main() @{
In this case, @code{PRId64} is treated as a separate preprocessing token. 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. This warning is enabled by default.
@item -Wlto-type-mismatch @item -Wlto-type-mismatch
......
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> 2017-02-19 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
* gcc.dg/gimplefe-26.c: New test. * gcc.dg/gimplefe-26.c: New test.
......
// { 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 "" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment