From: Jason Merrill Date: Thu, 27 Oct 2022 01:37:09 +0000 (-0400) Subject: c++: pass dg-options to module link X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce5faeb1f533e2cdd4b0f45f18770e0a26f05182;p=thirdparty%2Fgcc.git c++: pass dg-options to module link The link command needs to see -fcontracts for it to automatically add -lstdc++exp. gcc/testsuite/ChangeLog: * g++.dg/modules/modules.exp: Pass dg-options to link command. --- diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp index afb323d0efd0..45ff74c6aa9c 100644 --- a/gcc/testsuite/g++.dg/modules/modules.exp +++ b/gcc/testsuite/g++.dg/modules/modules.exp @@ -187,8 +187,9 @@ proc module_do_it { do_what testcase std asm_list } { lappend options "additional_flags=$std" set ident "$ident $std" } - if { [llength $do_what] > 3 } { - lappend options "additional_flags=[lindex $do_what 3]" + global extra_tool_flags + if { [llength $extra_tool_flags] } { + lappend options "additional_flags=$extra_tool_flags" } set execname "./[file tail $testcase].exe" @@ -250,6 +251,8 @@ proc module-init { src } { set option_list {} set have_std 0 set std_prefix "-std=c++" + global extra_tool_flags + set extra_tool_flags {} foreach op $tmp { switch [lindex $op 0] { @@ -258,11 +261,13 @@ proc module-init { src } { 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] } } }