2015-05-09 Jason Merrill <jason@redhat.com>
+ * c-common.h (enum cxx_dialect): Add cxx_unset.
+ * c-common.c (cxx_dialect): Initialize to cxx_unset.
+ * c-opts.c (c_common_post_options): Set C++ dialect to C++98 if unset.
+
* c.opt (std=c++14): Remove Undocumented flag and experimental warning.
(std=gnu++0x): Mark as Undocumented.
(std=gnu++1y): Add deprecated message.
+2015-05-09 Jason Merrill <jason@redhat.com>
+
+ * lib/target-supports.exp (cxx_default): New global.
+ (check_effective_target_c++11_only)
+ (check_effective_target_c++14_only)
+ (check_effective_target_c++98_only)
+ (check_effective_target_c++1z_only): Check it.
+
2015-05-09 Marc Glisse <marc.glisse@inria.fr>
PR tree-optimization/64454
return 0
}
+set cxx_default "c++98"
# Check whether the current active language standard supports the features
-# of C++11/C++14 by checking for the presence of one of the -std
-# flags. This assumes that the default for the compiler is C++98, and that
+# of C++11/C++14 by checking for the presence of one of the -std flags.
+# This assumes that the default for the compiler is $cxx_default, and that
# there will never be multiple -std= arguments on the command line.
proc check_effective_target_c++11_only { } {
+ global cxx_default
if ![check_effective_target_c++] {
return 0
}
- return [check-flags { { } { } { -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11 } }]
+ if [check-flags { { } { } { -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11 } }] {
+ return 1
+ }
+ if { $cxx_default == "c++11" && [check-flags { { } { } { } { -std=* } }] } {
+ return 1
+ }
+ return 0
}
proc check_effective_target_c++11 { } {
if [check_effective_target_c++11_only] {
if ![check_effective_target_c++] {
return 0
}
- return ![check_effective_target_c++14]
+ return [expr ![check_effective_target_c++14] ]
}
proc check_effective_target_c++14_only { } {
+ global cxx_default
if ![check_effective_target_c++] {
return 0
}
- return [check-flags { { } { } { -std=c++14 -std=gnu++14 -std=c++14 -std=gnu++14 } }]
+ if [check-flags { { } { } { -std=c++14 -std=gnu++14 -std=c++14 -std=gnu++14 } }] {
+ return 1
+ }
+ if { $cxx_default == "c++14" && [check-flags { { } { } { } { -std=* } }] } {
+ return 1
+ }
+ return 0
}
proc check_effective_target_c++14 { } {
if ![check_effective_target_c++] {
return 0
}
- return ![check_effective_target_c++1z]
+ return [expr ![check_effective_target_c++1z] ]
}
proc check_effective_target_c++98_only { } {
+ global cxx_default
if ![check_effective_target_c++] {
return 0
}
- return ![check_effective_target_c++11]
+ if [check-flags { { } { } { -std=c++98 -std=gnu++98 -std=c++03 -std=gnu++03 } }] {
+ return 1
+ }
+ if { $cxx_default == "c++98" && [check-flags { { } { } { } { -std=* } }] } {
+ return 1
+ }
+ return 0
}
proc check_effective_target_c++1z_only { } {
+ global cxx_default
if ![check_effective_target_c++] {
return 0
}
- return [check-flags { { } { } { -std=c++1z -std=gnu++1z } }]
+ if [check-flags { { } { } { -std=c++17 -std=gnu++17 -std=c++1z -std=gnu++1z } }] {
+ return 1
+ }
+ if { $cxx_default == "c++17" && [check-flags { { } { } { } { -std=* } }] } {
+ return 1
+ }
+ return 0
}
proc check_effective_target_c++1z { } {
return [check_effective_target_c++1z_only]