-x (-qsourcetype)
Category
Pragma equivalent
None.
Purpose
Instructs the compiler to treat all recognized source files as a specified source type, regardless of the actual file name suffix.
Ordinarily, the compiler uses the file name suffix of source files specified on the command line to determine the type of the source file. For example, a .c suffix normally implies C source code, and a .C suffix normally implies C++ source code. The -x option instructs the compiler to not rely on the file name suffix, and to instead assume a source type as specified by the option.
Syntax
.-none---------------. >>- -x--+-assembler----------+--------------------------------->< +-assembler-with-cpp-+ +-c------------------+ '-c++----------------'
.-default------------. >>- -q--sourcetype--=--+-assembler----------+------------------>< +-assembler-with-cpp-+ +-c------------------+ '-c++----------------'
Defaults
-x none or -qsourcetype=default
Parameters
- assembler
- All source files following the option are compiled as if they are assembler language source files.
- assembler-with-cpp
- All source files following the option are compiled as if they are assembler language source files that need preprocessing.
- c
- All source files following the option are compiled as if they are C language source files.
- c++
- All source files following the option are compiled as if they are C++ language source files. This suboption is equivalent to the -+ option.
- default (-qsourcetype only)
- The programming language of a source file is implied by its file name suffix.
- none (-x only)
- The programming language of a source file is implied by its file name suffix.
Usage
If you do not use this option, files must have a suffix of .c to be compiled as C files, and .C (uppercase C), .cc, .cp, .cpp, .cxx, or .c++ to be compiled as C++ files.
xlc goodbye.C -x c hello.C
hello.C is compiled as a C source file, but goodbye.C is compiled as a C++ file.
Predefined macros
None.