5.1.5 Options concerning the sources (language options)

For more information on these options, see Programmer’s Guide

-Mmode
Set language mode to mode, which can be one of the following:
delphi
Try to be Delphi compatible. This is more strict than the objfpc mode, since some Free Pascal extensions are switched off.
fpc
Free Pascal dialect (default).
macpas
Try to be compatible with Macintosh Pascal dialects.
objfpc
Switch on some Delphi extensions. This is different from Delphi mode, because some Free Pascal constructs are still available.
tp
Try to be TP/BP 7.0 compatible. This means no function overloading etc.
ISO
In this mode, the compiler complies with the requirements of level 0 of ISO/IEC 7185.
-Mfeature
Select language feature feature. As of FPC version 2.3.1, the -M command line switch can be used to select individual language features. In that case, feature is one of the following keywords:
CLASS
Use object pascal classes.
OBJPAS
Automatically include the ObjPas unit.
RESULT
Enable the Result identifier for function results.
PCHARTOSTRING
Allow automatic conversion of null-terminated strings to strings,
CVAR
Allow the use of the CVAR keyword.
NESTEDCOMMENTS
Allow use of nested comments.
CLASSICPROCVARS
Use classical procedural variables.
MACPROCVARS
Use mac-style procedural variables.
REPEATFORWARD
Implementation and Forward declaration must match completely.
POINTERTOPROCVAR
Allow silent conversion of pointers to procedural variables.
AUTODEREF
Automatic (silent) dereferencing of typed pointers.
INITFINAL
Allow use of Initialization and Finalization
ANSISTRINGS
Allow use of ansistrings.
OUT
Allow use of the out parameter type.
DEFAULTPARAMETERS
Allow use of default parameter values.
HINTDIRECTIVE
Support the hint directives (deprecated, platform etc.)
DUPLICATELOCALS
Allow method arguments with the same name as properties in classes.
PROPERTIES
Allow use of global properties.
ALLOWINLINE
Allow inline procedures.
EXCEPTIONS
Allow the use of exceptions.
OBJECTIVEC1
Allow the use of objective C version 1.
OBJECTIVEC2
Allow the use of objective C version 2.
NESTEDPROCVARS
Allow assigning local procedures to nested procedural variables and defining inline procedural variable types, which can always accept local procedures, in parameter declarations.
NONLOCALGOTO
Allow a GOTO statement to jump outside the local scope (as ISO Pascal).
ADVANCEDRECORDS
Allow the use of advanced records (records with methods/properties)
ISOUNARYMINUS
Treat unary minus like in ISO Pascal: same precedence level as binary minus/plus.

The keyword can be followed by a plus or minus sign to enable or disable the feature. Note that the order of mode and feature switches is important, a mode switch resets the feature list to the default features for that mode.

-Rxxx
Specify what kind of assembler you use in your asm assembler code blocks. Here xxx is one of the following:
att 
asm blocks contain AT&T-style assembler. This is the default style.
intel
asm blocks contain Intel-style assembler.
default
Use the default assembler for the specified target.
-S2
Switch on Delphi 2 extensions (objfpc mode). Deprecated, use -Mobjfpc instead.
-Sa
Include assert statements in compiled code. Omitting this option will cause assert statements to be ignored.
-Sc
Support C-style operators, i.e. *=, +=, /= and -=.
-Sd
Try to be Delphi compatible. Deprecated, use -Mdelphi instead.
-SeN
The compiler stops after the N-th error. Normally, the compiler tries to continue compiling after an error, until 50 errors are reached, or a fatal error is reached, and then it stops. With this switch, the compiler will stop after the N-th error (if N is omitted, a default of 1 is assumed). Instead of a number, one of n, h or w can also be specified. In that case the compiler will consider notes, hints or warnings as errors and stop when one is encountered.
-Sf
Enable certain features in compiler and RTL. This allows for finer control over available language features than the mode switch. Possible values are:
HEAP
Allow heap memory.
INITFINAL
Initialization/finalization.
RTTI
Allow use of RTTI.
CLASSES
Allow use of classes.
EXCEPTIONS
Allow use of exceptions.
EXITCODE
Allow use of exit code for applications.
ANSISTRINGS
Allow use of ansistrings.
WIDESTRINGS
Allow use of widestrings.
TEXTIO
Allow use of standard Pascal text file I/O.
CONSOLEIO
Allow use of standard Pascal console I/O (text file).
FILEIO
Allow use of standard Pascal binary file I/O.
RANDOM
Allow use of Random() function.
VARIANTS
Allow use of variants.
OBJECTS
Allow use of TP-style objects.
DYNARRAYS
Allow use of dynamic arrays.
THREADING
Allow use of threading.
COMMANDARGS
Allow use of command-line arguments.
PROCESSES
Allow use of processes.
STACKCHECK
Enable stack checking.
DYNLIBS
Allow use of dynamically loadable libraries in the system unit.
SOFTFPU
Allow (enable) the use of software floating point operations.
OBJECTIVEC1
Allow use of Objective C support routines.
RESOURCES
Allow use of resources.
UNICODESTRING
Allow use of unicode strings.
-Sg
Support the label and goto commands. By default these are not supported. You must also specify this option if you use labels in assembler statements. (if you use the AT&T style assembler)
-Sh
Use ansistrings by default for strings. If this option is specified, the compiler will interpret the string keyword as an ansistring. Otherwise it is supposed to be a shortstring (TP style).
-Si
Support C++ style INLINE.
-SIXXX
Set interfaces style to XXX. Here XXX is one of
COM
COM compatible interfaces (reference counted, descend from IUnknown).
CORBA
Not reference counted interfaces.
-Sk
Load the Kylix compatibility unit (fpcylix).
-Sm
Support C-style macros.
-So
Try to be Borland TP 7.0 compatible. Deprecated, use -Mtp instead.
-Ss
The name of constructors must be init, and the name of destructors should be done.
-St
Allow the static keyword in objects. This flag is obsolete since Free Pascal 2.6.0.
-Sv
Support vector processing (uses CPU vector extensions if available)
-Sx
Enable exception keywords (default in Delphi/Objfpc mode). This will mark all exception related keywords as keywords, also in Turbo Pascal or FPC mode. This can be used to check for code which should be mode-neutral as much as possible.
-Sy
@pointer returns a typed pointer, this is the same as the $T+ option.
-Un
Do not check the unit name. Normally, the unit name is the same as the filename. This option allows them to be different.
-Us
Compile a system unit. This option causes the compiler to define only some very basic types.