set DEFAULT_CXXFLAGS " -pedantic-errors -Wno-long-long"
}
set DEFAULT_MODFLAGS $DEFAULT_CXXFLAGS
-set MOD_STD_LIST { 17 2a 2b }
dg-init
return $testdir
}
-# Return set of std options to iterate over, taken from g++-dg.exp & compat.exp
+# Return set of std options to iterate over.
proc module-init { src } {
- set tmp [dg-get-options $src]
- set option_list {}
- set have_std 0
- set std_prefix "-std=c++"
+ set option_list [g++-std-flags $src]
global extra_tool_flags
set extra_tool_flags {}
- global MOD_STD_LIST
-
- foreach op $tmp {
- switch [lindex $op 0] {
- "dg-options" {
- set std_prefix "-std=gnu++"
- if { [string match "*-std=*" [lindex $op 2]] } {
- set have_std 1
- }
- eval lappend extra_tool_flags [lindex $op 2]
- }
- "dg-additional-options" {
- if { [string match "*-std=*" [lindex $op 2]] } {
- set have_std 1
- }
- eval lappend extra_tool_flags [lindex $op 2]
- }
- }
- }
- if { $have_std } {
- lappend option_list ""
- } elseif { [string match "*xtreme*" $src] } {
+ if { [llength $option_list]
+ && [string match "*xtreme*" $src] } {
# Only run the xtreme tests once.
- set x [lindex $MOD_STD_LIST end]
- lappend option_list "${std_prefix}$x"
- } else {
- foreach x $MOD_STD_LIST {
- lappend option_list "${std_prefix}$x"
- }
+ set option_list [lrange [lsort $option_list] end end]
}
return $option_list
return [gcc-dg-prune $system $text]
}
+# Return a list of -std flags to use for TEST.
+proc g++-std-flags { test } {
+ # If the testcase specifies a standard, use that one.
+ # If not, run it under several standards, allowing GNU extensions
+ # if there's a dg-options line.
+ if ![search_for $test "-std=*++"] {
+ if [search_for $test "dg-options"] {
+ set std_prefix "-std=gnu++"
+ } else {
+ set std_prefix "-std=c++"
+ }
+
+ set low 0
+ # Some directories expect certain minimums.
+ if { [string match "*/modules/*" $test] } { set low 17 }
+
+ # See g++.exp for the initial value of this list.
+ global gpp_std_list
+ if { [llength $gpp_std_list] > 0 } {
+ set std_list {}
+ foreach ver $gpp_std_list {
+ set cmpver $ver
+ if { $ver == 98 } { set cmpver 03 }
+ if { $ver ni $std_list
+ && $cmpver >= $low } {
+ lappend std_list $ver
+ }
+ }
+ } else {
+ # If the test mentions specific C++ versions, test those.
+ set lines [get_matching_lines $test {\{ dg* c++[0-9][0-9]}]
+ set std_list {}
+ foreach line $lines {
+ regexp {c\+\+([0-9][0-9])} $line -> ver
+ lappend std_list $ver
+
+ if { $ver == 98 } {
+ # Leave low alone.
+ } elseif { [regexp {dg-do|dg-require-effective-target} $line] } {
+ set low $ver
+ }
+ }
+ #verbose "low: $low" 1
+
+ set std_list [lsort -unique $std_list]
+
+ # If fewer than 3 specific versions are mentioned, add more.
+ # The order of this list is significant: first $cxx_default,
+ # then the oldest and newest, then others in rough order of
+ # importance based on test coverage and usage.
+ foreach ver { 17 98 26 11 20 14 23 } {
+ set cmpver $ver
+ if { $ver == 98 } { set cmpver 03 }
+ if { [llength $std_list] < 3
+ && $ver ni $std_list
+ && $cmpver >= $low } {
+ lappend std_list $ver
+ }
+ }
+ verbose "std_list: $std_list" 1
+ }
+ set option_list { }
+ foreach x $std_list {
+ if { $x eq "impcx" } then { set x "26 -fimplicit-constexpr" }
+ lappend option_list "${std_prefix}$x"
+ }
+ } else {
+ set option_list { "" }
+ }
+ return $option_list
+}
+
# Modified dg-runtest that runs tests in multiple standard modes,
# unless they specifically specify one standard.
proc g++-dg-runtest { testcases flags default-extra-flags } {
continue
}
- # If the testcase specifies a standard, use that one.
- # If not, run it under several standards, allowing GNU extensions
- # if there's a dg-options line.
- if ![search_for $test "-std=*++"] {
- if [search_for $test "dg-options"] {
- set std_prefix "-std=gnu++"
- } else {
- set std_prefix "-std=c++"
- }
-
- # See g++.exp for the initial value of this list.
- global gpp_std_list
- if { [llength $gpp_std_list] > 0 } {
- set std_list $gpp_std_list
- } else {
- # If the test mentions specific C++ versions, test those.
- set lines [get_matching_lines $test {\{ dg* c++[0-9][0-9]}]
- set std_list {}
- set low 0
- foreach line $lines {
- regexp {c\+\+([0-9][0-9])} $line -> ver
- lappend std_list $ver
-
- if { $ver == 98 } {
- # Leave low alone.
- } elseif { [regexp {dg-do|dg-require-effective-target} $line] } {
- set low $ver
- }
- }
- #verbose "low: $low" 1
-
- set std_list [lsort -unique $std_list]
-
- # If fewer than 3 specific versions are mentioned, add more.
- # The order of this list is significant: first $cxx_default,
- # then the oldest and newest, then others in rough order of
- # importance based on test coverage and usage.
- foreach ver { 17 98 26 11 20 14 23 } {
- set cmpver $ver
- if { $ver == 98 } { set cmpver 03 }
- if { [llength $std_list] < 3
- && $ver ni $std_list
- && $cmpver > $low } {
- lappend std_list $ver
- }
- }
- verbose "std_list: $std_list" 1
- }
- set option_list { }
- foreach x $std_list {
- if { $x eq "impcx" } then { set x "26 -fimplicit-constexpr" }
- lappend option_list "${std_prefix}$x"
- }
- } else {
- set option_list { "" }
- }
+ set option_list [g++-std-flags $test]
set nshort [file tail [file dirname $test]]/[file tail $test]