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++: fix module attachment in contract tests
Date: Mon, 17 Oct 2022 21:17:08 +0000 (GMT)	[thread overview]
Message-ID: <20221017211708.7206E38582B0@sourceware.org> (raw)

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

commit c436179eec24702efc27c9c19614192d3c6ad8a5
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Oct 17 17:08:56 2022 -0400

    c++: fix module attachment in contract tests
    
    handle_contract_violation needs to be attached to the global module.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/modules/contracts-1_a.C
            * g++.dg/modules/contracts-2_a.C
            * g++.dg/modules/contracts-3_a.C
            * g++.dg/modules/contracts-4_a.C: Add extern "C++".

Diff:
---
 gcc/testsuite/g++.dg/modules/contracts-1_a.C | 2 +-
 gcc/testsuite/g++.dg/modules/contracts-2_a.C | 2 +-
 gcc/testsuite/g++.dg/modules/contracts-3_a.C | 2 +-
 gcc/testsuite/g++.dg/modules/contracts-4_a.C | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/testsuite/g++.dg/modules/contracts-1_a.C b/gcc/testsuite/g++.dg/modules/contracts-1_a.C
index c1c2f6add93..17bd5603e0c 100644
--- a/gcc/testsuite/g++.dg/modules/contracts-1_a.C
+++ b/gcc/testsuite/g++.dg/modules/contracts-1_a.C
@@ -8,7 +8,7 @@ export module foo;
 // { dg-module-cmi foo }
 
 export int violation_count{0};
-export void handle_contract_violation(const std::contract_violation &violation)
+extern "C++" export void handle_contract_violation(const std::contract_violation &violation)
 {
   violation_count++;
   printf("violation_count: %d\n", violation_count);
diff --git a/gcc/testsuite/g++.dg/modules/contracts-2_a.C b/gcc/testsuite/g++.dg/modules/contracts-2_a.C
index cb9efd7ec07..59b7a8194df 100644
--- a/gcc/testsuite/g++.dg/modules/contracts-2_a.C
+++ b/gcc/testsuite/g++.dg/modules/contracts-2_a.C
@@ -12,7 +12,7 @@ export module foo;
 
 export int violation_count{0};
 export int violation_line_sum{0};
-export void handle_contract_violation(const std::contract_violation &violation)
+extern "C++" export void handle_contract_violation(const std::contract_violation &violation)
 {
   violation_count++;
   violation_line_sum += violation.line_number () * violation_count;
diff --git a/gcc/testsuite/g++.dg/modules/contracts-3_a.C b/gcc/testsuite/g++.dg/modules/contracts-3_a.C
index ab362a37851..24e709768ae 100644
--- a/gcc/testsuite/g++.dg/modules/contracts-3_a.C
+++ b/gcc/testsuite/g++.dg/modules/contracts-3_a.C
@@ -8,7 +8,7 @@ export module foo;
 // { dg-module-cmi foo }
 
 export int violation_count{0};
-export void handle_contract_violation(const std::contract_violation &violation)
+extern "C++" export void handle_contract_violation(const std::contract_violation &violation)
 {
   violation_count++;
   printf("violation_count: %d\n", violation_count);
diff --git a/gcc/testsuite/g++.dg/modules/contracts-4_a.C b/gcc/testsuite/g++.dg/modules/contracts-4_a.C
index ab6c8112f26..0fe6f02cb94 100644
--- a/gcc/testsuite/g++.dg/modules/contracts-4_a.C
+++ b/gcc/testsuite/g++.dg/modules/contracts-4_a.C
@@ -9,7 +9,7 @@ export module foo;
 // { dg-module-cmi foo }
 
 export int violation_count{0};
-export void handle_contract_violation(const std::contract_violation &violation)
+extern "C++" export void handle_contract_violation(const std::contract_violation &violation)
 {
   violation_count++;
   printf("violation_count: %d\n", violation_count);

                 reply	other threads:[~2022-10-17 21:17 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=20221017211708.7206E38582B0@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).