public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/c++-contracts] c++: pass dg-options to module link
@ 2022-11-01 11:43 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2022-11-01 11:43 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:ce5faeb1f533e2cdd4b0f45f18770e0a26f05182

commit ce5faeb1f533e2cdd4b0f45f18770e0a26f05182
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Oct 26 21:37:09 2022 -0400

    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:
---
 gcc/testsuite/g++.dg/modules/modules.exp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp
index afb323d0efd..45ff74c6aa9 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]
 	    }
 	}
     }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-01 11:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01 11:43 [gcc/devel/c++-contracts] c++: pass dg-options to module link Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).