Skip to content

Commit 862fe4b

Browse files
Dawn Perchikzygoloid
authored andcommitted
P1857R3 Modules Dependency Discovery
Also fixes NB US 026, US 121, US 125, GB 126, US 127, US 128, US 136, US 137, US 138, US 139, and US 140 (C++20 CD). [diff.cpp17.basic] Changed "m1" to "m2" in example. [module.global.frag] Updated reference from [cpp.global.frag] to [cpp.pre]. [basic.link] Note: paragraph 3 (removed here) was modified by P1779R3 (CWG Poll 2). [cpp.import] Replace non-existent import-directive with the intended pp-import. Placed Annex C entry in [diff.cpp17.lex].
1 parent 39dd1d4 commit 862fe4b

5 files changed

Lines changed: 195 additions & 104 deletions

File tree

‎source/basic.tex‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2607,12 +2607,6 @@
26072607
\opt{global-module-fragment} module-declaration \opt{declaration-seq} \opt{private-module-fragment}
26082608
\end{bnf}
26092609

2610-
\pnum
2611-
A token sequence beginning with
2612-
\opt{\tcode{export}} \tcode{module}
2613-
and not immediately followed by \tcode{::}
2614-
is never interpreted as a \grammarterm{declaration}.
2615-
26162610
\pnum
26172611
\indextext{linkage}%
26182612
\indextext{translation unit}%

‎source/compatibility.tex‎

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,6 +1934,28 @@
19341934

19351935
\rSec2[diff.cpp17.lex]{\ref{lex}: lexical conventions}
19361936

1937+
\diffref{lex.pptoken,module.unit,module.import,cpp.pre,cpp.module,cpp.import}
1938+
\change
1939+
New identifiers with special meaning.
1940+
\rationale
1941+
Required for new features.
1942+
\effect
1943+
Logical lines beginning with
1944+
\tcode{module} or \tcode{import} may
1945+
be interpreted differently
1946+
in this International Standard.
1947+
\begin{example}
1948+
\begin{codeblock}
1949+
class module {};
1950+
module m1; // was variable declaration; now \grammarterm{module-declaration}
1951+
module *m2; // OK
1952+
1953+
class import {};
1954+
import j1; // was variable declaration; now \grammarterm{import-declaration}
1955+
::import j2; // variable declaration
1956+
\end{codeblock}
1957+
\end{example}
1958+
19371959
\diffref{lex.header}
19381960
\change
19391961
\grammarterm{header-name} tokens are formed in more contexts.
@@ -2038,28 +2060,6 @@
20382060

20392061
\rSec2[diff.cpp17.basic]{\ref{basic}: basics}
20402062

2041-
\diffref{basic.link,module.unit,module.import}
2042-
\change
2043-
New identifiers with special meaning.
2044-
\rationale
2045-
Required for new features.
2046-
\effect
2047-
Top-level declarations beginning with
2048-
\tcode{module} or \tcode{import} may
2049-
be either ill-formed or interpreted differently
2050-
in this International Standard.
2051-
\begin{example}
2052-
\begin{codeblock}
2053-
class module;
2054-
module *m1; // ill-formed; previously well-formed
2055-
::module *m2; // OK
2056-
2057-
class import {};
2058-
import j1; // was variable declaration; now \grammarterm{import-declaration}
2059-
::import j2; // variable declaration
2060-
\end{codeblock}
2061-
\end{example}
2062-
20632063
\diffref{intro.races}
20642064
\change
20652065
Except for the initial release operation,

‎source/lex.tex‎

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,8 @@
297297
\nontermdef{preprocessing-token}\br
298298
header-name\br
299299
import-keyword\br
300+
module-keyword\br
301+
export-keyword\br
300302
identifier\br
301303
pp-number\br
302304
character-literal\br
@@ -382,8 +384,14 @@
382384

383385
\pnum
384386
The \grammarterm{import-keyword} is produced
385-
by processing an \tcode{import} directive\iref{cpp.import} and
386-
has no associated grammar productions.
387+
by processing an \tcode{import} directive\iref{cpp.import},
388+
the \grammarterm{module-keyword} is produced
389+
by preprocessing a \tcode{module} directive\iref{cpp.module}, and
390+
the \grammarterm{export-keyword} is produced
391+
by preprocessing either of the previous two directives.
392+
\begin{note}
393+
None have any observable spelling.
394+
\end{note}
387395

