After the file name comes zero or more flags which

Info icon This preview shows pages 51–53. Sign up to view the full content.

View Full Document Right Arrow Icon
After the file name comes zero or more flags, which are ‘ 1 ’, ‘ 2 ’, ‘ 3 ’, or ‘ 4 ’. If there are multiple flags, spaces separate them. Here is what the flags mean: 1 This indicates the start of a new file.
Image of page 51

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Chapter 10: Traditional Mode 48 2 This indicates returning to a file (after having included another file). 3 This indicates that the following text comes from a system header file, so certain warnings should be suppressed. 4 This indicates that the following text should be treated as being wrapped in an implicit extern "C" block. As an extension, the preprocessor accepts linemarkers in non-assembler input files. They are treated like the corresponding ‘ #line ’ directive, (see Chapter 6 [Line Control], page 44 ), except that trailing flags are permitted, and are interpreted with the meanings described above. If multiple flags are given, they must be in ascending order. Some directives may be duplicated in the output of the preprocessor. These are ‘ #ident (always), ‘ #pragma ’ (only if the preprocessor does not handle the pragma itself), and #define ’ and ‘ #undef ’ (with certain debugging options). If this happens, the ‘ # ’ of the di- rective will always be in the first column, and there will be no space between the ‘ # ’ and the directive name. If macro expansion happens to generate tokens which might be mistaken for a duplicated directive, a space will be inserted between the ‘ # ’ and the directive name. 10 Traditional Mode Traditional (pre-standard) C preprocessing is rather different from the preprocessing spec- ified by the standard. When GCC is given the ‘ -traditional-cpp ’ option, it attempts to emulate a traditional preprocessor. GCC versions 3.2 and later only support traditional mode semantics in the preprocessor, and not in the compiler front ends. This chapter outlines the traditional preprocessor semantics we implemented. The implementation does not correspond precisely to the behavior of earlier versions of GCC, nor to any true traditional preprocessor. After all, inconsistencies among traditional implementations were a major motivation for C standardization. However, we intend that it should be compatible with true traditional preprocessors in all ways that actually matter. 10.1 Traditional lexical analysis The traditional preprocessor does not decompose its input into tokens the same way a standards-conforming preprocessor does. The input is simply treated as a stream of text with minimal internal form. This implementation does not treat trigraphs (see [trigraphs], page 2 ) specially since they were an invention of the standards committee. It handles arbitrarily-positioned escaped newlines properly and splices the lines as you would expect; many traditional preprocessors did not do this.
Image of page 52
Image of page 53
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern