Options syntax
Compiler options are parameters you can specify to change the default behavior of the compiler. You can specify options from the command line—which is described in more detail in this section—and from within the IDE.
Caution
See Compiler options for information about the compiler options available in the IDE and how to set them.
Types of options
There are two types of names for command line options, short names and long names. Some options have both.
A short option name consists of one character, and it can have parameters. You specify it with a single dash, for example
-e.A long option name consists of one or several words joined by underscores, and it can have parameters. You specify it with double dashes, for example
‑‑char_is_signed.
For information about the different methods for passing options, see Passing options.
Rules for specifying parameters
There are some general syntax rules for specifying option parameters. First, the rules depending on whether the parameter is optional or mandatory, and whether the option has a short or a long name, are described. Then, the rules for specifying filenames and directories are listed. Finally, the remaining rules are listed.
Rules for optional parameters
For options with a short name and an optional parameter, any parameter should be specified without a preceding space, for example:
-O or -Oh
For options with a long name and an optional parameter, any parameter should be specified with a preceding equal sign (=), like this:
‑‑example_option=valueRules for mandatory parameters
For options with a short name and a mandatory parameter, the parameter can be specified either with or without a preceding space, for example:
-I..\src or -I ..\src\
For options with a long name and a mandatory parameter, the parameter can be specified either with a preceding equal sign (=) or with a preceding space, for example:
‑‑diagnostics_tables=MyDiagnostics.lst
or
‑‑diagnostics_tables MyDiagnostics.lst
Rules for options with both optional and mandatory parameters
For options taking both optional and mandatory parameters, the rules for specifying the parameters are:
For short options, optional parameters are specified without a preceding space
For long options, optional parameters are specified with a preceding equal sign (
=)For short and long options, mandatory parameters are specified with a preceding space.
For example, a short option with an optional parameter followed by a mandatory parameter:
-lA MyList.lst
For example, a long option with an optional parameter followed by a mandatory parameter:
‑‑preprocess=n PreprocOutput.lst
Rules for specifying a filename or directory as parameters
These rules apply for options taking a filename or directory as parameters:
Options that take a filename as a parameter can optionally take a file path. The path can be relative or absolute. For example, to generate a listing to the file
List.lstin the directory..\listings\:iccriscv prog.c -l ..\listings\List.lstFor options that take a filename as the destination for output, the parameter can be specified as a path without a specified filename. The compiler stores the output in that directory, in a file with an extension according to the option. The filename will be the same as the name of the compiled source file, unless a different name was specified with the option
-o, in which case that name is used. For example:iccriscv prog.c -l ..\listings\The produced list file will have the default name
..\listings\prog.lstThe current directory is specified with a period (
.). For example:iccriscv prog.c -l ./can be used instead of\as the directory delimiter.By specifying
-, input files and output files can be redirected to the standard input and output stream, respectively. For example:iccriscv prog.c -l -
Additional rules
These rules also apply:
When an option takes a parameter, the parameter cannot start with a dash (-) followed by another character. Instead, you can prefix the parameter with two dashes—this example will create a list file called
-r:iccriscv prog.c -l ‑‑-rFor options that accept multiple arguments of the same type, the arguments can be provided as a comma-separated list (without a space), for example:
‑‑diag_warning=Be0001,Be0002
Alternatively, the option can be repeated for each argument, for example:
‑‑diag_warning=Be0001 ‑‑diag_warning=Be0002