388396
\pnum
389397
\begin{example}
@@ -790,26 +798,29 @@
790798
\keyword{enum} \\
791799
\keyword{explicit} \\
792800
\keyword{export} \\
793-
\keyword{extern} \\
801+
\grammarterm{export-keyword} \\
794802
\columnbreak
803+
\keyword{extern} \\
795804
\keyword{false} \\
796805
\keyword{float} \\
797806
\keyword{for} \\
798807
\keyword{friend} \\
799808
\keyword{goto} \\
800809
\keyword{if} \\
810+
\grammarterm{import-keyword} \\
801811
\keyword{inline} \\
802812
\keyword{int} \\
803813
\keyword{long} \\
814+
\grammarterm{module-keyword} \\
804815
\keyword{mutable} \\
805816
\keyword{namespace} \\
806817
\keyword{new} \\
807818
\keyword{noexcept} \\
808819
\keyword{nullptr} \\
820+
\columnbreak
809821
\keyword{operator} \\
810822
\keyword{private} \\
811823
\keyword{protected} \\
812-
\columnbreak
813824
\keyword{public} \\
814825
\keyword{register} \\
815826
\keyword{reinterpret_cast} \\
@@ -824,10 +835,10 @@
824835
\keyword{struct} \\
825836
\keyword{switch} \\
826837
\keyword{template} \\
838+
\columnbreak
827839
\keyword{this} \\
828840
\keyword{thread_local} \\
829841
\keyword{throw} \\
830-
\columnbreak
831842
\keyword{true} \\
832843
\keyword{try} \\
833844
\keyword{typedef} \\

‎source/modules.tex‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
\begin{bnf}
99
\nontermdef{module-declaration}\br
10-
\opt{\keyword{export}} \keyword{module} module-name \opt{module-partition} \opt{attribute-specifier-seq} \terminal{;}
10+
\opt{export-keyword} module-keyword module-name \opt{module-partition} \opt{attribute-specifier-seq} \terminal{;}
1111
\end{bnf}
1212

1313
\begin{bnf}
@@ -409,9 +409,9 @@
409409

410410
\begin{bnf}
411411
\nontermdef{module-import-declaration}\br
412-
\opt{\keyword{export}} import-keyword module-name \opt{attribute-specifier-seq} \terminal{;}\br
413-
\opt{\keyword{export}} import-keyword module-partition \opt{attribute-specifier-seq} \terminal{;}\br
414-
\opt{\keyword{export}} import-keyword header-name \opt{attribute-specifier-seq} \terminal{;}
412+
\opt{export-keyword} import-keyword module-name \opt{attribute-specifier-seq} \terminal{;}\br
413+
\opt{export-keyword} import-keyword module-partition \opt{attribute-specifier-seq} \terminal{;}\br
414+
\opt{export-keyword} import-keyword header-name \opt{attribute-specifier-seq} \terminal{;}
415415
\end{bnf}
416416

417417
\pnum
@@ -558,14 +558,14 @@
558558

559559
\begin{bnf}
560560
\nontermdef{global-module-fragment}\br
561-
\keyword{module} \terminal{;} \opt{declaration-seq}
561+
module-keyword \terminal{;} \opt{declaration-seq}
562562
\end{bnf}
563563

564564
\pnum
565565
\begin{note}
566566
Prior to phase 4 of translation,
567567
only preprocessing directives can appear
568-
in the \grammarterm{declaration-seq}\iref{cpp.global.frag}.
568+
in the \grammarterm{declaration-seq}\iref{cpp.pre}.
569569
\end{note}
570570

571571
\pnum
@@ -765,7 +765,7 @@
765765

766766
\begin{bnf}
767767
\nontermdef{private-module-fragment}\br
768-
\keyword{module} \terminal{:} \keyword{private} \terminal{;} \opt{declaration-seq}
768+
module-keyword \terminal{:} \keyword{private} \terminal{;} \opt{declaration-seq}
769769
\end{bnf}
770770

771771
\pnum

0 commit comments

Comments
 (0)