{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Pragma gcc warning pragma gcc error pragma gcc

Info iconThis preview shows pages 50–52. Sign up to view the full content.

View Full Document Right Arrow Icon
#pragma GCC warning #pragma GCC error #pragma GCC warning "message" causes the preprocessor to issue a warning diagnostic with the text ‘ message ’. The message contained in the pragma must be a single string literal. Similarly, #pragma GCC error "message" issues an
Background image of page 50

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

View Full Document Right Arrow Icon
Chapter 9: Preprocessor Output 47 error message. Unlike the ‘ #warning ’ and ‘ #error ’ directives, these pragmas can be embedded in preprocessor macros using ‘ _Pragma ’. 8 Other Directives The ‘ #ident ’ directive takes one argument, a string constant. On some systems, that string constant is copied into a special segment of the object file. On other systems, the directive is ignored. The ‘ #sccs ’ directive is a synonym for ‘ #ident ’. These directives are not part of the C standard, but they are not official GNU extensions either. What historical information we have been able to find, suggests they originated with System V. The null directive consists of a ‘ # ’ followed by a newline, with only whitespace (including comments) in between. A null directive is understood as a preprocessing directive but has no effect on the preprocessor output. The primary significance of the existence of the null directive is that an input line consisting of just a ‘ # ’ will produce no output, rather than a line of output containing just a ‘ # ’. Supposedly some old C programs contain such lines. 9 Preprocessor Output When the C preprocessor is used with the C, C ++ , or Objective-C compilers, it is integrated into the compiler and communicates a stream of binary tokens directly to the compiler’s parser. However, it can also be used in the more conventional standalone mode, where it produces textual output. The output from the C preprocessor looks much like the input, except that all prepro- cessing directive lines have been replaced with blank lines and all comments with spaces. Long runs of blank lines are discarded. The ISO standard specifies that it is implementation defined whether a preprocessor preserves whitespace between tokens, or replaces it with e.g. a single space. In GNU CPP, whitespace between tokens is collapsed to become a single space, with the exception that the first token on a non-directive line is preceded with sufficient spaces that it appears in the same column in the preprocessed output that it appeared in the original source file. This is so the output is easy to read. See Section 11.4 [Differences from previous versions], page 55 . CPP does not insert any whitespace where there was none in the original source, except where necessary to prevent an accidental token paste. Source file name and line number information is conveyed by lines of the form # linenum filename flags These are called linemarkers . They are inserted as needed into the output (but never within a string or character constant). They mean that the following line originated in file filename at line linenum . filename will never contain any non-printing characters; they are replaced with octal escape sequences.
Background image of page 51
Image of page 52
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}