]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: pass dg-options to module link
authorJason Merrill <jason@redhat.com>
Thu, 27 Oct 2022 01:37:09 +0000 (21:37 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 28 Oct 2022 20:36:00 +0000 (16:36 -0400)
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.

gcc/testsuite/g++.dg/modules/modules.exp

index afb323d0efd001cea6630d0bc4fa4b7f2e8f55ea..45ff74c6aa9ccb76c89bbfd2b1ffb6fa01a7a47f 100644 (file)
@@ -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]
            }
        }
     }