diff options
Diffstat (limited to 'gcc/doc/invoke.texi')
-rw-r--r-- | gcc/doc/invoke.texi | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index e5a5d1d9335..ca2591ce2c3 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -37764,6 +37764,23 @@ installed. Specifying the language as one of these variants also inhibits output of the object file, as header files have no associated object file. +Header units can be used in much the same way as precompiled headers +(@pxref{Precompiled Headers}), but with fewer restrictions: an +#include that is translated to a header unit import can appear at any +point in the source file, and multiple header units can be used +together. In particular, the @option{-include} strategy works: with +the bits/stdc++.h header used for libstdc++ precompiled headers you +can + +@smallexample +g++ -fmodules-ts -x c++-system-header -c bits/stdc++.h +g++ -fmodules-ts -include bits/stdc++.h mycode.C +@end smallexample + +and any standard library #includes in mycode.C will be skipped, +because the import brought in the whole library. This can be a simple +way to use modules to speed up compilation without any code changes. + The @option{-fmodule-only} option disables generation of the associated object file for compiling a module interface. Only the CMI is generated. This option is implied when using the |