Preprocess Options

Describes the available preprocess options.

-C

Retain all comments in the preprocessed source code, except those on preprocessor directive lines. By default, the preprocessor phase strips comments from the source code. This option is useful in combination with the -P option or -E option.

-D macro[=def]

Define macro as if it were defined by a #define directive. If no =def argument is specified, macro is defined as 1. Predefined macros also exist; these are described in Predefined Macro Use. Any predefined macro except those required by the standard (see Macros Required by the C and C++ Standards) can be redefined by the -D option. The -U option overrides the -D option when the same macro name is specified, regardless of the order of options on the command line.

-h [no]pragma[=name[:name ...]]

Default: -h pragma (no pragmas disabled)

Enable or disable the processing of specified directives in the source code, where name can be the name of a directive or a word to specify a group of directives. More than one name can be specified. Multiple names must be separated by a colon and have no intervening spaces.

NameGroupDirectives Affected
allAllAll
allinlineInlininginline_*
allscalarScalar optimizationblockable, blockingsize, noblocking, nointerchange, suppress, unroll/nounroll
allvectorVectorizationconcurrent, novector, loop_info, hand_tuned, ivdep, nopattern, novector, permutation, pipeline/nopipeline, prefervector, safe_address, safe_conditional
ompOpenMPAll OpenMP directives
accOpenACCAll OpenACC directives

When using this option to enable or disable individual directives, note that some directives must occur in pairs. For these directives, disable both directives to disable either; otherwise, the disabling of one of the directives may cause errors when the other directive is (or is not) present in the compilation unit.

-I incldir

Specifies a directory for files named in #include directives when the #include file names do not have a specified path. Each directory specified must be specified by a separate -I option. The order in which directories are searched for files named on #include directives is determined by enclosing the file name in either quotation marks (" ") or angle brackets (< and >).

Directories for #include "file" are searched in the following order:
  1. Directory of the input file
  2. Directories named in -I options, in command-line order
  3. Site-specific and compiler release-specific include files directories
  4. Directory /usr/include
Directories for #include <file> are searched in the following order:
  1. Directories named in -I options, in command-line order
  2. Site-specific and compiler release-specific include files directories
  3. Directory /usr/include

If the -I option specifies a directory name that does not begin with a slash (/), the directory is interpreted as relative to the current working directory and not relative to the directory of the input file, if different from the current working directory.

%cc -I. -I yourdir mydir/b.c
Search order:
  1. mydir (#include "file" only)
  2. Current working directory, specified by -I.
  3. yourdir (relative to the current working directory), specified by -I yourdir.
  4. Site-specific and compiler release-specific include files directories
  5. Directory /usr/include

-M

Provides information about recompilation dependencies that the source file invokes on #include files and other source files. This information is printed in the form expected by make. Such dependencies are introduced by the #include directive. The output is directed to stdout.

-nostdinc

Stops the preprocessor from searching for include files in the standard directories /usr/include, and /usr/include/c++.

-U macro

Removes any initial definition of macro. Any predefined macro except those required by the standard (see Macros Required by the C and C++ Standards) can be undefined by the -U option. The -U option overrides the -D option when the same macro name is specified, regardless of the order of options on the command line. Macros defined in the system headers are not predefined macros and are not affected by the -U option.