3.3. Specifying Source Language and Specific Language Characteristics

The following command-line options specify the language standards the compiler should expect C/C++ source code to comply with and also what assumptions to make regarding particular data types.

cl2000 Option

c29clang Option

--c89

--c99

--c11

-std=<C standard identification>

The c29clang -std option can be used to instruct the compiler to process C files in accordance with the indicated ANSI/ISO C language standard. For the c29clang compiler, the available -std option arguments for C are:

  • c89, c90, iso9899:1990 (ISO C 1990)

  • c99, c9x, iso9899:1999 (ISO C 1999)

  • c11, c1x, iso9899:2011 (ISO C 2011)

  • c17, c18, iso9899:2017 (ISO C 2017)

  • iso9899:199409 (ISO C 1990 with amendment 1)

  • gnu89, gnu90 (ISO C 1990 with GNU extensions)

  • gnu99, gnu9x (ISO C 1999 with GNU extensions)

  • gnu11, gnu1x (ISO C 2011 with GNU extensions)

  • gnu17, gnu18 (ISO C 2017 with GNU extensions)

If no -std option is specified when compiling a C source file, gnu17 is assumed by default.

By default, source files with a ‘.c’ extension are interpreted as C source files. The -x c option can be specified on the command-line to force a source file that does not have a ‘.c’ extension to be interpreted as a C source file.

The c29clang compiler can handle a mix of C and C++ source files on a single invocation of the compiler. To interpret a file, regardless of its extension, as a C file, the -x c option should be specified before that file on the c29clang command. All source files that follow the -x c option are interpreted as C source files until another -x option is encountered on the command-line.

cl2000 Option

c29clang Option

--c++03

--c++11

--c++14

--c++17

-std=<C++ standard identification>

The c29clang -std option can (also) be used to instruct the compiler to process C++ source files in accordance with the indicated ANSI/ISO C++ language standard. For the c29clang compiler, the available supported -std option arguments for C++ are:

  • c++98, c++03 (IS0 C++ 1998 with amendments)

  • c++11 (ISO C++ 2011 with amendments)

  • c++14 (ISO C++ 2014 with amendments)

  • c++17 (ISO C++ 2017 with amendments)

  • gnu++98, gnu++03 (ISO C++ 1998 with amendments and GNU extensions)

  • gnu++11 (ISO 2011 with amendments and GNU extensions)

  • gnu++14 (ISO C++ 2014 with amendments and GNU extensions)

  • gnu++17 (ISA C++ 2017 with amendments and GNU extensions)

If no -std option is specified when compiling a C++ source file, gnu++17 is assumed by default.

By default, source files with a ‘.cpp’ extension are interpreted as C++ source files. The -x c++ option can be specified on the command-line to force a source file that does not have a ‘.cpp’ extension to be interpreted as a C++ source file.

The c29clang compiler can handle a mix of C and C++ source files on a single invocation of the compiler. To interpret a file, regardless of its extension, as a C++ file, the -x c++ option should be specified before that file on the c29clang command. All source files that follow the -x c++ option are interpreted as C++ source files until another -x option is encountered on the command-line.

Note

C++ support is based on a library that is focused on support for C++17. If you specify an earlier version of the C++ standard, it is not guaranteed that features that were not required by that standard will be unsupported.

cl2000 Option (and alias)

c29clang Option

--cpp_default (-fg)

-x c++

--language=c++

The cl2000 compiler provides a --cpp_default option that tells the compiler to process all source files with a ‘.c’ extension as C++ source files.

The c29clang compiler’s -x c++ option provides similar support, but whereas cl2000’s -fg option applies only to source files with ‘.c’ extensions, the c29clang compiler’s -x c++ option applies to any source file that is specified after the -x c++ option on the c29clang command-line up until another -x option is encountered.

cl2000 Option

c29clang Option

-x <language type>

--language=<language type>

The c29clang compiler’s -x or --language option provides a way to indicate how source files that are specified after the option are to be interpreted. There are four valid option arguments:

  • c++ - source files specified after the -x c++ option are interpreted as C++ source files

  • c - source files specified after the -x c option are interpreted as C source files

For example, suppose you have two source files, t1.cpp and t2.c. Assuming t2.c is C++ compatible, one could then invoke the c29clang compiler with:

%> c29clang ... t1.cpp -x c++ t2.c t3.S ... -o t.out ...

to ensure that t2.c is interpreted as a C++ source file so that its object is compatible with t1.o.

cl2000 Option

c29clang Option

--cla_background_task

not supported

--cla_default

not supported

--cla_signed_compare_workaround

not supported

The cl2000 compiler supports these options to control the behavior of the CLA compiler.

The Control Law Accelerator (CLA) is not needed when using TI C29x devices because of their improved performance over TI C28x devices. For this reason, these options are not supported by the c29clang compiler.

See Migrating CLA Code for further information.

cl2000 Option

c29clang Option

--exceptions

not supported

--extern_c_can_throw

not supported

The c29clang compiler currently does not support C++ exception handling and the -fexceptions compiler option.

cl2000 Option (and alias)

c29clang Option

--gen_cross_reference_listing (-px)

not supported

The cl2000 compiler supports the -px option, which causes the compiler to emit a .crl file, which contains a listing of where symbols are referenced and defined.

The c29clang compiler does not support an analogous option.

cl2000 Option

c29clang Option

--gen_preprocessor_listing

not supported

The cl2000 compiler supports the --gen_preprocessor_listing option, which causes the compiler to emit a listing of the pre-processing output to an .rl file.

The c29clang compiler does not support an analogous option.

cl2000 Option

c29clang Option

--pending_instantiations=#

The cl2000 compiler supports these options to specify the number of template instantiations that may be in progress at any given time.

cl2000 Option (and alias)

c29clang Option

--relaxed_ansi (-pr)

-std=gnu<90|99|11|17>

The cl2000 compiler supports GNU extensions to the C language if its -pr option is selected. To enable support of GNU extensions in the c29clang compiler, use one of the GNU settings (gnu90, gnu99, gnu11, gnu17) as the argument to c29clang’s -std option.

cl2000 Option

c29clang Option

--rtti

-fno-rtti (default)

-frtti

The cl2000 compiler does not allow the inclusion of Run-Time Type Information (RTTI) to be disabled. RTTI is included if a C++ application may need to refer to a class’ type_info object.

The c29clang compiler has RTTI support disabled by default. Use the -frtti option to allow C++ RTTI to be generated.

cl2000 Option (and alias)

c29clang Option

--strict_ansi (-ps)

-std=c<90|99|11|17>

The cl2000 compiler provides the -ps option to allow you to disable support for GNU C extensions to the C standard. To disable support for GNU extensions in the c29clang compiler and approximate the behavior of cl2000’s -ps option, use one of the non-GNU language settings (c90, c99, c11, c17) as the argument to c29clang’s -std option.

All c29clang “-std=c<XX>” C language variants define the __STRICT_ANSI__ predefined macro symbol.

You can combine “-std=c<XX>” with c29clang’s -pedantic option, which causes warnings to be issued for any conflicts with ISO C and ISO C++. The c29clang compiler’s -pedantic-errors option causes errors instead of warnings to be issued for such conflicts.