c++: Modules Is Landing
This is the C++ modules implementation. Dropping in the real module.cc file into the module-shaped hole I carved out. I include some sanity tests for now. I'll commit the remaining tests when the initial round of failures seems abated. gcc/cp/ * module.cc: Replace stubs with implementation. gcc/testsuite/ * g++.dg/modules/mod-decl-0-2a.C: New. * g++.dg/modules/mod-decl-0.C: New. * g++.dg/modules/mod-decl-1.C: New. * g++.dg/modules/mod-decl-2_a.C: New. * g++.dg/modules/mod-decl-2_b.C: New. * g++.dg/modules/mod-decl-2_c.C: New. * g++.dg/modules/mod-decl-3.C: New. * g++.dg/modules/mod-decl-5_a.C: New. * g++.dg/modules/mod-decl-5_b.C: New.
This commit is contained in:
parent
b7dfc2074c
commit
4efde6781b
10 changed files with 19855 additions and 79 deletions
19826
gcc/cp/module.cc
19826
gcc/cp/module.cc
File diff suppressed because it is too large
Load diff
6
gcc/testsuite/g++.dg/modules/mod-decl-0-2a.C
Normal file
6
gcc/testsuite/g++.dg/modules/mod-decl-0-2a.C
Normal file
|
@ -0,0 +1,6 @@
|
|||
// { dg-options "-fno-modules -std=c++2a" }
|
||||
|
||||
export // { dg-message "enabled with" }
|
||||
module nope; // { dg-error "not name a type" }
|
||||
// { dg-message "only available with .-fmodules." "" { target *-*-* } .-1 }
|
||||
// { dg-module-cmi "!nope" }
|
6
gcc/testsuite/g++.dg/modules/mod-decl-0.C
Normal file
6
gcc/testsuite/g++.dg/modules/mod-decl-0.C
Normal file
|
@ -0,0 +1,6 @@
|
|||
// { dg-options "-fno-modules -std=c++17" }
|
||||
|
||||
export // { dg-message "ignored" }
|
||||
module nope; // { dg-error "not name a type" }
|
||||
// { dg-message "only available with .-fmodules." "" { target *-*-* } .-1 }
|
||||
// { dg-module-cmi "!nope" }
|
29
gcc/testsuite/g++.dg/modules/mod-decl-1.C
Normal file
29
gcc/testsuite/g++.dg/modules/mod-decl-1.C
Normal file
|
@ -0,0 +1,29 @@
|
|||
// { dg-additional-options "-fmodules-ts" }
|
||||
module;
|
||||
|
||||
export module frist;
|
||||
// { dg-module-cmi "!frist" }
|
||||
|
||||
import frist; // { dg-error {cannot import module.* in its own purview} }
|
||||
|
||||
module foo.second; // { dg-error "not permitted here" }
|
||||
|
||||
namespace Foo
|
||||
{
|
||||
module third; // { dg-error "not permitted here" }
|
||||
}
|
||||
|
||||
struct Baz
|
||||
{
|
||||
module forth; // { dg-error "expected" }
|
||||
};
|
||||
|
||||
void Bink ()
|
||||
{
|
||||
module fifth; // { dg-error "expected" }
|
||||
}
|
||||
|
||||
module a.; // { dg-error "not permitted" }
|
||||
|
||||
// { dg-prune-output "not writing module" }
|
||||
|
8
gcc/testsuite/g++.dg/modules/mod-decl-2_a.C
Normal file
8
gcc/testsuite/g++.dg/modules/mod-decl-2_a.C
Normal file
|
@ -0,0 +1,8 @@
|
|||
// { dg-additional-options "-fmodules-ts" }
|
||||
export module bob;
|
||||
// { dg-module-cmi "bob" }
|
||||
export void Foo ();
|
||||
export
|
||||
{
|
||||
void Bar ();
|
||||
}
|
11
gcc/testsuite/g++.dg/modules/mod-decl-2_b.C
Normal file
11
gcc/testsuite/g++.dg/modules/mod-decl-2_b.C
Normal file
|
@ -0,0 +1,11 @@
|
|||
// { dg-additional-options "-fmodules-ts" }
|
||||
module bob;
|
||||
|
||||
import bob; // { dg-error "cannot import module.* in its own purview" }
|
||||
|
||||
// module linkage
|
||||
void Baz ()
|
||||
{
|
||||
Foo ();
|
||||
Bar ();
|
||||
}
|
8
gcc/testsuite/g++.dg/modules/mod-decl-2_c.C
Normal file
8
gcc/testsuite/g++.dg/modules/mod-decl-2_c.C
Normal file
|
@ -0,0 +1,8 @@
|
|||
// { dg-additional-options "-fmodules-ts" }
|
||||
import bob;
|
||||
|
||||
void Baz ()
|
||||
{
|
||||
Foo ();
|
||||
Bar ();
|
||||
}
|
26
gcc/testsuite/g++.dg/modules/mod-decl-3.C
Normal file
26
gcc/testsuite/g++.dg/modules/mod-decl-3.C
Normal file
|
@ -0,0 +1,26 @@
|
|||
// { dg-additional-options "-fmodules-ts -Wno-pedantic" }
|
||||
module;
|
||||
# 4 "mod-decl-3.C" 1
|
||||
export void Foo (); // { dg-error "after a module interface" }
|
||||
|
||||
# 7 "" 2
|
||||
export module bob;
|
||||
// { dg-module-cmi "!bob" }
|
||||
|
||||
export
|
||||
export // { dg-error "occur once" }
|
||||
void Baz ();
|
||||
|
||||
export
|
||||
{
|
||||
export // { dg-error "occur once" }
|
||||
void Bar ();
|
||||
}
|
||||
|
||||
namespace Bink
|
||||
{
|
||||
import // { dg-error "does not name" }
|
||||
ben;
|
||||
}
|
||||
|
||||
// { dg-prune-output "not writing module" }
|
3
gcc/testsuite/g++.dg/modules/mod-decl-5_a.C
Normal file
3
gcc/testsuite/g++.dg/modules/mod-decl-5_a.C
Normal file
|
@ -0,0 +1,3 @@
|
|||
// { dg-additional-options "-fmodules-ts" }
|
||||
export module thing.baz;
|
||||
// { dg-module-cmi "thing.baz" }
|
11
gcc/testsuite/g++.dg/modules/mod-decl-5_b.C
Normal file
11
gcc/testsuite/g++.dg/modules/mod-decl-5_b.C
Normal file
|
@ -0,0 +1,11 @@
|
|||
// { dg-additional-options "-fmodules-ts -Wno-pedantic" }
|
||||
module;
|
||||
# 4 "gmf" 1
|
||||
import thing.baz;
|
||||
|
||||
export int foo (); // { dg-error "after a module interface" }
|
||||
# 8 "" 2
|
||||
export module thing.baz; // { dg-error "module already imported" }
|
||||
|
||||
import thing.baz;
|
||||
|
Loading…
Add table
Reference in a new issue