Article View: gnu.gcc.help
Article #41717Understanding the GCC preprocessor
From: Patrick Vestjens
Date: Tue, 27 Feb 1996 00:00
Date: Tue, 27 Feb 1996 00:00
44 lines
2385 bytes
2385 bytes
Hi there, can anybody explain to me the semantics of the text generated by the GCC preprocessor? Especially the entering and leaving of files raises some questions since the output of GCC when processing some Objective-C source file is in contradiction with my original understanding of the semantics. I thought that a '1' after the filename means that the preprocessor enterred that file and a '2' means the preprocessor left the file. However, in the output generated by the preprocessor the following occurs (my apologies for the lines that are too long): # 1 "/depot/objc/src/runtime/Object.h" 1 # 1 "/depot/objc/src/runtime/objc.h" 1 # 1 "/depot/gnuStuff/solaris/lib/gcc-lib/sparc-sun-solaris2.3/2.7.2/include/stdio.h" 1 3 # 1 "/usr/include/sys/feature_tests.h" 1 3 # 17 "/depot/gnuStuff/solaris/lib/gcc-lib/sparc-sun-solaris2.3/2.7.2/include/stdio.h" 2 3 # 194 "/depot/gnuStuff/solaris/lib/gcc-lib/sparc-sun-solaris2.3/2.7.2/include/stdio.h" 3 # 268 "/depot/gnuStuff/solaris/lib/gcc-lib/sparc-sun-solaris2.3/2.7.2/include/stdio.h" 3 # 16 "/depot/objc/src/runtime/objc.h" 2 # 1 "/depot/objc/src/runtime/host.h" 1 # 94 "/depot/objc/src/runtime/host.h" # 115 "/depot/objc/src/runtime/host.h" # 69 "/depot/objc/src/runtime/objc.h" 2 # 1 "/depot/objc/src/runtime/101fname.h" 1 # 48 "/depot/objc/src/runtime/101fname.h" # 70 "/depot/objc/src/runtime/objc.h" 2 As you can see, three (in my opinion) strange things happen: 1) The file stdio.h is left BEFORE feature_tests.h which was enterred via stdio.h and should therefore be left prior to stdio.h. The same happens with host.h and 101fname.h in combination with objc.h. 2) After the preprocessor has left the file stdio.h, it claims that it is still in stdio.h (with line number 194 and 268 resp.). 3) The file objc.h is left THREE times, even though it is enterred only once. Can somebody shed a light on this please? Thanks in advance, regards, Patrick.
Technical Details
Message-ID:
<1996Feb27.145121.27877@ms.philips.nl>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,c36ace895f532ec1,start X-Google-Attributes: gid11318c,public From: Pvestjen@ms.philips.nl (Patrick Vestjens) Subject: Understanding the GCC preprocessor Date: 1996/02/27 Message-ID: <1996Feb27.145121.27877@ms.philips.nl> X-Deja-AN: 141318328 sender: news@ms.philips.nl organization: Philips Medical Systems, Best newsgroups: gnu.gcc.help