From 41676a36a04d5ef86012195d84830df191ee6790 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Tue, 1 Dec 2020 11:44:34 -0800 Subject: C++ Module keywords This adds the module keywords. These are special internal tokens generated by the preprocessor's module-control-line token peeking logic. Spelling them with a space means that they turn back into regular tokens in preprocessor output (but do skew the column numbering :() gcc/c-family/ * c-common.c (module, import, export): New internal tokens (with trailing space). * c-common.h (RID__MODULE, RID__IMPORT & RID__EXPORT): Enumerate them. (D_CXX_MODULES, D_CXX_MODULES_FLAGS): Enable them. * c-cppbuiltin.c (c_cpp_builtins): Feature macro. gcc/cp/ * lex.c (init_reswords): Maybe enable module keywords. --- gcc/c-family/c-common.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gcc/c-family/c-common.c') diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 5d1e4ef..cae883b 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -540,6 +540,12 @@ const struct c_common_resword c_common_reswords[] = { "concept", RID_CONCEPT, D_CXX_CONCEPTS_FLAGS | D_CXXWARN }, { "requires", RID_REQUIRES, D_CXX_CONCEPTS_FLAGS | D_CXXWARN }, + /* Modules-related keywords, these are internal unspellable tokens, + created by the preprocessor. */ + { "module ", RID__MODULE, D_CXX_MODULES_FLAGS | D_CXXWARN }, + { "import ", RID__IMPORT, D_CXX_MODULES_FLAGS | D_CXXWARN }, + { "export ", RID__EXPORT, D_CXX_MODULES_FLAGS | D_CXXWARN }, + /* Coroutines-related keywords */ { "co_await", RID_CO_AWAIT, D_CXX_COROUTINES_FLAGS | D_CXXWARN }, { "co_yield", RID_CO_YIELD, D_CXX_COROUTINES_FLAGS | D_CXXWARN }, -- cgit v1.1