This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: (We are not fixing the bugs in 3.0 because they affect relatively few people and the fix is quite invasive.) 12 Invocation Most often when you use the C preprocessor you will not have to invoke it explicitly: the C compiler will do so automatically. However, the preprocessor is sometimes useful on its own. All the options listed here are also acceptable to the C compiler and have the same meaning, except that the C compiler has different rules for specifying the output file. Note: Whether you use the preprocessor by way of gcc or cpp , the compiler driver is run first. This program’s purpose is to translate your command into invocations of the programs that do the actual work. Their command line interfaces are similar but not identical to the documented interface, and may change without notice. The C preprocessor expects two file names as arguments, infile and outfile . The prepro- cessor reads infile together with any other files it specifies with ‘ #include ’. All the output generated by the combined input files is written in outfile . Either infile or outfile may be ‘- ’, which as infile means to read from standard input and as outfile means to write to standard output. Also, if either file is omitted, it means the same as if ‘- ’ had been specified for that file. Unless otherwise noted, or the option ends in ‘ = ’, all options which take an argument may have that argument appear either immediately after the option, or with a space between option and argument: ‘-Ifoo ’ and ‘-I foo ’ have the same effect. Many options have multi-letter names; therefore multiple single-letter options may not be grouped: ‘-dM ’ is very different from ‘-d -M ’.-D name Predefine name as a macro, with definition 1 .-D name = definition The contents of definition are tokenized and processed as if they appeared dur- ing translation phase three in a ‘ #define ’ directive. In particular, the definition will be truncated by embedded newline characters. If you are invoking the preprocessor from a shell or shell-like program you may need to use the shell’s quoting syntax to protect characters such as spaces that have a meaning in the shell syntax. If you wish to define a function-like macro on the command line, write its argument list with surrounding parentheses before the equals sign (if any). Chapter 12: Invocation 57 Parentheses are meaningful to most shells, so you will need to quote the option. With sh and csh , ‘-D’ name ( args... )= definition ’ ’ works. ‘-D ’ and ‘-U ’ options are processed in the order they are given on the command line. All ‘-imacros file ’ and ‘-include file ’ options are processed after all ‘-D ’ and ‘-U ’ options....
View Full Document
- Summer '13
- GCC, C preprocessor