aboutsummaryrefslogtreecommitdiff
path: root/libcpp/expr.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2013-04-28 21:36:57 +0000
committerJakub Jelinek <jakub@redhat.com>2013-04-28 21:36:57 +0000
commit9cd818ce71869c177cb7780475211ca6abb04f3d (patch)
treebefd3b677796bad370f79def6822510edc236a34 /libcpp/expr.c
parente357d2b2fd04cf520081ca0cf7b98ef52b3b6cd8 (diff)
N3472 binary constants
* include/cpplib.h (struct cpp_options): Fix a typo in user_literals field comment. Add binary_constants field. * init.c (struct lang_flags): Add binary_constants field. (lang_defaults): Add bin_cst column to the table. (cpp_set_lang): Initialize CPP_OPTION (pfile, binary_constants). * expr.c (cpp_classify_number): Talk about C++11 instead of C++0x in diagnostics. Accept binary constants if CPP_OPTION (pfile, binary_constants) even when pedantic. Adjust pedwarn message. * g++.dg/cpp/limits.C: Adjust warning wording. * g++.dg/system-binary-constants-1.C: Likewise. * g++.dg/cpp1y/system-binary-constants-1.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@198380 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp/expr.c')
-rw-r--r--libcpp/expr.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libcpp/expr.c b/libcpp/expr.c
index 46d9fd386ab..0eb6c13c2f0 100644
--- a/libcpp/expr.c
+++ b/libcpp/expr.c
@@ -621,7 +621,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token,
&& CPP_OPTION (pfile, cpp_warn_long_long))
{
const char *message = CPP_OPTION (pfile, cplusplus)
- ? N_("use of C++0x long long integer constant")
+ ? N_("use of C++11 long long integer constant")
: N_("use of C99 long long integer constant");
if (CPP_OPTION (pfile, c99))
@@ -639,9 +639,14 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token,
if ((result & CPP_N_IMAGINARY) && CPP_PEDANTIC (pfile))
cpp_error_with_line (pfile, CPP_DL_PEDWARN, virtual_location, 0,
"imaginary constants are a GCC extension");
- if (radix == 2 && CPP_PEDANTIC (pfile))
+ if (radix == 2
+ && !CPP_OPTION (pfile, binary_constants)
+ && CPP_PEDANTIC (pfile))
cpp_error_with_line (pfile, CPP_DL_PEDWARN, virtual_location, 0,
- "binary constants are a GCC extension");
+ CPP_OPTION (pfile, cplusplus)
+ ? "binary constants are a C++1y feature "
+ "or GCC extension"
+ : "binary constants are a GCC extension");
if (radix == 10)
result |= CPP_N_DECIMAL;