diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-10-31 17:38:21 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-10-31 17:38:21 +0100 |
commit | dcb466eca3741d1cb06acb44a4009657cd475781 (patch) | |
tree | 8c64fede4c4066c5dff6e9d102527ca44edf645e /gcc/c-family | |
parent | 1e4fa9b11255ea15a3510dfd1e3011ffebdcc530 (diff) | |
download | gcc-dcb466eca3741d1cb06acb44a4009657cd475781.zip gcc-dcb466eca3741d1cb06acb44a4009657cd475781.tar.gz gcc-dcb466eca3741d1cb06acb44a4009657cd475781.tar.bz2 |
re PR c++/77948 (Option processing of -std=c++11 -std=gnu++11 doesn't reset ext_numeric_literals)
PR c++/77948
* c.opt (fext-numeric-literals): Add Var and Init.
* c-opts.c (c_common_handle_option): Don't clear
cpp_opts->ext_numeric_literals for -std=c++{11,14,1z}.
(c_common_post_options): Clear it here if not set
explicitly.
* g++.dg/cpp0x/pr77948-1.C: New test.
* g++.dg/cpp0x/pr77948-2.C: New test.
* g++.dg/cpp0x/pr77948-3.C: New test.
* g++.dg/cpp0x/pr77948-4.C: New test.
* g++.dg/cpp0x/pr77948-5.C: New test.
* g++.dg/cpp0x/pr77948-6.C: New test.
From-SVN: r241707
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/c-family/c-opts.c | 23 | ||||
-rw-r--r-- | gcc/c-family/c.opt | 2 |
3 files changed, 18 insertions, 16 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 6e96761..6457418 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,12 @@ +2016-10-31 Jakub Jelinek <jakub@redhat.com> + + PR c++/77948 + * c.opt (fext-numeric-literals): Add Var and Init. + * c-opts.c (c_common_handle_option): Don't clear + cpp_opts->ext_numeric_literals for -std=c++{11,14,1z}. + (c_common_post_options): Clear it here if not set + explicitly. + 2016-10-28 Aldy Hernandez <aldyh@redhat.com> PR debug/77773 diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index c399307..4a0b995 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -624,31 +624,19 @@ c_common_handle_option (size_t scode, const char *arg, int value, case OPT_std_c__11: case OPT_std_gnu__11: if (!preprocessing_asm_p) - { - set_std_cxx11 (code == OPT_std_c__11 /* ISO */); - if (code == OPT_std_c__11) - cpp_opts->ext_numeric_literals = 0; - } + set_std_cxx11 (code == OPT_std_c__11 /* ISO */); break; case OPT_std_c__14: case OPT_std_gnu__14: if (!preprocessing_asm_p) - { - set_std_cxx14 (code == OPT_std_c__14 /* ISO */); - if (code == OPT_std_c__14) - cpp_opts->ext_numeric_literals = 0; - } + set_std_cxx14 (code == OPT_std_c__14 /* ISO */); break; case OPT_std_c__1z: case OPT_std_gnu__1z: if (!preprocessing_asm_p) - { - set_std_cxx1z (code == OPT_std_c__1z /* ISO */); - if (code == OPT_std_c__1z) - cpp_opts->ext_numeric_literals = 0; - } + set_std_cxx1z (code == OPT_std_c__1z /* ISO */); break; case OPT_std_c90: @@ -923,6 +911,11 @@ c_common_post_options (const char **pfilename) if (warn_narrowing == -1) warn_narrowing = 1; + + /* Unless -f{,no-}ext-numeric-literals has been used explicitly, + for -std=c++{11,14,1z} default to -fno-ext-numeric-literals. */ + if (flag_iso && !global_options_set.x_flag_ext_numeric_literals) + cpp_opts->ext_numeric_literals = 0; } else if (warn_narrowing == -1) warn_narrowing = 0; diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 458d453..7e86dbf 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -1705,7 +1705,7 @@ C ObjC C++ ObjC++ Joined -femit-struct-debug-detailed=<spec-list> Detailed reduced debug info for structs. fext-numeric-literals -C++ ObjC++ +C++ ObjC++ Var(flag_ext_numeric_literals) Init(1) Interpret imaginary, fixed-point, or other gnu number suffix as the corresponding number literal rather than a user-defined number literal. |