diff mbox series

[v2,6/6] c++/modules: Add testcase for standard-library exposures [PR115126]

Message ID 66f649e5.170a0220.1308b0.3e86@mx.google.com
State New
Headers show
Series c++/modules: Implement P1815 "Translation-unit-local entities" | expand

Commit Message

Nathaniel Shead Sept. 27, 2024, 6 a.m. UTC
Bootstrapped and regtested on x86_64-pc-linux-gnu and aarch64-unknown-linux-gnu,
OK for trunk?

-- >8 --

This adds a new xtreme-header testcase to ensure that we have no
regressions with regards to exposures of TU-local declarations
in the standard library header files.

A more restrictive test would be to do 'export extern "C++"' here, but
unfortunately the system headers on some targets declare TU-local
entities, so we'll make do with checking that at least the C++ standard
library headers don't refer to such entities.

	PR c++/115126

gcc/testsuite/ChangeLog:

	* g++.dg/modules/xtreme-header-8.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
---
 gcc/testsuite/g++.dg/modules/xtreme-header-8.C | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/modules/xtreme-header-8.C

Comments

Jason Merrill Sept. 27, 2024, 4:26 p.m. UTC | #1
On 9/27/24 2:00 AM, Nathaniel Shead wrote:
> Bootstrapped and regtested on x86_64-pc-linux-gnu and aarch64-unknown-linux-gnu,
> OK for trunk?
> 
> -- >8 --
> 
> This adds a new xtreme-header testcase to ensure that we have no
> regressions with regards to exposures of TU-local declarations
> in the standard library header files.
> 
> A more restrictive test would be to do 'export extern "C++"' here, but
> unfortunately the system headers on some targets declare TU-local
> entities, so we'll make do with checking that at least the C++ standard
> library headers don't refer to such entities.

Looks fine, please squash this with the patch that adds the warning.

> 	PR c++/115126
> 
> gcc/testsuite/ChangeLog:
> 
> 	* g++.dg/modules/xtreme-header-8.C: New test.
> 
> Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
> ---
>   gcc/testsuite/g++.dg/modules/xtreme-header-8.C | 8 ++++++++
>   1 file changed, 8 insertions(+)
>   create mode 100644 gcc/testsuite/g++.dg/modules/xtreme-header-8.C
> 
> diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-8.C b/gcc/testsuite/g++.dg/modules/xtreme-header-8.C
> new file mode 100644
> index 00000000000..9da4e01cc68
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/modules/xtreme-header-8.C
> @@ -0,0 +1,8 @@
> +// PR c++/115126
> +// { dg-additional-options "-fmodules-ts -Wignored-exposures" }
> +// { dg-module-cmi xstd }
> +
> +export module xstd;
> +extern "C++" {
> +  #include "xtreme-header.h"
> +}
diff mbox series

Patch

diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-8.C b/gcc/testsuite/g++.dg/modules/xtreme-header-8.C
new file mode 100644
index 00000000000..9da4e01cc68
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/xtreme-header-8.C
@@ -0,0 +1,8 @@ 
+// PR c++/115126
+// { dg-additional-options "-fmodules-ts -Wignored-exposures" }
+// { dg-module-cmi xstd }
+
+export module xstd;
+extern "C++" {
+  #include "xtreme-header.h"
+}