c++: Add stdlib module test cases
authorNathan Sidwell <nathan@acm.org>
Mon, 4 Jan 2021 15:45:36 +0000 (07:45 -0800)
committerNathan Sidwell <nathan@acm.org>
Mon, 4 Jan 2021 15:52:21 +0000 (07:52 -0800)
The remaining modules tests use the std library.  These are those.

gcc/testsuite/
* g++.dg/modules/binding-1_a.H: New.
* g++.dg/modules/binding-1_b.H: New.
* g++.dg/modules/binding-1_c.C: New.
* g++.dg/modules/binding-2.H: New.
* g++.dg/modules/builtin-3_a.C: New.
* g++.dg/modules/global-2_a.C: New.
* g++.dg/modules/global-2_b.C: New.
* g++.dg/modules/global-3_a.C: New.
* g++.dg/modules/global-3_b.C: New.
* g++.dg/modules/hello-1_a.C: New.
* g++.dg/modules/hello-1_b.C: New.
* g++.dg/modules/iostream-1_a.H: New.
* g++.dg/modules/iostream-1_b.C: New.
* g++.dg/modules/part-5_a.C: New.
* g++.dg/modules/part-5_b.C: New.
* g++.dg/modules/part-5_c.C: New.
* g++.dg/modules/stdio-1_a.H: New.
* g++.dg/modules/stdio-1_b.C: New.
* g++.dg/modules/string-1_a.H: New.
* g++.dg/modules/string-1_b.C: New.
* g++.dg/modules/string-view1.C: New.
* g++.dg/modules/string-view2.C: New.
* g++.dg/modules/tinfo-1.C: New.
* g++.dg/modules/tinfo-2_a.H: New.
* g++.dg/modules/tinfo-2_b.C: New.
* g++.dg/modules/tname-spec-1_a.H: New.
* g++.dg/modules/tname-spec-1_b.C: New.
* g++.dg/modules/xtreme-header-1.h: New.
* g++.dg/modules/xtreme-header-1_a.H: New.
* g++.dg/modules/xtreme-header-1_b.C: New.
* g++.dg/modules/xtreme-header-1_c.C: New.
* g++.dg/modules/xtreme-header-2.h: New.
* g++.dg/modules/xtreme-header-2_a.H: New.
* g++.dg/modules/xtreme-header-2_b.C: New.
* g++.dg/modules/xtreme-header-2_c.C: New.
* g++.dg/modules/xtreme-header-3.h: New.
* g++.dg/modules/xtreme-header-3_a.H: New.
* g++.dg/modules/xtreme-header-3_b.C: New.
* g++.dg/modules/xtreme-header-3_c.C: New.
* g++.dg/modules/xtreme-header-4.h: New.
* g++.dg/modules/xtreme-header-4_a.H: New.
* g++.dg/modules/xtreme-header-4_b.C: New.
* g++.dg/modules/xtreme-header-4_c.C: New.
* g++.dg/modules/xtreme-header-5.h: New.
* g++.dg/modules/xtreme-header-5_a.H: New.
* g++.dg/modules/xtreme-header-5_b.C: New.
* g++.dg/modules/xtreme-header-5_c.C: New.
* g++.dg/modules/xtreme-header-6.h: New.
* g++.dg/modules/xtreme-header-6_a.H: New.
* g++.dg/modules/xtreme-header-6_b.C: New.
* g++.dg/modules/xtreme-header-6_c.C: New.
* g++.dg/modules/xtreme-header.h: New.
* g++.dg/modules/xtreme-header_a.H: New.
* g++.dg/modules/xtreme-header_b.C: New.
* g++.dg/modules/xtreme-tr1.h: New.
* g++.dg/modules/xtreme-tr1_a.H: New.
* g++.dg/modules/xtreme-tr1_b.C: New.

57 files changed:
gcc/testsuite/g++.dg/modules/binding-1_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/binding-1_b.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/binding-1_c.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/binding-2.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/builtin-3_a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/global-2_a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/global-2_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/global-3_a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/global-3_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/hello-1_a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/hello-1_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/iostream-1_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/iostream-1_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/part-5_a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/part-5_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/part-5_c.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/stdio-1_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/stdio-1_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/string-1_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/string-1_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/string-view1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/string-view2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/tinfo-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/tinfo-2_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/tinfo-2_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/tname-spec-1_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/tname-spec-1_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-1.h [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-1_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-1_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-1_c.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-2.h [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-2_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-2_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-2_c.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-3.h [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-3_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-3_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-3_c.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-4.h [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-4_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-4_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-4_c.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-5.h [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-5_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-5_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-5_c.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-6.h [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-6_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-6_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header-6_c.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header.h [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-header_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-tr1.h [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-tr1_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/xtreme-tr1_b.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/modules/binding-1_a.H b/gcc/testsuite/g++.dg/modules/binding-1_a.H
new file mode 100644 (file)
index 0000000..2d2460d
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+
+#include <iostream>
diff --git a/gcc/testsuite/g++.dg/modules/binding-1_b.H b/gcc/testsuite/g++.dg/modules/binding-1_b.H
new file mode 100644 (file)
index 0000000..eb5140b
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+
+#include <string>
diff --git a/gcc/testsuite/g++.dg/modules/binding-1_c.C b/gcc/testsuite/g++.dg/modules/binding-1_c.C
new file mode 100644 (file)
index 0000000..b63f88f
--- /dev/null
@@ -0,0 +1,7 @@
+// { dg-additional-options -fmodules-ts }
+
+export module hello;
+// { dg-module-cmi hello }
+
+import "binding-1_a.H";
+import "binding-1_b.H";
diff --git a/gcc/testsuite/g++.dg/modules/binding-2.H b/gcc/testsuite/g++.dg/modules/binding-2.H
new file mode 100644 (file)
index 0000000..e82d7cf
--- /dev/null
@@ -0,0 +1,9 @@
+// { dg-additional-options "-fmodule-header -Wextra" }
+// { dg-module-cmi {} }
+
+void* operator new(__SIZE_TYPE__, void* __p) noexcept;
+void* operator new[](__SIZE_TYPE__, void* __p) noexcept;
+
+void operator delete (void*, void*) noexcept;
+void operator delete[](void*, void*) noexcept;
+
diff --git a/gcc/testsuite/g++.dg/modules/builtin-3_a.C b/gcc/testsuite/g++.dg/modules/builtin-3_a.C
new file mode 100644 (file)
index 0000000..ad30ccf
--- /dev/null
@@ -0,0 +1,44 @@
+// { dg-additional-options "-fmodules-ts -fdump-lang-module-blocks-alias-uid" }
+module;
+#include <stdarg.h>
+export module builtins;
+// { dg-module-cmi builtins }
+
+export inline unsigned length (char const *ptr)
+{
+  return __builtin_strlen (ptr);
+}
+
+export inline int count (int a, ...)
+{
+  int c = 0;
+
+  va_list args;
+  va_start (args, a);
+  while (va_arg (args, char *))
+    c++;
+  va_end (args);
+
+  return c;
+}
+
+// { dg-final { scan-lang-dump-not {Cluster members:\n  \[0\]=decl declaration '::__builtin_strlen'\n  \[1\]=binding '::__builtin_strlen'\n} module } }
+// { dg-final { scan-lang-dump {Wrote GMF:-[0-9]* function_decl:'::__builtin_strlen'@builtins} module } }
+// { dg-final { scan-lang-dump {Writing:-[0-9]*'s named merge key \(decl\) function_decl:'::__builtin_strlen'} module } }
+// { dg-final { scan-lang-dump-not {Writing tree:-[0-9]* function_decl:'__builtin_strlen'\(strlen\)} module } }
+
+// The implementation details of va_list's are target-specific.
+// Usually one of two patterns though
+// { dg-final { scan-lang-dump-not { Cluster members:\n  \[0\]=decl declaration '::__builtin_va_list'\n  \[1\]=binding '::__builtin_va_list'\n} module { target i?86-*-linux* x86_64-*-linux* } } }
+// { dg-final { scan-lang-dump {Wrote GMF:-[0-9]* type_decl:'::__builtin_va_list'@builtins} module { target x86_64-*-linux* } } }
+// { dg-final { scan-lang-dump {Writing:-[0-9]*'s named merge key \(decl\) type_decl:'::__builtin_va_list'} module { target x86_64-*-linux* } } }
+
+// { dg-final { scan-lang-dump {Writing:-1's named merge key \(decl\) type_decl:'::__gnuc_va_list'} module { target i?86-*-linux* *-*-darwin* } } }
+// { dg-final { scan-lang-dump {Wrote GMF:-3 type_decl:'::__gnuc_va_list'@builtins} module { target i?86-*-linux* *-*-darwin* } } }
+
+// { dg-final { scan-lang-dump {Wrote fixed:[0-9]* record_type:'__va_list'} module { target aarch64*-*-linux* } } }
+// { dg-final { scan-lang-dump {Wrote fixed:[0-9]* pointer_type:'::__builtin_va_list'} module { target powerpc*-*-linux* } } }
+
+// { dg-final { scan-lang-dump-not { Cluster members:\n  \[0\]=decl declaration '::va_list'\n  \[1\]=binding '::va_list'\n} module } }
+// { dg-final { scan-lang-dump {Wrote GMF:-[0-9]* type_decl:'::va_list'@builtins} module } }
+// { dg-final { scan-lang-dump {Writing:-[0-9]*'s named merge key \(decl\) type_decl:'::va_list'} module } }
diff --git a/gcc/testsuite/g++.dg/modules/global-2_a.C b/gcc/testsuite/g++.dg/modules/global-2_a.C
new file mode 100644 (file)
index 0000000..7f86fe9
--- /dev/null
@@ -0,0 +1,22 @@
+// { dg-module-do run }
+// { dg-additional-options "-fmodules-ts -fdump-lang-module-graph" }
+module;
+#include <stdio.h>
+#include <stdarg.h>
+export module logger;
+// { dg-module-cmi logger }
+
+export void Log (char const *fmt, ...)
+{
+  va_list args;
+  va_start (args, fmt);
+  printf ("Logging:");
+  vprintf (fmt, args);
+  printf ("\n");
+  va_end (args);
+}
+
+// { dg-final { scan-lang-dump {Dependencies of decl function_decl:'::Log'} module } }
+// not reachable (body not inline)
+// { dg-final { scan-lang-dump-not {Reachable GMF '::printf[^\n']*' added} module } }
+
diff --git a/gcc/testsuite/g++.dg/modules/global-2_b.C b/gcc/testsuite/g++.dg/modules/global-2_b.C
new file mode 100644 (file)
index 0000000..7d49e1d
--- /dev/null
@@ -0,0 +1,10 @@
+// { dg-additional-options "-fmodules-ts" }
+
+import logger;
+
+int main ()
+{
+  Log ("hello world!");
+  return 0;
+}
+
diff --git a/gcc/testsuite/g++.dg/modules/global-3_a.C b/gcc/testsuite/g++.dg/modules/global-3_a.C
new file mode 100644 (file)
index 0000000..fe7bb84
--- /dev/null
@@ -0,0 +1,16 @@
+// { dg-module-do run }
+// { dg-additional-options "-fmodules-ts -fdump-lang-module-graph" }
+module;
+#include <iostream>
+export module logger;
+// { dg-module-cmi logger }
+
+export void Log (char const *msg)
+{
+  std::cout << "Logging:" << msg << "\n";
+}
+
+// { dg-final { scan-lang-dump {Dependencies of decl function_decl:'::Log'} module } }
+// not reachable (body not inline)
+// { dg-final { scan-lang-dump-not {Reachable GMF '::printf[^'\n]*' added} module } }
+
diff --git a/gcc/testsuite/g++.dg/modules/global-3_b.C b/gcc/testsuite/g++.dg/modules/global-3_b.C
new file mode 100644 (file)
index 0000000..da0a399
--- /dev/null
@@ -0,0 +1,9 @@
+// { dg-additional-options "-fmodules-ts" }
+
+import logger;
+
+int main ()
+{
+  Log ("hello world!");
+  return 0;
+}
diff --git a/gcc/testsuite/g++.dg/modules/hello-1_a.C b/gcc/testsuite/g++.dg/modules/hello-1_a.C
new file mode 100644 (file)
index 0000000..75853d6
--- /dev/null
@@ -0,0 +1,12 @@
+// { dg-module-do run }
+// { dg-additional-options -fmodules-ts }
+
+module;
+#include <iostream>
+#include <string_view>
+export module hello;
+// { dg-module-cmi hello }
+export void greeter (std::string_view const &name)
+{
+  std::cout << "Hello " << name << "!\n";
+}
diff --git a/gcc/testsuite/g++.dg/modules/hello-1_b.C b/gcc/testsuite/g++.dg/modules/hello-1_b.C
new file mode 100644 (file)
index 0000000..b7d78c4
--- /dev/null
@@ -0,0 +1,9 @@
+// { dg-additional-options -fmodules-ts }
+
+#include <string_view>
+import hello;
+int main (void)
+{
+  greeter ("world");
+  return 0;
+}
diff --git a/gcc/testsuite/g++.dg/modules/iostream-1_a.H b/gcc/testsuite/g++.dg/modules/iostream-1_a.H
new file mode 100644 (file)
index 0000000..00f8c19
--- /dev/null
@@ -0,0 +1,10 @@
+// { dg-module-do run }
+// { dg-additional-options "-fmodule-header" }
+// { dg-module-cmi {} }
+
+#ifndef MY_IOSTREAM_H
+#define MY_IOSTREAM_H
+/* Proxy iostream, because command line in flux.  */
+#include <iostream>
+
+#endif
diff --git a/gcc/testsuite/g++.dg/modules/iostream-1_b.C b/gcc/testsuite/g++.dg/modules/iostream-1_b.C
new file mode 100644 (file)
index 0000000..8058a7f
--- /dev/null
@@ -0,0 +1,9 @@
+// { dg-additional-options -fmodules-ts }
+
+import "iostream-1_a.H";
+
+int main ()
+{
+  std::cout << "hello world!\n";
+  return 0;
+}
diff --git a/gcc/testsuite/g++.dg/modules/part-5_a.C b/gcc/testsuite/g++.dg/modules/part-5_a.C
new file mode 100644 (file)
index 0000000..7679691
--- /dev/null
@@ -0,0 +1,13 @@
+// { dg-additional-options -fmodules-ts }
+
+// a bug report ICE with namespace introduced in partition.
+export module module1:submodule1;
+// { dg-module-cmi module1:submodule1 }
+
+export namespace nmspc{
+    class Cl1{
+        public:
+        Cl1(){}
+        int x=14;
+    };
+}
diff --git a/gcc/testsuite/g++.dg/modules/part-5_b.C b/gcc/testsuite/g++.dg/modules/part-5_b.C
new file mode 100644 (file)
index 0000000..f86bdd6
--- /dev/null
@@ -0,0 +1,6 @@
+// { dg-additional-options -fmodules-ts }
+
+export module module1;
+// { dg-module-cmi module1 }
+
+export import :submodule1;
diff --git a/gcc/testsuite/g++.dg/modules/part-5_c.C b/gcc/testsuite/g++.dg/modules/part-5_c.C
new file mode 100644 (file)
index 0000000..0f148c3
--- /dev/null
@@ -0,0 +1,10 @@
+// { dg-additional-options -fmodules-ts }
+
+#include <iostream>
+import module1;
+
+int main(int argc, char const *argv[]) {
+  nmspc::Cl1 c1;
+  std::cout << c1.x;
+  return 0;
+}
diff --git a/gcc/testsuite/g++.dg/modules/stdio-1_a.H b/gcc/testsuite/g++.dg/modules/stdio-1_a.H
new file mode 100644 (file)
index 0000000..9eda233
--- /dev/null
@@ -0,0 +1,14 @@
+// { dg-module-do run }
+// { dg-additional-options "-fmodule-header -fdump-lang-module" }
+// { dg-module-cmi {} }
+
+#ifndef _PROXY_STDIO_H
+#define _PROXY_STDIO_H
+/* Proxy stdio.h, because command line in flux.  */
+#include <stdio.h>
+
+#endif
+// There should be *lots* of depsets (209 for glibc today)
+// { dg-final { scan-lang-dump {Writing section:60 } module } }
+// { dg-final { scan-lang-dump {Depset:0 decl entity:[0-9]* function_decl:'::printf'} module } }
+// { dg-final { scan-lang-dump {Depset:1 binding namespace_decl:'::printf'} module } }
diff --git a/gcc/testsuite/g++.dg/modules/stdio-1_b.C b/gcc/testsuite/g++.dg/modules/stdio-1_b.C
new file mode 100644 (file)
index 0000000..f4ad984
--- /dev/null
@@ -0,0 +1,14 @@
+// { dg-additional-options "-fmodules-ts -fdump-lang-module" }
+
+import "stdio-1_a.H";
+
+int main ()
+{
+  printf ("hello world!\n");
+  return 0;
+}
+
+// { dg-final { scan-lang-dump {Bindings '::printf' section:} module } }
+// { dg-final { scan-lang-dump {Lazily binding '::printf'@'[^\n]*stdio-1_a.H' section:} module } }
+// Make sure we don't load spurious stuff
+// { dg-final { scan-lang-dump-not {binding '::scanf'@'[^\n]*'} module } }
diff --git a/gcc/testsuite/g++.dg/modules/string-1_a.H b/gcc/testsuite/g++.dg/modules/string-1_a.H
new file mode 100644 (file)
index 0000000..77c565f
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options -fmodule-header }
+
+// { dg-module-cmi {} }
+#include <string>
diff --git a/gcc/testsuite/g++.dg/modules/string-1_b.C b/gcc/testsuite/g++.dg/modules/string-1_b.C
new file mode 100644 (file)
index 0000000..098289c
--- /dev/null
@@ -0,0 +1,5 @@
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+#include <string>
+import "string-1_a.H";
+
diff --git a/gcc/testsuite/g++.dg/modules/string-view1.C b/gcc/testsuite/g++.dg/modules/string-view1.C
new file mode 100644 (file)
index 0000000..f5391f3
--- /dev/null
@@ -0,0 +1,6 @@
+// { dg-additional-options "-fmodules-ts" }
+module;
+#include <cstdio>
+#include <string_view>
+export module foo;
+// { dg-module-cmi foo }
diff --git a/gcc/testsuite/g++.dg/modules/string-view2.C b/gcc/testsuite/g++.dg/modules/string-view2.C
new file mode 100644 (file)
index 0000000..dad30ea
--- /dev/null
@@ -0,0 +1,56 @@
+// { dg-additional-options "-fmodules-ts" }
+// reduced from string-view1 through cvise. Broken under c++2a too.
+// we were creating a hash slot, and then doing another lookup without
+// initializing that first slot :(
+
+namespace std {
+typedef int a;
+int b;
+decltype(nullptr) c;
+namespace xyz {}
+__builtin_va_list d;
+int n;
+int e;
+int f;
+int g;
+int h;
+int i;
+int j;
+int k;
+typedef struct l m;
+typedef struct aa w;
+typedef struct x o;
+typedef x p;
+long q;
+long r;
+typedef l s;
+extern p ab;
+void t();
+void v();
+extern p ac;
+void ad();
+int ae;
+int af;
+extern p ag;
+extern p ah;
+void ai();
+void y();
+int aj;
+int ak;
+int al;
+char am;
+int an;
+a ao;
+int ap;
+int aq;
+void z();
+int ar;
+int as;
+void at();
+void au();
+void av();
+void aw();
+int u;
+namespace zz {
+}
+}
diff --git a/gcc/testsuite/g++.dg/modules/tinfo-1.C b/gcc/testsuite/g++.dg/modules/tinfo-1.C
new file mode 100644 (file)
index 0000000..43dadc8
--- /dev/null
@@ -0,0 +1,20 @@
+// { dg-additional-options "-fmodules-ts -fdump-lang-module-uid" }
+export module Foo;
+// { dg-module-cmi Foo }
+
+struct B 
+{
+};
+
+struct C : B 
+{
+};
+
+inline void foo ()
+{
+  throw C ();
+}
+
+// { dg-final { scan-lang-dump {Writing typedef type_decl:'::__si_class_type_info_pseudo_9'} module } }
+// { dg-final { scan-lang-dump {Wrote tinfo_type:-[0-9]* 9 '::__si_class_type_info_pseudo_9'} module } }
+// { dg-final { scan-lang-dump-not {Writing tree:-[0-9]* type_decl:'__si_class_type_info_pseudo_9'} module } }
diff --git a/gcc/testsuite/g++.dg/modules/tinfo-2_a.H b/gcc/testsuite/g++.dg/modules/tinfo-2_a.H
new file mode 100644 (file)
index 0000000..027abd2
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options "-fmodule-header" }
+// { dg-module-cmi {} }
+
+#include <typeinfo>
diff --git a/gcc/testsuite/g++.dg/modules/tinfo-2_b.C b/gcc/testsuite/g++.dg/modules/tinfo-2_b.C
new file mode 100644 (file)
index 0000000..15c5bf2
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+import "tinfo-2_a.H";
+
diff --git a/gcc/testsuite/g++.dg/modules/tname-spec-1_a.H b/gcc/testsuite/g++.dg/modules/tname-spec-1_a.H
new file mode 100644 (file)
index 0000000..d517742
--- /dev/null
@@ -0,0 +1,15 @@
+// { dg-module-do run }
+// { dg-additional-options -fmodule-header }
+
+template<template<typename> class _Op>
+using __detected_or_t = long;
+
+template<typename _Ptr>
+struct pointer_traits
+{
+  template<typename _Tp>
+  using __difference_type = typename _Tp::difference_type;
+
+  using difference_type = __detected_or_t<__difference_type>;
+};
+
diff --git a/gcc/testsuite/g++.dg/modules/tname-spec-1_b.C b/gcc/testsuite/g++.dg/modules/tname-spec-1_b.C
new file mode 100644 (file)
index 0000000..5028b78
--- /dev/null
@@ -0,0 +1,16 @@
+// { dg-additional-options -fmodules-ts }
+
+#include <typeinfo>
+import "tname-spec-1_a.H";
+
+struct X
+{
+  using difference_type = char;
+};
+
+pointer_traits<X>::difference_type x;
+
+int main ()
+{
+  return !(typeid (x) == typeid (long));
+}
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-1.h b/gcc/testsuite/g++.dg/modules/xtreme-header-1.h
new file mode 100644 (file)
index 0000000..a7c635c
--- /dev/null
@@ -0,0 +1,19 @@
+// All the headers tickle a location bug.  so subsets of the STL :(
+
+// C compatibility
+#include <cassert>
+#include <cerrno>
+#include <cfenv>
+#include <cfloat>
+#include <cinttypes>
+#include <climits>
+#include <clocale>
+#include <cmath>
+#include <csetjmp>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-1_a.H b/gcc/testsuite/g++.dg/modules/xtreme-header-1_a.H
new file mode 100644 (file)
index 0000000..f30dacc
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options -fmodule-header }
+
+// { dg-module-cmi {} }
+#include "xtreme-header-1.h"
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-1_b.C b/gcc/testsuite/g++.dg/modules/xtreme-header-1_b.C
new file mode 100644 (file)
index 0000000..e273016
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+#include "xtreme-header-1.h"
+import "xtreme-header-1_a.H";
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-1_c.C b/gcc/testsuite/g++.dg/modules/xtreme-header-1_c.C
new file mode 100644 (file)
index 0000000..081a302
--- /dev/null
@@ -0,0 +1,3 @@
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+import "xtreme-header-1_a.H";
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-2.h b/gcc/testsuite/g++.dg/modules/xtreme-header-2.h
new file mode 100644 (file)
index 0000000..ded093e
--- /dev/null
@@ -0,0 +1,14 @@
+// Everything that transitively includes <ranges>
+
+#include <algorithm>
+// FIXME: PR 97549
+// #include <execution>
+#include <functional>
+#include <future>
+#include <memory>
+#include <memory_resource>
+#include <regex>
+#include <scoped_allocator>
+#include <thread>
+#include <valarray>
+#include <ranges>
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-2_a.H b/gcc/testsuite/g++.dg/modules/xtreme-header-2_a.H
new file mode 100644 (file)
index 0000000..217ead3
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options -fmodule-header }
+
+// { dg-module-cmi {} }
+#include "xtreme-header-2.h"
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-2_b.C b/gcc/testsuite/g++.dg/modules/xtreme-header-2_b.C
new file mode 100644 (file)
index 0000000..1f608ec
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+#include "xtreme-header-2.h"
+import "xtreme-header-2_a.H";
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-2_c.C b/gcc/testsuite/g++.dg/modules/xtreme-header-2_c.C
new file mode 100644 (file)
index 0000000..bd942c3
--- /dev/null
@@ -0,0 +1,3 @@
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+import "xtreme-header-2_a.H";
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-3.h b/gcc/testsuite/g++.dg/modules/xtreme-header-3.h
new file mode 100644 (file)
index 0000000..bbfef0a
--- /dev/null
@@ -0,0 +1,21 @@
+// Containers (except ranges-including ones)
+
+#include <array>
+#include <bitset>
+#include <deque>
+#include <forward_list>
+#include <initializer_list>
+#include <iterator>
+#include <list>
+#include <map>
+#include <optional>
+#include <queue>
+#include <set>
+#include <stack>
+#include <string>
+#include <string_view>
+#include <tuple>
+#include <unordered_map>
+#include <unordered_set>
+#include <variant>
+#include <vector>
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-3_a.H b/gcc/testsuite/g++.dg/modules/xtreme-header-3_a.H
new file mode 100644 (file)
index 0000000..d3ff6fd
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options -fmodule-header }
+
+// { dg-module-cmi {} }
+#include "xtreme-header-3.h"
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-3_b.C b/gcc/testsuite/g++.dg/modules/xtreme-header-3_b.C
new file mode 100644 (file)
index 0000000..2eb3145
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+#include "xtreme-header-3.h"
+import "xtreme-header-3_a.H";
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-3_c.C b/gcc/testsuite/g++.dg/modules/xtreme-header-3_c.C
new file mode 100644 (file)
index 0000000..0852b71
--- /dev/null
@@ -0,0 +1,3 @@
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+import "xtreme-header-3_a.H";
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-4.h b/gcc/testsuite/g++.dg/modules/xtreme-header-4.h
new file mode 100644 (file)
index 0000000..4c918bc
--- /dev/null
@@ -0,0 +1,17 @@
+// io
+
+#include <charconv>
+#include <cctype>
+#include <cuchar>
+#include <cwchar>
+#include <cwctype>
+#include <filesystem>
+#include <fstream>
+#include <iomanip>
+#include <ios>
+#include <iosfwd>
+#include <istream>
+#include <locale>
+#include <ostream>
+#include <sstream>
+#include <streambuf>
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-4_a.H b/gcc/testsuite/g++.dg/modules/xtreme-header-4_a.H
new file mode 100644 (file)
index 0000000..391adbe
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options -fmodule-header }
+
+// { dg-module-cmi {} }
+#include "xtreme-header-4.h"
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-4_b.C b/gcc/testsuite/g++.dg/modules/xtreme-header-4_b.C
new file mode 100644 (file)
index 0000000..ff7147e
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+#include "xtreme-header-4.h"
+import "xtreme-header-4_a.H";
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-4_c.C b/gcc/testsuite/g++.dg/modules/xtreme-header-4_c.C
new file mode 100644 (file)
index 0000000..829a0e9
--- /dev/null
@@ -0,0 +1,3 @@
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+import "xtreme-header-4_a.H";
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-5.h b/gcc/testsuite/g++.dg/modules/xtreme-header-5.h
new file mode 100644 (file)
index 0000000..ed43541
--- /dev/null
@@ -0,0 +1,22 @@
+// Remaining C++17 headers
+
+// C++ 17 and below
+#include <any>
+#include <atomic>
+#include <chrono>
+#include <complex>
+#include <condition_variable>
+#include <exception>
+#include <limits>
+#include <mutex>
+#include <new>
+#include <numeric>
+#include <random>
+#include <ratio>
+#include <shared_mutex>
+#include <stdexcept>
+#include <system_error>
+#include <type_traits>
+#include <typeindex>
+#include <typeinfo>
+#include <utility>
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-5_a.H b/gcc/testsuite/g++.dg/modules/xtreme-header-5_a.H
new file mode 100644 (file)
index 0000000..a03c024
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options -fmodule-header }
+
+// { dg-module-cmi {} }
+#include "xtreme-header-5.h"
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-5_b.C b/gcc/testsuite/g++.dg/modules/xtreme-header-5_b.C
new file mode 100644 (file)
index 0000000..8cf7d68
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+#include "xtreme-header-5.h"
+import "xtreme-header-5_a.H";
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-5_c.C b/gcc/testsuite/g++.dg/modules/xtreme-header-5_c.C
new file mode 100644 (file)
index 0000000..c1ddb4c
--- /dev/null
@@ -0,0 +1,3 @@
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+import "xtreme-header-5_a.H";
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-6.h b/gcc/testsuite/g++.dg/modules/xtreme-header-6.h
new file mode 100644 (file)
index 0000000..85894b2
--- /dev/null
@@ -0,0 +1,22 @@
+// C++20 headers
+#if __cplusplus > 201703
+#include <version>
+#include <bit>
+#include <compare>
+#include <concepts>
+#if __cpp_coroutines
+#include <coroutine>
+#endif
+#include <numbers>
+#include <span>
+#include <stop_token>
+#if 0
+// Unimplemented
+#include <barrier>
+#include <format>
+#include <latch>
+#include <semaphore>
+#include <source_location>
+#include <syncstream>
+#endif
+#endif
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-6_a.H b/gcc/testsuite/g++.dg/modules/xtreme-header-6_a.H
new file mode 100644 (file)
index 0000000..aec5a03
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options -fmodule-header }
+
+// { dg-module-cmi {} }
+#include "xtreme-header-6.h"
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-6_b.C b/gcc/testsuite/g++.dg/modules/xtreme-header-6_b.C
new file mode 100644 (file)
index 0000000..0d2cc69
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+#include "xtreme-header-6.h"
+import "xtreme-header-6_a.H";
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-6_c.C b/gcc/testsuite/g++.dg/modules/xtreme-header-6_c.C
new file mode 100644 (file)
index 0000000..2962a25
--- /dev/null
@@ -0,0 +1,3 @@
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+import "xtreme-header-6_a.H";
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header.h b/gcc/testsuite/g++.dg/modules/xtreme-header.h
new file mode 100644 (file)
index 0000000..41302c7
--- /dev/null
@@ -0,0 +1,144 @@
+// All the headers!
+
+#if __cplusplus > 201703L
+// FIXME: if we include everything, something goes wrong with location
+// information.  We used to not handle lambdas attached to global
+// vars, and this is a convienient flag to stop including everything.
+#define NO_ASSOCIATED_LAMBDA 1
+#endif
+
+// C++ 17 and below
+#if 1
+#if !NO_ASSOCIATED_LAMBDA
+#include <algorithm>
+#endif
+#include <any>
+#include <array>
+#include <atomic>
+#include <bitset>
+#include <charconv>
+#include <chrono>
+#include <complex>
+#include <condition_variable>
+#include <cctype>
+#include <cuchar>
+#include <cwchar>
+#include <cwctype>
+#include <deque>
+#include <exception>
+#if !NO_ASSOCIATED_LAMBDA
+// FIXME: PR 97549
+//#include <execution>
+#endif
+#include <filesystem>
+#include <forward_list>
+#include <fstream>
+#if !NO_ASSOCIATED_LAMBDA
+#include <functional>
+#endif
+#if !NO_ASSOCIATED_LAMBDA
+#include <future>
+#endif
+#include <initializer_list>
+#include <iomanip>
+#include <ios>
+#include <iosfwd>
+#include <istream>
+#include <iterator>
+#include <limits>
+#include <list>
+#include <locale>
+#include <map>
+#if !NO_ASSOCIATED_LAMBDA
+#include <memory>
+#endif
+#if !NO_ASSOCIATED_LAMBDA
+#include <memory_resource>
+#endif
+#include <mutex>
+#include <new>
+#include <numeric>
+#include <optional>
+#include <ostream>
+#include <queue>
+#include <random>
+#include <ratio>
+#if !NO_ASSOCIATED_LAMBDA
+#include <regex>
+#endif
+#if !NO_ASSOCIATED_LAMBDA
+#include <scoped_allocator>
+#endif
+#include <set>
+#include <shared_mutex>
+#include <sstream>
+#include <stack>
+#include <stdexcept>
+#include <streambuf>
+#include <string>
+#include <string_view>
+#include <system_error>
+#if !NO_ASSOCIATED_LAMBDA
+#include <thread>
+#endif
+#include <tuple>
+#include <type_traits>
+#include <typeindex>
+#include <typeinfo>
+#include <unordered_map>
+#include <unordered_set>
+#include <utility>
+#if !NO_ASSOCIATED_LAMBDA
+#include <valarray>
+#endif
+#include <variant>
+#include <vector>
+#endif
+
+// C compatibility
+#if 1
+#include <cassert>
+#include <cerrno>
+#include <cfenv>
+#include <cfloat>
+#include <cinttypes>
+#include <climits>
+#include <clocale>
+#include <cmath>
+#include <csetjmp>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+#endif
+
+// C++20
+#if __cplusplus > 201703
+#if 1
+#include <version>
+#include <bit>
+#include <compare>
+#include <concepts>
+#if __cpp_coroutines
+#include <coroutine>
+#endif
+#if !NO_ASSOCIATED_LAMBDA
+#include <ranges>
+#endif
+#include <numbers>
+#include <span>
+#include <stop_token>
+#if 0
+// Unimplemented
+#include <barrier>
+#include <format>
+#include <latch>
+#include <semaphore>
+#include <source_location>
+#include <syncstream>
+#endif
+#endif
+#endif
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header_a.H b/gcc/testsuite/g++.dg/modules/xtreme-header_a.H
new file mode 100644 (file)
index 0000000..bf7859f
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options -fmodule-header }
+
+// { dg-module-cmi {} }
+#include "xtreme-header.h"
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header_b.C b/gcc/testsuite/g++.dg/modules/xtreme-header_b.C
new file mode 100644 (file)
index 0000000..2e736da
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+#include "xtreme-header.h"
+import "xtreme-header_a.H";
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-tr1.h b/gcc/testsuite/g++.dg/modules/xtreme-tr1.h
new file mode 100644 (file)
index 0000000..8fe1399
--- /dev/null
@@ -0,0 +1,11 @@
+#include <tr1/functional>
+#include <tr1/array>
+#include <tr1/complex>
+#include <tr1/memory>
+#include <tr1/random>
+#include <tr1/regex>
+#include <tr1/tuple>
+#include <tr1/type_traits>
+#include <tr1/unordered_map>
+#include <tr1/unordered_set>
+#include <tr1/utility>
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-tr1_a.H b/gcc/testsuite/g++.dg/modules/xtreme-tr1_a.H
new file mode 100644 (file)
index 0000000..bed70a6
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options -fmodule-header }
+
+// { dg-module-cmi {} }
+#include "xtreme-tr1.h"
diff --git a/gcc/testsuite/g++.dg/modules/xtreme-tr1_b.C b/gcc/testsuite/g++.dg/modules/xtreme-tr1_b.C
new file mode 100644 (file)
index 0000000..9bb1dc2
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+#include "xtreme-tr1.h"
+import "xtreme-tr1_a.H";