[pph] Add error for pre-parsing unguarded headers.

Lawrence Crowl crowl@google.com
Thu Feb 24 21:55:00 GMT 2011


Add an error when pre-parsing a header that does not have a double
inclusion guard.

We do this by adding function cpp_main_missing_guard that returns
the name of the main source file when it does not have a guard, and
checking that condition before writing the PPH file.

Index: gcc/testsuite/ChangeLog.pph

2011-02-24  Lawrence Crowl <crowl@google.com>

	* g++.dg/pph/d1unguarded.h: Add test for non-null unguarded header.
        * g++.dg/pph/d2null.h: Unguarded header error now expected.

Index: gcc/cp/ChangeLog.pph

2011-02-24  Lawrence Crowl <crowl@google.com>

        * cp/pph.c (pph_finish): Check for missing preprocessor guard
        for pre-parsed headers.

Index: libcpp/ChangeLog.pph

2011-02-24  Lawrence Crowl  <crowl@google.com>

	* include/cpplib.h (cpp_main_missing_guard): Add declaration.
	* files.c (cpp_main_missing_guard): Add definition.
	(main_missing_guard): Add to support cpp_main_missing_guard.

-- 
Lawrence Crowl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: src.patch
Type: text/x-patch
Size: 3549 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110224/cf46128c/attachment.bin>


More information about the Gcc-patches mailing list