aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-family/ChangeLog9
-rw-r--r--gcc/c-family/c-opts.c23
-rw-r--r--gcc/c-family/c.opt2
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr77948-1.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr77948-2.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr77948-3.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr77948-4.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr77948-5.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr77948-6.C10
10 files changed, 86 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.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 037096c..c298d49 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,13 @@
2016-10-31 Jakub Jelinek <jakub@redhat.com>
+ PR c++/77948
+ * 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.
+
PR tree-optimization/77860
* gcc.dg/pr77860.c: New test.
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr77948-1.C b/gcc/testsuite/g++.dg/cpp0x/pr77948-1.C
new file mode 100644
index 0000000..e7795e9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr77948-1.C
@@ -0,0 +1,10 @@
+// PR c++/77948
+// { dg-do compile }
+// { dg-options "-std=c++11 -std=gnu++11" }
+
+void
+foo ()
+{
+ auto qfp = 1.0q; // { dg-error "unsupported" "" { target { ! has_q_floating_suffix } } }
+ auto Qfp = 1.0Q; // { dg-error "unsupported" "" { target { ! has_q_floating_suffix } } }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr77948-2.C b/gcc/testsuite/g++.dg/cpp0x/pr77948-2.C
new file mode 100644
index 0000000..7b84c5f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr77948-2.C
@@ -0,0 +1,10 @@
+// PR c++/77948
+// { dg-do compile }
+// { dg-options "-std=gnu++11 -std=c++11" }
+
+void
+foo ()
+{
+ auto qfp = 1.0q; // { dg-error "unable to find numeric literal operator" }
+ auto Qfp = 1.0Q; // { dg-error "unable to find numeric literal operator" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr77948-3.C b/gcc/testsuite/g++.dg/cpp0x/pr77948-3.C
new file mode 100644
index 0000000..64d4f5b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr77948-3.C
@@ -0,0 +1,10 @@
+// PR c++/77948
+// { dg-do compile }
+// { dg-options "-std=c++11 -std=gnu++98" }
+
+void
+foo ()
+{
+ double qfp = 1.0q; // { dg-error "unsupported" "" { target { ! has_q_floating_suffix } } }
+ double Qfp = 1.0Q; // { dg-error "unsupported" "" { target { ! has_q_floating_suffix } } }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr77948-4.C b/gcc/testsuite/g++.dg/cpp0x/pr77948-4.C
new file mode 100644
index 0000000..7b66b98
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr77948-4.C
@@ -0,0 +1,10 @@
+// PR c++/77948
+// { dg-do compile }
+// { dg-options "-std=c++11 -std=c++98" }
+
+void
+foo ()
+{
+ double qfp = 1.0q; // { dg-error "unsupported" "" { target { ! has_q_floating_suffix } } }
+ double Qfp = 1.0Q; // { dg-error "unsupported" "" { target { ! has_q_floating_suffix } } }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr77948-5.C b/gcc/testsuite/g++.dg/cpp0x/pr77948-5.C
new file mode 100644
index 0000000..bec34a1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr77948-5.C
@@ -0,0 +1,10 @@
+// PR c++/77948
+// { dg-do compile }
+// { dg-options "-std=gnu++98 -std=c++11" }
+
+void
+foo ()
+{
+ auto qfp = 1.0q; // { dg-error "unable to find numeric literal operator" }
+ auto Qfp = 1.0Q; // { dg-error "unable to find numeric literal operator" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr77948-6.C b/gcc/testsuite/g++.dg/cpp0x/pr77948-6.C
new file mode 100644
index 0000000..b8a13b5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr77948-6.C
@@ -0,0 +1,10 @@
+// PR c++/77948
+// { dg-do compile }
+// { dg-options "-std=c++98 -std=c++11" }
+
+void
+foo ()
+{
+ auto qfp = 1.0q; // { dg-error "unable to find numeric literal operator" }
+ auto Qfp = 1.0Q; // { dg-error "unable to find numeric literal operator" }
+}