[4/4] c++: Add new xtreme-header testcase for GMF discarding

Message ID 663212fe.050a0220.da6fc.9353@mx.google.com
State New
Headers
Series c++/modules: Fix missed GMF discarding |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gcc_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 fail Testing failed

Commit Message

Nathaniel Shead May 1, 2024, 10:01 a.m. UTC
  Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk?

Another thought would be to replace xtreme-header.h with <bits/stdc++.h> so
that we don't need to keep it up-to-date in the future.  But this patch just
does the obviously correct thing.

-- >8 --

This new testcase helps verify that the issues discovered in PR114630
with GMF entries being inappropriately emitted into the module CMI don't
regress, at least for the kinds of code used in the standard library
headers.

This also updates the base xtreme-header.h file to include new header
files that are now available.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
---
 .../g++.dg/modules/xtreme-header-8.C          |  9 +++++++
 gcc/testsuite/g++.dg/modules/xtreme-header.h  | 24 ++++++++++++-------
 2 files changed, 25 insertions(+), 8 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/modules/xtreme-header-8.C
  

Comments

Jason Merrill May 1, 2024, 3:30 p.m. UTC | #1
On 5/1/24 03:01, Nathaniel Shead wrote:
> Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk?

OK.

> Another thought would be to replace xtreme-header.h with <bits/stdc++.h> so
> that we don't need to keep it up-to-date in the future.  But this patch just
> does the obviously correct thing.
> 
> -- >8 --
> 
> This new testcase helps verify that the issues discovered in PR114630
> with GMF entries being inappropriately emitted into the module CMI don't
> regress, at least for the kinds of code used in the standard library
> headers.
> 
> This also updates the base xtreme-header.h file to include new header
> files that are now available.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* g++.dg/modules/xtreme-header.h: Update.
> 	* g++.dg/modules/xtreme-header-8.C: New test.
> 
> Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
> ---
>   .../g++.dg/modules/xtreme-header-8.C          |  9 +++++++
>   gcc/testsuite/g++.dg/modules/xtreme-header.h  | 24 ++++++++++++-------
>   2 files changed, 25 insertions(+), 8 deletions(-)
>   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..b0d0ae87534
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/modules/xtreme-header-8.C
> @@ -0,0 +1,9 @@
> +// { dg-additional-options "-fmodules-ts -fdump-lang-module" }
> +// { dg-module-cmi empty }
> +
> +module;
> +#include "xtreme-header.h"
> +export module empty;
> +
> +// The whole GMF should be discarded here
> +// { dg-final { scan-lang-dump "Wrote 0 clusters" module } }
> diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header.h b/gcc/testsuite/g++.dg/modules/xtreme-header.h
> index 3147aaf00f4..8d95218755a 100644
> --- a/gcc/testsuite/g++.dg/modules/xtreme-header.h
> +++ b/gcc/testsuite/g++.dg/modules/xtreme-header.h
> @@ -89,7 +89,6 @@
>   
>   // C++20
>   #if __cplusplus > 201703
> -#if 1
>   #include <version>
>   #include <barrier>
>   #include <bit>
> @@ -98,6 +97,7 @@
>   #if __cpp_coroutines
>   #include <coroutine>
>   #endif
> +#include <format>
>   #include <latch>
>   #include <numbers>
>   #include <ranges>
> @@ -106,24 +106,32 @@
>   #include <span>
>   #include <stop_token>
>   #include <syncstream>
> -#if 0
> -// Unimplemented
> -#include <format>
> -#endif
> -#endif
>   #endif
>   
>   // C++23
>   #if __cplusplus > 202002L
>   #include <expected>
> +#include <generator>
> +#include <print>
>   #include <spanstream>
>   #include <stacktrace>
> +#include <stdfloat>
>   #if 0
>   // Unimplemented
>   #include <flat_map>
>   #include <flat_set>
> -#include <generator>
>   #include <mdspan>
> -#include <print>
> +#endif
> +#endif
> +
> +// C++26
> +#if __cplusplus > 202302L
> +#if 0
> +// Unimplemented
> +#include <debugging>
> +#include <hazard_pointer>
> +#include <linalg>
> +#include <rcu>
> +#include <text_encoding>
>   #endif
>   #endif
  

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..b0d0ae87534
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/xtreme-header-8.C
@@ -0,0 +1,9 @@ 
+// { dg-additional-options "-fmodules-ts -fdump-lang-module" }
+// { dg-module-cmi empty }
+
+module;
+#include "xtreme-header.h"
+export module empty;
+
+// The whole GMF should be discarded here
+// { dg-final { scan-lang-dump "Wrote 0 clusters" module } }
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header.h b/gcc/testsuite/g++.dg/modules/xtreme-header.h
index 3147aaf00f4..8d95218755a 100644
--- a/gcc/testsuite/g++.dg/modules/xtreme-header.h
+++ b/gcc/testsuite/g++.dg/modules/xtreme-header.h
@@ -89,7 +89,6 @@ 
 
 // C++20
 #if __cplusplus > 201703
-#if 1
 #include <version>
 #include <barrier>
 #include <bit>
@@ -98,6 +97,7 @@ 
 #if __cpp_coroutines
 #include <coroutine>
 #endif
+#include <format>
 #include <latch>
 #include <numbers>
 #include <ranges>
@@ -106,24 +106,32 @@ 
 #include <span>
 #include <stop_token>
 #include <syncstream>
-#if 0
-// Unimplemented
-#include <format>
-#endif
-#endif
 #endif
 
 // C++23
 #if __cplusplus > 202002L
 #include <expected>
+#include <generator>
+#include <print>
 #include <spanstream>
 #include <stacktrace>
+#include <stdfloat>
 #if 0
 // Unimplemented
 #include <flat_map>
 #include <flat_set>
-#include <generator>
 #include <mdspan>
-#include <print>
+#endif
+#endif
+
+// C++26
+#if __cplusplus > 202302L
+#if 0
+// Unimplemented
+#include <debugging>
+#include <hazard_pointer>
+#include <linalg>
+#include <rcu>
+#include <text_encoding>
 #endif
 #endif