3.10. Specifying Source Files and File Extensions

The following command-line options specify source file type treatment and extensions.

cl2000 Option (and alias)

c29clang Option

--asm_file=<file> (-fa=<file>)

-x assembler

-x assembler-with-cpp

Note: Use of assembly language is discouraged for c29clang, except for assembly code that is embedded in C/C++ source files via asm() statements, which are processed inline by the c29clang integrated GNU-syntax assembler. Assembly language source files should be rewritten in C/C++. See Migrating Assembly Language Source Code for more information.

The cl2000 compiler provides the --asm_file option to identify a specific file as an assembly source file regardless of its extension.

The c29clang compiler processes source files specified on the command line after the ‘-x <type>’ option as source files of an indicated type. For assembly source files, there are 3 different <type> arguments that can be specified for the -x option:

  • assembler - assume that source files that follow the ‘-x assembler’ option contain GNU-style assembly source.

  • assembler-with-cpp - assume that source files that follow the ‘-x assembler-with-cpp’ option contain GNU-style assembly source that contains pre-processing directives that must be processed before the GNU-style assembler is invoked on the GNU-style assembly source.

Note that like other instances of the c29clang compiler’s -x option, the source file type indicated by a given -x option will determine how source files which follow that -x option are interpreted until another -x option that specifies a different source file type is encountered.

cl2000 Option (and alias)

c29clang Option

--c_file=<file> (-fc=<file>)

-x c

The cl2000 compiler provides the --c_file option to identify a specific file as a C source file regardless of its extension.

The c29clang compiler processes source files specified on the command line after the ‘-x c’ option as C source files. Like other instances of the c29clang compiler’s -x option, the source file type indicated by a given -x option will determine how source files which follow that -x option are interpreted until another -x option that specifies a different source file type is encountered.

cl2000 Option (and alias)

c29clang Option

--cpp_default (-fg)

-x c++

--cpp_file=<file> (-fp=<file>)

The cl2000 compiler provides the --cpp_default file option to indicate that C files (with ‘.c’ file extension) should be interpreted as C++ source files. The cl2000 compiler also provides the --cpp_file option to identify a specific file as a C++ source file regardless of its extension.

The c29clang compiler processes source files specified on the command line after the ‘-x c++’ option as C source files. Like other instances of the c29clang compiler’s -x option, the source file type indicated by a given -x option will determine how source files which follow that -x option are interpreted until another -x option that specifies a different source file type is encountered.

cl2000 Option (and alias)

c29clang Option

--obj_file=<file> (-fo=<file>)

not supported

The cl2000 compiler provides the --obj_file option to identify a specific file as an object file regardless of its extension.

The c29clang compiler does not provide an explicit option to tell the compiler to interpret a given file as an object file, regardless of extension. However, provided there are no -x options preceding an object file specification on the c29clang command- line, the c29clang compiler will detect that the specified file contains object code and pass the file along to be included in the link step.

Alternatively, if there are -x options on the c29clang command- line that would interfere with the proper interpretation of an object files specification, you may precede the object file specification with a -Xlinker option to indicate that the object file is intended as input to the linker.

cl2000 Option

c29clang Option

--preinclude=<file>

-include <file>

The cl2000 compiler provides the --preinclude option to include a source file at the beginning of compilation.

The c29clang compiler’s -include option provides the same functionality.

cl2000 Option (and alias)

c29clang Option

--asm_extension=<ext> (-ea=<ext>)

not supported

Note: Use of assembly language is discouraged for c29clang, except for assembly code that is embedded in C/C++ source files via asm() statements, which are processed inline by the c29clang integrated GNU-syntax assembler. Assembly language source files should be rewritten in C/C++. See Migrating Assembly Language Source Code for more information.

The cl2000 compiler provides the --asm_extension option to indicate that files with the specified extension (<ext>) should be interpreted as assembly source files. In addition, assembly files that are generated by the compiler will have the specified extension.

The c29clang compiler does not provide support for changing default file extensions. Files with an .s (lower-case) extension are treated as GNU-style assembly source. The .S (upper-case) extension indicates that a GNU-style assembly source file requires preprocessing.

cl2000 Option (and alias)

c29clang Option

--c_extension=<ext> (-ec=<ext>)

not supported

The cl2000 compiler provides the --c_extension option to indicate that files with the specified extension (<ext>) should be interpreted as C source files.

The c29clang compiler does not provide support for changing default file extensions. Files with the .c extension are compiled as C.

cl2000 Option (and alias)

c29clang Option

--cpp_extension=<ext> (-ep=<ext>)

not supported

The cl2000 compiler provides the --cpp_extension option to indicate that files with the specified extension (<ext>) should be interpreted as C++ source files.

The c29clang compiler does not provide support for changing default file extensions. Files with the .cpp, .cxx, .c+, .cc, and .CC extensions are compiled as C++. You may also use the -x c++ option to indicate that any source file that follows the -x c++ option should be interpreted as a C++ source file (until another -x option is encountered on the c29clang command-line).

cl2000 Option (and alias)

c29clang Option

--listing_extension=<ext> (-es=<ext>)

not supported

The cl2000 compiler provides the --listing_extension option to indicate that assembly listing files that are generated by the compiler will have the specified extension (<ext>).

The c29clang compiler does not provide support for generating assembly listing files. Instead you may choose to use one of the available binary utilities to display the content of an object file.

cl2000 Option (and alias)

c29clang Option

--obj_extension=<ext> (-eo=<ext>)

not supported

The cl2000 compiler provides the --obj_extension option to indicate that files with the specified extension (<ext>) should be interpreted as object files. In addition, object files that are generated by the compiler will have the specified extension.

The c29clang compiler does not provide support for changing default file extensions. The c29clang compiler will attach a ‘.o’ extension to regular object files. The -o option can be used to specify the name of the linked output file.

There are some exceptions to this. For example, the c29clang compiler will interpret ‘.c’ file extensions as C source files, ‘.cpp’ file extensions as C++ source files, and ‘.s’ file extensions as GNU-style assembly source files.