Index: gcc/c-family/c-opts.c diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index e52583e..8fe566e 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -368,13 +368,11 @@ c_common_handle_option (size_t scode, const char *arg, int value, break; case OPT__output_pch_: - { - char *dot = strrchr (arg, '.'); - if (dot != NULL && strcmp (dot, ".pph") == 0) - pph_out_file = arg; - else - pch_file = arg; - } + pch_file = arg; + break; + + case OPT__output_pph_: + pph_out_file = arg; break; case OPT_A: Index: gcc/c-family/c.opt diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 67708b8..bdc0fc9 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -139,6 +139,9 @@ C ObjC C++ ObjC++ Joined Alias(o) -output-pch= C ObjC C++ ObjC++ Joined Separate +-output-pph= +C++ Joined Separate + -pedantic C ObjC C++ ObjC++ Alias(pedantic) @@ -933,8 +936,12 @@ fpph-dump-tree C++ Var(flag_pph_dump_tree) -fpph-dump-tree Dump global namespace tree around PPH reads/writes. +fpph-gen +C++ +-fpph-gen Generate a PPH image from the input file + fpph-hdr= -C++ ObjC++ Joined MissingArgError(missing filename after %qs) +C++ Joined MissingArgError(missing filename after %qs) -fpph-hdr= A mapping from .h to .pph fpph-logfile= @@ -942,7 +949,7 @@ C++ Joined RejectNegative Var(flag_pph_logfile) -fpph-logfile= Emit PPH debug information to fpph-map= -C++ ObjC++ Joined MissingArgError(missing filename after %qs) +C++ Joined MissingArgError(missing filename after %qs) -fpph-map= A file of mappings from #include to PPH file fpph-tracer= Index: gcc/cp/lang-specs.h diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h index a73aba3..ef03a39 100644 --- a/gcc/cp/lang-specs.h +++ b/gcc/cp/lang-specs.h @@ -48,8 +48,9 @@ along with GCC; see the file COPYING3. If not see cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\ %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\ %(cc1_options) %2\ - %{!fsyntax-only:%{!fdump-ada-spec*:-o %g.s %{!o*:--output-pch=%i.gch}\ - %W{o*:--output-pch=%*}}%V}}}}", + %{!fpph-gen:%{!fsyntax-only:%{!fdump-ada-spec*:-o %g.s %{!o*:--output-pch=%i.gch}\ + %W{o*:--output-pch=%*}}}} \ + %{fpph-gen:%{!o*:--output-pph=%b.pph}%W{o*:--output-pph=%*}}%V}}}", CPLUSPLUS_CPP_SPEC, 0, 0}, {"@c++", "%{E|M|MM:cc1plus -E %(cpp_options) %2 %(cpp_debug_options)}\ Index: gcc/doc/invoke.texi diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 6207800..524471a 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -195,6 +195,7 @@ in the following sections. -fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol -fno-default-inline -fvisibility-inlines-hidden @gol -fvisibility-ms-compat @gol +-fpph-hdr -fpph-map -fpph-gen @gol -Wabi -Wconversion-null -Wctor-dtor-privacy @gol -Wnoexcept -Wnon-virtual-dtor -Wreorder @gol -Weffc++ -Wstrict-null-sentinel @gol @@ -2171,6 +2172,42 @@ option exists only for testing, and should not be used by end-users; it will result in inferior code and has no benefits. This option may be removed in a future release of G++. +@item -fpph-gen +@opindex fpph-gen +Generate a Pre-Parsed Header (PPH) file instead of a PCH file. This option +is only valid when compiling header files separately. Instead of generating +a PCH files, G++ will save the parsed declarations in a header file to +a PPH file. By default, the PPH image for a header file named @file{foo.h} +is @file{foo.pph}. + +NOTE: This option is temporary. It is only meant to serve the initial +implementation of this feature. The final user interface will likely +use a different mechanism for PPH. + +@item -fpph-map=@var{file.map} +@opindex fpph-map +Use PPH mapping file @file{file.map} to determine what headers should be +processed from their PPH images. This file contains a list of file name +pairs in the form ``@var{file.h} @var{file.pph}''. When the pre-processor +finds the directive @code{#include "file.h"}, and there exists a mapping +between @var{file.h} and @var{file.pph} in @file{file.map}, then the +compiler will instantiate the PPH image @var{file.pph}. The text +in @var{file.h} will be ignored. + +NOTE: This option is temporary. It is only meant to serve the initial +implementation of this feature. The final user interface will likely +use a different mechanism for PPH. + +@item -fpph-hdr=@var{file.h} +@opindex fpph-hdr +This is a short-hand notation to map a single header @file{file.h} to +its image @file{file.pph}. Multiple occurrences of this flag will +introduce multiple mappings. + +NOTE: This option is temporary. It is only meant to serve the initial +implementation of this feature. The final user interface will likely +use a different mechanism for PPH. + @item -nostdinc++ @opindex nostdinc++ Do not search for header files in the standard directories specific to Index: gcc/testsuite/lib/dg-pph.exp diff --git a/gcc/testsuite/lib/dg-pph.exp b/gcc/testsuite/lib/dg-pph.exp index 2058959..c773aa0 100644 --- a/gcc/testsuite/lib/dg-pph.exp +++ b/gcc/testsuite/lib/dg-pph.exp @@ -33,7 +33,7 @@ proc dg-pph-hdr { subdir test options mapflag suffix } { verbose -log "\nTesting $nshort, $options" set dg-do-what-default preparse - dg-test -keep-output $test "$options $mapflag -I." "" + dg-test -keep-output $test "-fpph-gen $options $mapflag -I." "" } @@ -51,7 +51,7 @@ proc dg-pph-neg { subdir test options mapflag suffix } { verbose -log "\nTesting $nshort, $options" set dg-do-what-default compile - dg-test -keep-output $test "$options $mapflag -I." "" + dg-test -keep-output $test "-fpph-gen $options $mapflag -I." "" if { ![file_on_host exists "$bname.s"] } { file_on_host delete "$bname.s" }