Next: @filename arguments, Up: Mmc arguments [Contents][Index]
The Mercury compiler follows the usual conventions around options. (Some of its options (e.g. ‘-c’, ‘-o’, and ‘-I’) have a similar meaning to that in compilers for other languages, though of course most are specific to Mercury.)
Like most other Unix programs, it supports both short (single-character) and long option names.
On command lines, an option argument that starts with ‘--’ specifies a single long option. while an option argument that starts with only a single ‘-’ specifies one or more short options. For example, ‘-v’ asks the compiler to be verbose, printing a message each time it starts a new phase of the compilation process, while ‘-w’ asks it not to print any warnings.
Some options do not take arguments (we call such flags), while some do. Single-letter flags may be grouped with a single ‘-’, so that e.g. users can ask for both verbose output and no warnings either by giving each short option in separate arguments, as in ‘-v -w’, or by giving them together in one argument, as in ‘-vw’. This cannot be done with long option names: a single argument can specify just one long option name.
All options that have a short name have a long name as well, and it does not matter which one is used. For example, ‘-v’ is interchangeable with ‘--verbose’, and ‘-w’ is interchangeable with ‘--inhibit-warnings"’.
In addition, many options have two or more long names. There are two common reasons for these synonyms. The reason why the option ‘intermodule-optimization’ can also be specified as ‘intermodule-optimisation’ is to allow users to choose either American or British spelling as they wish. And the reason why that same option can also be specified as ‘intermod-opt’ is to reduce the amount of typing required.
Flag options specify a boolean value: they either ask for something specific to be done, or they ask for that specific something not to be done. Single-letter flags may be negated by appending a trailing ‘-’ after the short option name, as in e.g. ‘-v-’. (You cannot both group and negate single-letter flags at the same time.) Long flags may be negated by preceding them with ‘no-’, as in e.g. ‘--no-verbose’.
Other options specify integer or string values. For these options, the value can be specified in the same argument as the option name, following it immediately (if the option name is a short name), or separate from it by an equal sign (if the option name is a long name). Or it can be in the next argument. For example, the requested optimization level, which is an integer, can be specified as either as ‘-O3’ or as ‘-O 3’, using the short name of that option, or as ‘--optimization-level=3’ or as ‘--optimization-level 3’ using the long name of that option. The name of the color scheme to be used for diagnostics, which a string, can be specified either as ‘--color-scheme=light16’ or as ‘--color-scheme light16’.
Some options specify an optional integer or string value. For example, you can specify the maximum line width as ‘--max-error-line-width=71’, or you can ask line widths to be unlimited with a ‘no-’ prefix instead of a value, as in ‘--no-max-error-line-width’,
Some options let users specify a list of strings, one string at a time, with each occurrence of the option adding one string to the end of the list. For example, the options ‘--search-directory=foo --search-directory=bar’ tell the compiler to the list of directories to be searched when looking for e.g. interface files Interface files. (The default value of that lists consists of just the current directory.) Negating the option name, e.g. with ‘--no-search-directory’, clears the list, i.e. sets it to the empty list.
All option names, both short and long, are case-sensitive. For example, the meanings of ‘-e’ and ‘-E’ are totally unrelated.
Next: @filename arguments, Up: Mmc arguments [Contents][Index]