gcc/libcpp
Nathan Sidwell c9c3d5f28a preprocessor: C++ module-directives
C++20 modules introduces a new kind of preprocessor directive -- a
module directive.  These are directives but without the leading '#'.
We have to detect them by sniffing the start of a logical line.  When
detected we replace the initial identifiers with unspellable tokens
and pass them through to the language parser the same way deferred
pragmas are.  There's a PRAGMA_EOL at the logical end of line too.

One additional complication is that we have to do header-name lexing
after the initial tokens, and that requires changes in the macro-aware
piece of the preprocessor.  The above sniffer sets a counter in the
lexer state, and that triggers at the appropriate point.  We then do
the same header-name lexing that occurs on a #include directive or
has_include pseudo-macro.  Except that the header name ends up in the
token stream.

A couple of token emitters need to deal with the new token possibility.

	gcc/c-family/
	* c-lex.c (c_lex_with_flags): CPP_HEADER_NAMEs can now be seen.
	libcpp/
	* include/cpplib.h (struct cpp_options): Add module_directives
	option.
	(NODE_MODULE): New node flag.
	(struct cpp_hashnode): Make rid-code a bitfield, increase bits in
	flags and swap with type field.
	* init.c (post_options): Create module-directive identifier nodes.
	* internal.h (struct lexer_state): Add directive_file_token &
	n_modules fields.  Add module node enumerator.
	* lex.c (cpp_maybe_module_directive): New.
	(_cpp_lex_token): Call it.
	(cpp_output_token): Add '"' around CPP_HEADER_NAME token.
	(do_peek_ident, do_peek_module): New.
	(cpp_directives_only): Detect module-directive lines.
	* macro.c (cpp_get_token_1): Deal with directive_file_token
	triggering.
2020-11-18 10:24:12 -08:00
..
include preprocessor: C++ module-directives 2020-11-18 10:24:12 -08:00
po Daily bump. 2020-07-21 00:16:28 +00:00
ChangeLog Daily bump. 2020-11-18 00:16:34 +00:00
ChangeLog.jit Merger of dmalcolm/jit branch from git 2014-11-11 21:55:52 +00:00
Makefile.in libcpp, libdecnumber: configure and substitute AR 2020-05-23 21:59:02 +00:00
aclocal.m4 libcpp: Enable Intel CET on Intel CET enabled host for jit 2020-05-12 09:17:45 -07:00
charset.c diagnostics: Support conversion of tabs to spaces [PR49973] [PR86904] 2020-07-14 12:05:56 -04:00
config.in Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
configure Require CET support only for the final GCC build 2020-07-30 05:36:24 -07:00
configure.ac libcpp, libdecnumber: configure and substitute AR 2020-05-23 21:59:02 +00:00
directives.c Do not warn about unused macros while processing #pragma GCC optimize 2020-11-13 12:28:33 -05:00
errors.c Update copyright years. 2020-01-01 12:51:42 +01:00
expr.c c: C2x binary constants 2020-11-13 22:45:22 +00:00
files.c preprocessor: Add support for header unit translation 2020-11-18 08:45:46 -08:00
generated_cpp_wcwidth.h libcpp: Update cpp_wcwidth() to Unicode 13.0.0 2020-11-07 09:36:43 -05:00
identifiers.c [PR 80005] Fix __has_include 2020-01-20 05:39:59 -08:00
init.c preprocessor: C++ module-directives 2020-11-18 10:24:12 -08:00
internal.h preprocessor: C++ module-directives 2020-11-18 10:24:12 -08:00
lex.c preprocessor: C++ module-directives 2020-11-18 10:24:12 -08:00
line-map.c preprocessor: module line maps 2020-11-17 08:10:56 -08:00
location-example.txt PR preprocessor/83173: Enhance -fdump-internal-locations output 2018-11-27 16:04:31 +00:00
macro.c preprocessor: C++ module-directives 2020-11-18 10:24:12 -08:00
makeucnid.c Update copyright years. 2020-01-01 12:51:42 +01:00
mkdeps.c preprocessor: Update mkdeps for modules 2020-11-18 08:44:49 -08:00
pch.c preprocessor: Make __has_include a builtin macro [PR93452] 2020-01-28 08:02:17 -08:00
symtab.c Update copyright years. 2020-01-01 12:51:42 +01:00
system.h preprocessor: Random cleanups 2020-05-19 13:23:47 -07:00
traditional.c c: C2x __has_c_attribute 2020-11-12 21:13:51 +00:00
ucnid.h Update copyright years. 2020-01-01 12:51:42 +01:00
ucnid.tab Update copyright years. 2020-01-01 12:51:42 +01:00