aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-12-01 10:28:15 -0800
committerNathan Sidwell <nathan@acm.org>2020-12-01 10:32:50 -0800
commit10ee6da64c574947e67205fa0c4d6a76bf83479b (patch)
tree7d5a63d8866b9a86e8b0dacb9877ba44d980b787 /gcc/c-family
parent855bb43f6d0bee5a74b5d3739456ca34b4609a50 (diff)
downloadgcc-10ee6da64c574947e67205fa0c4d6a76bf83479b.zip
gcc-10ee6da64c574947e67205fa0c4d6a76bf83479b.tar.gz
gcc-10ee6da64c574947e67205fa0c4d6a76bf83479b.tar.bz2
C++ Module options
This adds the C++ module options, and wires them into lang-specs. The options are not connected to any machinery. The options! They do nothing! gcc/c-family/ * c-opts.c (c_common_init_options): Ask for module dependencies. (c_common_handle_option): Handle -Mmodules -Mno-modules. * c-pch.c (c_common_valid_pch): ... does not play with C++ modules. * c.opt (Mmodules, Mno-modules): New preprocessor dependency options. (fmodules-ts, fmodule-header, fmodule-implicit-inline) (fmodule-only, fmodule-mapper, fmodule-lazy) (fmodule-version-ignore, Winvalid-imported-macros) (flang-info-include-translate, flang-info-include-translate-not): New options gcc/cp/ * lang-specs.h: Add module-related options.
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/c-opts.c13
-rw-r--r--gcc/c-family/c-pch.c4
-rw-r--r--gcc/c-family/c.opt59
3 files changed, 76 insertions, 0 deletions
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 77844d7..59cabd1 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -234,6 +234,7 @@ c_common_init_options (unsigned int decoded_options_count,
cpp_opts = cpp_get_options (parse_in);
cpp_opts->dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
cpp_opts->objc = c_dialect_objc ();
+ cpp_opts->deps.modules = true;
/* Reset to avoid warnings on internal definitions. We set it just
before passing on command-line options to cpplib. */
@@ -367,6 +368,18 @@ c_common_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
cpp_opts->deps.phony_targets = true;
break;
+ case OPT_Mmodules:
+ /* Do not set deps_seen, so the user can unconditionally turn
+ this on or off. */
+ cpp_opts->deps.modules = true;
+ break;
+
+ case OPT_Mno_modules:
+ /* Do not set deps_seen, so the user can unconditionally turn
+ this on or off. */
+ cpp_opts->deps.modules = false;
+ break;
+
case OPT_MQ:
case OPT_MT:
deps_seen = true;
diff --git a/gcc/c-family/c-pch.c b/gcc/c-family/c-pch.c
index 9c0bd0b..fdeb860 100644
--- a/gcc/c-family/c-pch.c
+++ b/gcc/c-family/c-pch.c
@@ -206,6 +206,10 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd)
/* Perform a quick test of whether this is a valid
precompiled header for the current language. */
+ /* C++ modules and PCH don't play together. */
+ if (flag_modules)
+ return 2;
+
sizeread = read (fd, ident, IDENT_LENGTH + 16);
if (sizeread == -1)
fatal_error (input_location, "cannot read %s: %m", name);
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 0532cb7..059f6c3 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -236,6 +236,14 @@ MMD
C ObjC C++ ObjC++ NoDriverArg Separate MissingArgError(missing filename after %qs)
Like -MD but ignore system header files.
+Mmodules
+C++
+Generate C++ Module dependency information.
+
+Mno-modules
+C++
+; undocumented
+
MP
C ObjC C++ ObjC++
Generate phony targets for all headers.
@@ -1683,6 +1691,57 @@ flax-vector-conversions
C ObjC C++ ObjC++ Var(flag_lax_vector_conversions)
Allow implicit conversions between vectors with differing numbers of subparts and/or differing element types.
+fmodules-ts
+C++ ObjC++ Var(flag_modules) Integer Init(0)
+Enable C++ modules-ts (experimental).
+
+fno-modules
+C++ ObjC++ Undocumented RejectNegative Var(flag_modules,0) Integer
+;; undocumented
+
+fmodule-header
+C++ ObjC RejectNegative Var(flag_header_unit,0) Integer
+Enable C++ header module (experimental).
+
+fmodule-header=
+C++ ObjC++ Joined RejectNegative Undocumented
+
+fmodule-implicit-inline
+C++ ObjC++ Var(flag_module_implicit_inline,0) Integer
+Member functions defined within their class are inline in module purview.
+
+fmodule-only
+C++ ObjC RejectNegative Var(flag_module_only) Integer
+Only emit Compiled Module Interface.
+
+fmodule-mapper=
+C++ ObjC++ Joined RejectNegative MissingArgError(missing mapper)
+Mapper for module to CMI files.
+
+fmodule-lazy
+C++ ObjC++ Var(flag_module_lazy) Init(1)
+Enable lazy module importing.
+
+fmodule-version-ignore
+C++ ObjC Var(flag_module_version_ignore) Integer
+; undocumented, Very dangerous, but occasionally useful
+
+Winvalid-imported-macros
+C++ ObjC++ Var(warn_imported_macros)
+Warn about macros that have conflicting header units definitions.
+
+flang-info-include-translate
+C++ Var(note_include_translate_yes)
+Note #include directives translated to import declarations.
+
+flang-info-include-translate-not
+C++ Var(note_include_translate_no)
+Note #include directives not translated to import declarations, and not known to be textual.
+
+flang-info-include-translate=
+C++ Joined RejectNegative MissingArgError(missing header name)
+Note a #include translation of a specific header.
+
fmax-include-depth=
C ObjC C++ ObjC++ Joined RejectNegative UInteger
fmax-include-depth=<number> Set the maximum depth of the nested #include.