cppopts.texi revision 117395
196263Sobrien@c Copyright (c) 1999, 2000, 2001, 2002 296263Sobrien@c Free Software Foundation, Inc. 396263Sobrien@c This is part of the CPP and GCC manuals. 496263Sobrien@c For copying conditions, see the file gcc.texi. 596263Sobrien 696263Sobrien@c --------------------------------------------------------------------- 796263Sobrien@c Options affecting the preprocessor 896263Sobrien@c --------------------------------------------------------------------- 996263Sobrien 1096263Sobrien@c If this file is included with the flag ``cppmanual'' set, it is 1196263Sobrien@c formatted for inclusion in the CPP manual; otherwise the main GCC manual. 1296263Sobrien 1396263Sobrien@table @gcctabopt 1496263Sobrien@item -D @var{name} 1596263Sobrien@opindex D 1696263SobrienPredefine @var{name} as a macro, with definition @code{1}. 1796263Sobrien 1896263Sobrien@item -D @var{name}=@var{definition} 1996263SobrienPredefine @var{name} as a macro, with definition @var{definition}. 2096263SobrienThere are no restrictions on the contents of @var{definition}, but if 2196263Sobrienyou are invoking the preprocessor from a shell or shell-like program you 2296263Sobrienmay need to use the shell's quoting syntax to protect characters such as 2396263Sobrienspaces that have a meaning in the shell syntax. 2496263Sobrien 2596263SobrienIf you wish to define a function-like macro on the command line, write 2696263Sobrienits argument list with surrounding parentheses before the equals sign 2796263Sobrien(if any). Parentheses are meaningful to most shells, so you will need 2896263Sobriento quote the option. With @command{sh} and @command{csh}, 2996263Sobrien@option{-D'@var{name}(@var{args@dots{}})=@var{definition}'} works. 3096263Sobrien 3196263Sobrien@option{-D} and @option{-U} options are processed in the order they 3296263Sobrienare given on the command line. All @option{-imacros @var{file}} and 3396263Sobrien@option{-include @var{file}} options are processed after all 3496263Sobrien@option{-D} and @option{-U} options. 3596263Sobrien 3696263Sobrien@item -U @var{name} 3796263Sobrien@opindex U 3896263SobrienCancel any previous definition of @var{name}, either built in or 3996263Sobrienprovided with a @option{-D} option. 4096263Sobrien 4196263Sobrien@item -undef 4296263Sobrien@opindex undef 4396263SobrienDo not predefine any system-specific macros. The common predefined 4496263Sobrienmacros remain defined. 4596263Sobrien 4696263Sobrien@item -I @var{dir} 4796263Sobrien@opindex I 4896263SobrienAdd the directory @var{dir} to the list of directories to be searched 4996263Sobrienfor header files. 5096263Sobrien@ifset cppmanual 5196263Sobrien@xref{Search Path}. 5296263Sobrien@end ifset 5396263SobrienDirectories named by @option{-I} are searched before the standard 54117395Skansystem include directories. If the directory @var{dir} is a standard 55117395Skansystem include directory, the option is ignored to ensure that the 56117395Skandefault search order for system directories and the special treatment 57117395Skanof system headers are not defeated 5896263Sobrien@ifset cppmanual 5996263Sobrien(@pxref{System Headers}) 6096263Sobrien@end ifset 61117395Skan. 6296263Sobrien 6396263Sobrien@item -o @var{file} 6496263Sobrien@opindex o 6596263SobrienWrite output to @var{file}. This is the same as specifying @var{file} 6696263Sobrienas the second non-option argument to @command{cpp}. @command{gcc} has a 6796263Sobriendifferent interpretation of a second non-option argument, so you must 6896263Sobrienuse @option{-o} to specify the output file. 6996263Sobrien 7096263Sobrien@item -Wall 7196263Sobrien@opindex Wall 7296263SobrienTurns on all optional warnings which are desirable for normal code. At 7396263Sobrienpresent this is @option{-Wcomment} and @option{-Wtrigraphs}. Note that 7496263Sobrienmany of the preprocessor's warnings are on by default and have no 7596263Sobrienoptions to control them. 7696263Sobrien 7796263Sobrien@item -Wcomment 7896263Sobrien@itemx -Wcomments 7996263Sobrien@opindex Wcomment 8096263Sobrien@opindex Wcomments 8196263SobrienWarn whenever a comment-start sequence @samp{/*} appears in a @samp{/*} 8296263Sobriencomment, or whenever a backslash-newline appears in a @samp{//} comment. 8396263Sobrien(Both forms have the same effect.) 8496263Sobrien 8596263Sobrien@item -Wtrigraphs 8696263Sobrien@opindex Wtrigraphs 8796263SobrienWarn if any trigraphs are encountered. This option used to take effect 8896263Sobrienonly if @option{-trigraphs} was also specified, but now works 8996263Sobrienindependently. Warnings are not given for trigraphs within comments, as 9096263Sobrienthey do not affect the meaning of the program. 9196263Sobrien 9296263Sobrien@item -Wtraditional 9396263Sobrien@opindex Wtraditional 9496263SobrienWarn about certain constructs that behave differently in traditional and 9596263SobrienISO C@. Also warn about ISO C constructs that have no traditional C 9696263Sobrienequivalent, and problematic constructs which should be avoided. 9796263Sobrien@ifset cppmanual 9896263Sobrien@xref{Traditional Mode}. 9996263Sobrien@end ifset 10096263Sobrien 10196263Sobrien@item -Wimport 10296263Sobrien@opindex Wimport 10396263SobrienWarn the first time @samp{#import} is used. 10496263Sobrien 10596263Sobrien@item -Wundef 10696263Sobrien@opindex Wundef 10796263SobrienWarn whenever an identifier which is not a macro is encountered in an 10896263Sobrien@samp{#if} directive, outside of @samp{defined}. Such identifiers are 10996263Sobrienreplaced with zero. 11096263Sobrien 111117395Skan@item -Wunused-macros 112117395Skan@opindex Wunused-macros 113117395SkanWarn about macros defined in the main file that are unused. A macro 114117395Skanis @dfn{used} if it is expanded or tested for existence at least once. 115117395SkanThe preprocessor will also warn if the macro has not been used at the 116117395Skantime it is redefined or undefined. 117117395Skan 118117395SkanBuilt-in macros, macros defined on the command line, and macros 119117395Skandefined in include files are not warned about. 120117395Skan 121117395Skan@strong{Note:} If a macro is actually used, but only used in skipped 122117395Skanconditional blocks, then CPP will report it as unused. To avoid the 123117395Skanwarning in such a case, you might improve the scope of the macro's 124117395Skandefinition by, for example, moving it into the first skipped block. 125117395SkanAlternatively, you could provide a dummy use with something like: 126117395Skan 127117395Skan@smallexample 128117395Skan#if defined the_macro_causing_the_warning 129117395Skan#endif 130117395Skan@end smallexample 131117395Skan 132117395Skan@item -Wendif-labels 133117395Skan@opindex Wendif-labels 134117395SkanWarn whenever an @samp{#else} or an @samp{#endif} are followed by text. 135117395SkanThis usually happens in code of the form 136117395Skan 137117395Skan@smallexample 138117395Skan#if FOO 139117395Skan@dots{} 140117395Skan#else FOO 141117395Skan@dots{} 142117395Skan#endif FOO 143117395Skan@end smallexample 144117395Skan 145117395Skan@noindent 146117395SkanThe second and third @code{FOO} should be in comments, but often are not 147117395Skanin older programs. This warning is on by default. 148117395Skan 14996263Sobrien@item -Werror 15096263Sobrien@opindex Werror 15196263SobrienMake all warnings into hard errors. Source code which triggers warnings 15296263Sobrienwill be rejected. 15396263Sobrien 15496263Sobrien@item -Wsystem-headers 15596263Sobrien@opindex Wsystem-headers 15696263SobrienIssue warnings for code in system headers. These are normally unhelpful 15796263Sobrienin finding bugs in your own code, therefore suppressed. If you are 15896263Sobrienresponsible for the system library, you may want to see them. 15996263Sobrien 16096263Sobrien@item -w 16196263Sobrien@opindex w 16296263SobrienSuppress all warnings, including those which GNU CPP issues by default. 16396263Sobrien 16496263Sobrien@item -pedantic 16596263Sobrien@opindex pedantic 16696263SobrienIssue all the mandatory diagnostics listed in the C standard. Some of 16796263Sobrienthem are left out by default, since they trigger frequently on harmless 16896263Sobriencode. 16996263Sobrien 17096263Sobrien@item -pedantic-errors 17196263Sobrien@opindex pedantic-errors 17296263SobrienIssue all the mandatory diagnostics, and make all mandatory diagnostics 17396263Sobrieninto errors. This includes mandatory diagnostics that GCC issues 17496263Sobrienwithout @samp{-pedantic} but treats as warnings. 17596263Sobrien 17696263Sobrien@item -M 17796263Sobrien@opindex M 17896263Sobrien@cindex make 17996263Sobrien@cindex dependencies, make 18096263SobrienInstead of outputting the result of preprocessing, output a rule 18196263Sobriensuitable for @command{make} describing the dependencies of the main 18296263Sobriensource file. The preprocessor outputs one @command{make} rule containing 18396263Sobrienthe object file name for that source file, a colon, and the names of all 18496263Sobrienthe included files, including those coming from @option{-include} or 18596263Sobrien@option{-imacros} command line options. 18696263Sobrien 18796263SobrienUnless specified explicitly (with @option{-MT} or @option{-MQ}), the 18896263Sobrienobject file name consists of the basename of the source file with any 18996263Sobriensuffix replaced with object file suffix. If there are many included 19096263Sobrienfiles then the rule is split into several lines using @samp{\}-newline. 19196263SobrienThe rule has no commands. 19296263Sobrien 19396263SobrienThis option does not suppress the preprocessor's debug output, such as 19496263Sobrien@option{-dM}. To avoid mixing such debug output with the dependency 19596263Sobrienrules you should explicitly specify the dependency output file with 19696263Sobrien@option{-MF}, or use an environment variable like 197117395Skan@env{DEPENDENCIES_OUTPUT} (@pxref{Environment Variables}). Debug output 19896263Sobrienwill still be sent to the regular output stream as normal. 19996263Sobrien 200117395SkanPassing @option{-M} to the driver implies @option{-E}, and suppresses 201117395Skanwarnings with an implicit @option{-w}. 20296263Sobrien 20396263Sobrien@item -MM 20496263Sobrien@opindex MM 20596263SobrienLike @option{-M} but do not mention header files that are found in 20696263Sobriensystem header directories, nor header files that are included, 20796263Sobriendirectly or indirectly, from such a header. 20896263Sobrien 20996263SobrienThis implies that the choice of angle brackets or double quotes in an 21096263Sobrien@samp{#include} directive does not in itself determine whether that 21196263Sobrienheader will appear in @option{-MM} dependency output. This is a 21296263Sobrienslight change in semantics from GCC versions 3.0 and earlier. 21396263Sobrien 21496263Sobrien@item -MF @var{file} 21596263Sobrien@opindex MF 21696263Sobrien@anchor{-MF} 21796263SobrienWhen used with @option{-M} or @option{-MM}, specifies a 21896263Sobrienfile to write the dependencies to. If no @option{-MF} switch is given 21996263Sobrienthe preprocessor sends the rules to the same place it would have sent 22096263Sobrienpreprocessed output. 22196263Sobrien 22296263SobrienWhen used with the driver options @option{-MD} or @option{-MMD}, 22396263Sobrien@option{-MF} overrides the default dependency output file. 22496263Sobrien 22596263Sobrien@item -MG 22696263Sobrien@opindex MG 227117395SkanIn conjunction with an option such as @option{-M} requesting 228117395Skandependency generation, @option{-MG} assumes missing header files are 229117395Skangenerated files and adds them to the dependency list without raising 230117395Skanan error. The dependency filename is taken directly from the 231117395Skan@code{#include} directive without prepending any path. @option{-MG} 232117395Skanalso suppresses preprocessed output, as a missing header file renders 233117395Skanthis useless. 23496263Sobrien 23596263SobrienThis feature is used in automatic updating of makefiles. 23696263Sobrien 23796263Sobrien@item -MP 23896263Sobrien@opindex MP 23996263SobrienThis option instructs CPP to add a phony target for each dependency 24096263Sobrienother than the main file, causing each to depend on nothing. These 24196263Sobriendummy rules work around errors @command{make} gives if you remove header 24296263Sobrienfiles without updating the @file{Makefile} to match. 24396263Sobrien 24496263SobrienThis is typical output: 24596263Sobrien 24696263Sobrien@example 24796263Sobrientest.o: test.c test.h 24896263Sobrien 24996263Sobrientest.h: 25096263Sobrien@end example 25196263Sobrien 25296263Sobrien@item -MT @var{target} 25396263Sobrien@opindex MT 25496263Sobrien 25596263SobrienChange the target of the rule emitted by dependency generation. By 25696263Sobriendefault CPP takes the name of the main input file, including any path, 25796263Sobriendeletes any file suffix such as @samp{.c}, and appends the platform's 25896263Sobrienusual object suffix. The result is the target. 25996263Sobrien 26096263SobrienAn @option{-MT} option will set the target to be exactly the string you 26196263Sobrienspecify. If you want multiple targets, you can specify them as a single 26296263Sobrienargument to @option{-MT}, or use multiple @option{-MT} options. 26396263Sobrien 26496263SobrienFor example, @option{@w{-MT '$(objpfx)foo.o'}} might give 26596263Sobrien 26696263Sobrien@example 26796263Sobrien$(objpfx)foo.o: foo.c 26896263Sobrien@end example 26996263Sobrien 27096263Sobrien@item -MQ @var{target} 27196263Sobrien@opindex MQ 27296263Sobrien 27396263SobrienSame as @option{-MT}, but it quotes any characters which are special to 27496263SobrienMake. @option{@w{-MQ '$(objpfx)foo.o'}} gives 27596263Sobrien 27696263Sobrien@example 27796263Sobrien$$(objpfx)foo.o: foo.c 27896263Sobrien@end example 27996263Sobrien 28096263SobrienThe default target is automatically quoted, as if it were given with 28196263Sobrien@option{-MQ}. 28296263Sobrien 28396263Sobrien@item -MD 28496263Sobrien@opindex MD 28596263Sobrien@option{-MD} is equivalent to @option{-M -MF @var{file}}, except that 28696263Sobrien@option{-E} is not implied. The driver determines @var{file} based on 28796263Sobrienwhether an @option{-o} option is given. If it is, the driver uses its 28896263Sobrienargument but with a suffix of @file{.d}, otherwise it take the 28996263Sobrienbasename of the input file and applies a @file{.d} suffix. 29096263Sobrien 29196263SobrienIf @option{-MD} is used in conjunction with @option{-E}, any 29296263Sobrien@option{-o} switch is understood to specify the dependency output file 29396263Sobrien(but @pxref{-MF}), but if used without @option{-E}, each @option{-o} 29496263Sobrienis understood to specify a target object file. 29596263Sobrien 29696263SobrienSince @option{-E} is not implied, @option{-MD} can be used to generate 29796263Sobriena dependency output file as a side-effect of the compilation process. 29896263Sobrien 29996263Sobrien@item -MMD 30096263Sobrien@opindex MMD 30196263SobrienLike @option{-MD} except mention only user header files, not system 30296263Sobrien-header files. 30396263Sobrien 30496263Sobrien@item -x c 30596263Sobrien@itemx -x c++ 30696263Sobrien@itemx -x objective-c 30796263Sobrien@itemx -x assembler-with-cpp 30896263Sobrien@opindex x 30996263SobrienSpecify the source language: C, C++, Objective-C, or assembly. This has 31096263Sobriennothing to do with standards conformance or extensions; it merely 31196263Sobrienselects which base syntax to expect. If you give none of these options, 31296263Sobriencpp will deduce the language from the extension of the source file: 31396263Sobrien@samp{.c}, @samp{.cc}, @samp{.m}, or @samp{.S}. Some other common 31496263Sobrienextensions for C++ and assembly are also recognized. If cpp does not 31596263Sobrienrecognize the extension, it will treat the file as C; this is the most 31696263Sobriengeneric mode. 31796263Sobrien 31896263Sobrien@strong{Note:} Previous versions of cpp accepted a @option{-lang} option 31996263Sobrienwhich selected both the language and the standards conformance level. 32096263SobrienThis option has been removed, because it conflicts with the @option{-l} 32196263Sobrienoption. 32296263Sobrien 32396263Sobrien@item -std=@var{standard} 32496263Sobrien@itemx -ansi 32596263Sobrien@opindex ansi 32696263Sobrien@opindex std= 327117395SkanSpecify the standard to which the code should conform. Currently CPP 328117395Skanknows about C and C++ standards; others may be added in the future. 32996263Sobrien 33096263Sobrien@var{standard} 33196263Sobrienmay be one of: 33296263Sobrien@table @code 33396263Sobrien@item iso9899:1990 33496263Sobrien@itemx c89 33596263SobrienThe ISO C standard from 1990. @samp{c89} is the customary shorthand for 33696263Sobrienthis version of the standard. 33796263Sobrien 33896263SobrienThe @option{-ansi} option is equivalent to @option{-std=c89}. 33996263Sobrien 34096263Sobrien@item iso9899:199409 34196263SobrienThe 1990 C standard, as amended in 1994. 34296263Sobrien 34396263Sobrien@item iso9899:1999 34496263Sobrien@itemx c99 34596263Sobrien@itemx iso9899:199x 34696263Sobrien@itemx c9x 34796263SobrienThe revised ISO C standard, published in December 1999. Before 34896263Sobrienpublication, this was known as C9X@. 34996263Sobrien 35096263Sobrien@item gnu89 35196263SobrienThe 1990 C standard plus GNU extensions. This is the default. 35296263Sobrien 35396263Sobrien@item gnu99 35496263Sobrien@itemx gnu9x 35596263SobrienThe 1999 C standard plus GNU extensions. 356117395Skan 357117395Skan@item c++98 358117395SkanThe 1998 ISO C++ standard plus amendments. 359117395Skan 360117395Skan@item gnu++98 361117395SkanThe same as @option{-std=c++98} plus GNU extensions. This is the 362117395Skandefault for C++ code. 36396263Sobrien@end table 36496263Sobrien 36596263Sobrien@item -I- 36696263Sobrien@opindex I- 36796263SobrienSplit the include path. Any directories specified with @option{-I} 36896263Sobrienoptions before @option{-I-} are searched only for headers requested with 36996263Sobrien@code{@w{#include "@var{file}"}}; they are not searched for 37096263Sobrien@code{@w{#include <@var{file}>}}. If additional directories are 37196263Sobrienspecified with @option{-I} options after the @option{-I-}, those 37296263Sobriendirectories are searched for all @samp{#include} directives. 37396263Sobrien 37496263SobrienIn addition, @option{-I-} inhibits the use of the directory of the current 37596263Sobrienfile directory as the first search directory for @code{@w{#include 37696263Sobrien"@var{file}"}}. 37796263Sobrien@ifset cppmanual 37896263Sobrien@xref{Search Path}. 37996263Sobrien@end ifset 38096263Sobrien 38196263Sobrien@item -nostdinc 38296263Sobrien@opindex nostdinc 38396263SobrienDo not search the standard system directories for header files. 38496263SobrienOnly the directories you have specified with @option{-I} options 38596263Sobrien(and the directory of the current file, if appropriate) are searched. 38696263Sobrien 38796263Sobrien@item -nostdinc++ 38896263Sobrien@opindex nostdinc++ 38996263SobrienDo not search for header files in the C++-specific standard directories, 39096263Sobrienbut do still search the other standard directories. (This option is 39196263Sobrienused when building the C++ library.) 39296263Sobrien 39396263Sobrien@item -include @var{file} 39496263Sobrien@opindex include 39596263SobrienProcess @var{file} as if @code{#include "file"} appeared as the first 39696263Sobrienline of the primary source file. However, the first directory searched 39796263Sobrienfor @var{file} is the preprocessor's working directory @emph{instead of} 39896263Sobrienthe directory containing the main source file. If not found there, it 39996263Sobrienis searched for in the remainder of the @code{#include "@dots{}"} search 40096263Sobrienchain as normal. 40196263Sobrien 40296263SobrienIf multiple @option{-include} options are given, the files are included 40396263Sobrienin the order they appear on the command line. 40496263Sobrien 40596263Sobrien@item -imacros @var{file} 40696263Sobrien@opindex imacros 40796263SobrienExactly like @option{-include}, except that any output produced by 40896263Sobrienscanning @var{file} is thrown away. Macros it defines remain defined. 40996263SobrienThis allows you to acquire all the macros from a header without also 41096263Sobrienprocessing its declarations. 41196263Sobrien 41296263SobrienAll files specified by @option{-imacros} are processed before all files 41396263Sobrienspecified by @option{-include}. 41496263Sobrien 41596263Sobrien@item -idirafter @var{dir} 41696263Sobrien@opindex idirafter 41796263SobrienSearch @var{dir} for header files, but do it @emph{after} all 41896263Sobriendirectories specified with @option{-I} and the standard system directories 41996263Sobrienhave been exhausted. @var{dir} is treated as a system include directory. 42096263Sobrien 42196263Sobrien@item -iprefix @var{prefix} 42296263Sobrien@opindex iprefix 42396263SobrienSpecify @var{prefix} as the prefix for subsequent @option{-iwithprefix} 42496263Sobrienoptions. If the prefix represents a directory, you should include the 42596263Sobrienfinal @samp{/}. 42696263Sobrien 42796263Sobrien@item -iwithprefix @var{dir} 42896263Sobrien@itemx -iwithprefixbefore @var{dir} 42996263Sobrien@opindex iwithprefix 43096263Sobrien@opindex iwithprefixbefore 43196263SobrienAppend @var{dir} to the prefix specified previously with 43296263Sobrien@option{-iprefix}, and add the resulting directory to the include search 43396263Sobrienpath. @option{-iwithprefixbefore} puts it in the same place @option{-I} 43496263Sobrienwould; @option{-iwithprefix} puts it where @option{-idirafter} would. 43596263Sobrien 43696263SobrienUse of these options is discouraged. 43796263Sobrien 43896263Sobrien@item -isystem @var{dir} 43996263Sobrien@opindex isystem 44096263SobrienSearch @var{dir} for header files, after all directories specified by 44196263Sobrien@option{-I} but before the standard system directories. Mark it 44296263Sobrienas a system directory, so that it gets the same special treatment as 44396263Sobrienis applied to the standard system directories. 44496263Sobrien@ifset cppmanual 44596263Sobrien@xref{System Headers}. 44696263Sobrien@end ifset 44796263Sobrien 44896263Sobrien@item -fpreprocessed 44996263Sobrien@opindex fpreprocessed 45096263SobrienIndicate to the preprocessor that the input file has already been 45196263Sobrienpreprocessed. This suppresses things like macro expansion, trigraph 45296263Sobrienconversion, escaped newline splicing, and processing of most directives. 45396263SobrienThe preprocessor still recognizes and removes comments, so that you can 45496263Sobrienpass a file preprocessed with @option{-C} to the compiler without 45596263Sobrienproblems. In this mode the integrated preprocessor is little more than 45696263Sobriena tokenizer for the front ends. 45796263Sobrien 45896263Sobrien@option{-fpreprocessed} is implicit if the input file has one of the 45996263Sobrienextensions @samp{.i}, @samp{.ii} or @samp{.mi}. These are the 46096263Sobrienextensions that GCC uses for preprocessed files created by 46196263Sobrien@option{-save-temps}. 46296263Sobrien 46396263Sobrien@item -ftabstop=@var{width} 46496263Sobrien@opindex ftabstop 46596263SobrienSet the distance between tab stops. This helps the preprocessor report 46696263Sobriencorrect column numbers in warnings or errors, even if tabs appear on the 46796263Sobrienline. If the value is less than 1 or greater than 100, the option is 46896263Sobrienignored. The default is 8. 46996263Sobrien 47096263Sobrien@item -fno-show-column 47196263Sobrien@opindex fno-show-column 47296263SobrienDo not print column numbers in diagnostics. This may be necessary if 47396263Sobriendiagnostics are being scanned by a program that does not understand the 47496263Sobriencolumn numbers, such as @command{dejagnu}. 47596263Sobrien 47696263Sobrien@item -A @var{predicate}=@var{answer} 47796263Sobrien@opindex A 47896263SobrienMake an assertion with the predicate @var{predicate} and answer 47996263Sobrien@var{answer}. This form is preferred to the older form @option{-A 48096263Sobrien@var{predicate}(@var{answer})}, which is still supported, because 48196263Sobrienit does not use shell special characters. 48296263Sobrien@ifset cppmanual 48396263Sobrien@xref{Assertions}. 48496263Sobrien@end ifset 48596263Sobrien 48696263Sobrien@item -A -@var{predicate}=@var{answer} 48796263SobrienCancel an assertion with the predicate @var{predicate} and answer 48896263Sobrien@var{answer}. 48996263Sobrien 49096263Sobrien@item -dCHARS 49196263Sobrien@var{CHARS} is a sequence of one or more of the following characters, 49296263Sobrienand must not be preceded by a space. Other characters are interpreted 49396263Sobrienby the compiler proper, or reserved for future versions of GCC, and so 49496263Sobrienare silently ignored. If you specify characters whose behavior 49596263Sobrienconflicts, the result is undefined. 49696263Sobrien 49796263Sobrien@table @samp 49896263Sobrien@item M 49996263Sobrien@opindex dM 50096263SobrienInstead of the normal output, generate a list of @samp{#define} 50196263Sobriendirectives for all the macros defined during the execution of the 50296263Sobrienpreprocessor, including predefined macros. This gives you a way of 50396263Sobrienfinding out what is predefined in your version of the preprocessor. 50496263SobrienAssuming you have no file @file{foo.h}, the command 50596263Sobrien 50696263Sobrien@example 50796263Sobrientouch foo.h; cpp -dM foo.h 50896263Sobrien@end example 50996263Sobrien 51096263Sobrien@noindent 51196263Sobrienwill show all the predefined macros. 51296263Sobrien 51396263Sobrien@item D 51496263Sobrien@opindex dD 51596263SobrienLike @samp{M} except in two respects: it does @emph{not} include the 51696263Sobrienpredefined macros, and it outputs @emph{both} the @samp{#define} 51796263Sobriendirectives and the result of preprocessing. Both kinds of output go to 51896263Sobrienthe standard output file. 51996263Sobrien 52096263Sobrien@item N 52196263Sobrien@opindex dN 52296263SobrienLike @samp{D}, but emit only the macro names, not their expansions. 52396263Sobrien 52496263Sobrien@item I 52596263Sobrien@opindex dI 52696263SobrienOutput @samp{#include} directives in addition to the result of 52796263Sobrienpreprocessing. 52896263Sobrien@end table 52996263Sobrien 53096263Sobrien@item -P 53196263Sobrien@opindex P 53296263SobrienInhibit generation of linemarkers in the output from the preprocessor. 53396263SobrienThis might be useful when running the preprocessor on something that is 53496263Sobriennot C code, and will be sent to a program which might be confused by the 53596263Sobrienlinemarkers. 53696263Sobrien@ifset cppmanual 53796263Sobrien@xref{Preprocessor Output}. 53896263Sobrien@end ifset 53996263Sobrien 54096263Sobrien@item -C 54196263Sobrien@opindex C 54296263SobrienDo not discard comments. All comments are passed through to the output 54396263Sobrienfile, except for comments in processed directives, which are deleted 54496263Sobrienalong with the directive. 54596263Sobrien 54696263SobrienYou should be prepared for side effects when using @option{-C}; it 54796263Sobriencauses the preprocessor to treat comments as tokens in their own right. 54896263SobrienFor example, comments appearing at the start of what would be a 54996263Sobriendirective line have the effect of turning that line into an ordinary 55096263Sobriensource line, since the first token on the line is no longer a @samp{#}. 55196263Sobrien 552117395Skan@item -CC 553117395SkanDo not discard comments, including during macro expansion. This is 554117395Skanlike @option{-C}, except that comments contained within macros are 555117395Skanalso passed through to the output file where the macro is expanded. 556117395Skan 557117395SkanIn addition to the side-effects of the @option{-C} option, the 558117395Skan@option{-CC} option causes all C++-style comments inside a macro 559117395Skanto be converted to C-style comments. This is to prevent later use 560117395Skanof that macro from inadvertently commenting out the remainder of 561117395Skanthe source line. 562117395Skan 563117395SkanThe @option{-CC} option is generally used to support lint comments. 564117395Skan 56596263Sobrien@item -gcc 56696263Sobrien@opindex gcc 56796263SobrienDefine the macros @sc{__gnuc__}, @sc{__gnuc_minor__} and 56896263Sobrien@sc{__gnuc_patchlevel__}. These are defined automatically when you use 56996263Sobrien@command{gcc -E}; you can turn them off in that case with 57096263Sobrien@option{-no-gcc}. 57196263Sobrien 572117395Skan@item -traditional-cpp 573117395Skan@opindex traditional-cpp 574117395SkanTry to imitate the behavior of old-fashioned C preprocessors, as 575117395Skanopposed to ISO C preprocessors. 57696263Sobrien@ifset cppmanual 57796263Sobrien@xref{Traditional Mode}. 57896263Sobrien@end ifset 57996263Sobrien 58096263Sobrien@item -trigraphs 58196263Sobrien@opindex trigraphs 58296263SobrienProcess trigraph sequences. 58396263Sobrien@ifset cppmanual 58496263Sobrien@xref{Initial processing}. 58596263Sobrien@end ifset 58696263Sobrien@ifclear cppmanual 58796263SobrienThese are three-character sequences, all starting with @samp{??}, that 58896263Sobrienare defined by ISO C to stand for single characters. For example, 58996263Sobrien@samp{??/} stands for @samp{\}, so @samp{'??/n'} is a character 59096263Sobrienconstant for a newline. By default, GCC ignores trigraphs, but in 59196263Sobrienstandard-conforming modes it converts them. See the @option{-std} and 59296263Sobrien@option{-ansi} options. 59396263Sobrien 59496263SobrienThe nine trigraphs and their replacements are 59596263Sobrien 596103445Skan@smallexample 59796263SobrienTrigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??- 59896263SobrienReplacement: [ ] @{ @} # \ ^ | ~ 599103445Skan@end smallexample 60096263Sobrien@end ifclear 60196263Sobrien 60296263Sobrien@item -remap 60396263Sobrien@opindex remap 60496263SobrienEnable special code to work around file systems which only permit very 60596263Sobrienshort file names, such as MS-DOS@. 60696263Sobrien 60796263Sobrien@itemx --help 60896263Sobrien@itemx --target-help 60996263Sobrien@opindex help 61096263Sobrien@opindex target-help 61196263SobrienPrint text describing all the command line options instead of 61296263Sobrienpreprocessing anything. 61396263Sobrien 61496263Sobrien@item -v 61596263Sobrien@opindex v 61696263SobrienVerbose mode. Print out GNU CPP's version number at the beginning of 61796263Sobrienexecution, and report the final form of the include path. 61896263Sobrien 61996263Sobrien@item -H 62096263Sobrien@opindex H 62196263SobrienPrint the name of each header file used, in addition to other normal 62296263Sobrienactivities. Each name is indented to show how deep in the 62396263Sobrien@samp{#include} stack it is. 62496263Sobrien 62596263Sobrien@item -version 62696263Sobrien@itemx --version 62796263Sobrien@opindex version 62896263SobrienPrint out GNU CPP's version number. With one dash, proceed to 62996263Sobrienpreprocess as normal. With two dashes, exit immediately. 63096263Sobrien@end table 631