Include Hackery

Jim Wilson wilson@chestnut.cygnus.com
Tue Sep 2 15:47:00 GMT 1997


	2.  The commentary to the right of "#else" and "#endif" used to
	    be stripped.  I put it inside "/* */".

Trying to modify what fixincludes does is always a risky business.

What if this commentary includes a comment?  If you have
	#endif foo /* stuff */
you then get nested comments and we still get a warning with -pedantic.

Looking through the ChangeLogs, I see that we did indeed run into a problem
with this, though it is not the first case I thought of.  Consider this
example
	/* Comment out this stuff
        #ifdef foo
	...
	#endif foo
	end of comment.  */
If you fix the foo by changing it to /* foo */, then you now have a nested
comment.  This is worse than what we started with, because this is now a
syntax error regardless of what options are used.

Thu Jul  1 18:15:17 1993  Paul Eggert  (eggert@twinsun.com)

	* fixinc.svr4: Remove everything after #endif, instead of trying
        to turn it into comments, which loses inside comments.
        * fixincludes: Likewise.  Remove #endif workarounds for Ultrix 4.[12]
        and SunOS 4.1, which are no longer needed because of this bug fix.

Jim



More information about the Gcc mailing list