public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jason Merrill <jason@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/c++-contracts] c++: pass dg-options to module link
Date: Tue,  1 Nov 2022 11:43:16 +0000 (GMT)	[thread overview]
Message-ID: <20221101114316.2163938582B6@sourceware.org> (raw)

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]
 	    }
 	}
     }

                 reply	other threads:[~2022-11-01 11:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221101114316.2163938582B6@sourceware.org \
    --to=jason@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).