In this small course, you learn about command line options and how they are handled in GCC.

List of GCC courses in the series

Options handling

GCC has an unfied handling of options in that the driver, and all front-ends share the same command line options handling code. For an example, if you add an option to the backend, it will automatically be supported by each front-end; there is no need to modify any other code.

GCC internals manual Options section The GCC internals manual documents the options format but it does not describe why you might want to add an option or which .opt file to edit.

Warnings options

Use them with warning{,at} function

GCC diagnostic functions, warning{,at} accept as their first argument an OPT_* integer. This allows you not to condition the code directly on the warning variable. It also allows for the diagnostic part to turn it maybe into an error or not warn depending on the #pragma GCC diagnostic user input.

Optimization options

Target options

How To Add an option

target specific

language specific

generic option

None: GCC102Option (last edited 2026-01-21 15:02:32 by DavidMalcolm)