Extensions for GNU C compatibility

The following feature is enabled by default at all language levels:

Table 1. Default IBM XL C extensions for GNU C compatibility
Language feature Discussed in:
#include_next preprocessor directive The #include_next directive (IBM extension)
The following features are enabled by default when you compile with any of the following commands:
  • the xlc invocation command
  • the -qlanglvl=extc99 | extc89 | extended options
Table 2. Default IBM XL C extensions for GNU C compatibility
Language feature Discussed in:
__alignof__ operator The __alignof__ operator (IBM extension)
__extension__ keyword Keywords for language extensions (IBM extension)
__imag__ and __real__ complex type operators The __real__ and __imag__ operators (IBM extension)
__inline__ function specifier The inline function specifier
__typeof__ operator The typeof operator (IBM extension)
#assert, #unassert preprocessor directives Assertion directives (IBM extension)
#warning preprocessor directive The #warning directive (IBM extension)
asm labels Assembly labels (IBM extension)
Alternate keywords Keywords for language extensions (IBM extension)
Cast to a union type Cast to union type (C only) (IBM extension)
Complex literal suffixes Complex literals
Complex type arguments to unary operators Unary expressions
Computed goto statements Computed goto statement (IBM extension)
Function attributes Function attributes (IBM extension)
Global register variables Variables in specified registers (IBM extension)
Initialization of static variables by compound literals Compound literal expressions
Labels as values Labels as values (IBM extension)
Locally declared labels Locally declared labels (IBM extension)
Generalized lvalues Lvalues and rvalues
Nested functions Nested functions (IBM extension)
Placement of flexible array members anywhere in structure or union Flexible array members
Statements and declarations in expressions Statement expressions (IBM extension)
Static initialization of flexible array members of aggregates Flexible array members
Type attributes Type attributes (IBM extension)
Variable attributes Variable attributes (IBM extension)
Variadic macro extensions Variadic macro extensions(IBM extension)
Zero-extent arrays Zero-extent array members (IBM extension)
The following features are enabled by default when you compile with any of the following commands:
  • the xlc invocation command
  • the -qlanglvl=extc99 | extc89 | extended options
They are also enabled or disabled by specific compiler options, which are listed in the below table:
Table 3. IBM XL C extensions for GNU C compatibility with individual option controls
Language feature Discussed in: Individual option controls
asm, and __asm keywords Assembly labels (IBM extension), Inline assembly statements (IBM extension) -qkeyword=asm, -qasm
asm inline assembly-language statements Inline assembly statements (IBM extension) -qasm
Visibility function attribute visibility (IBM extension) -qvisibility
Visibility variable attribute The visibility variable attribute (IBM extension) -qvisibility
Note: You can use the -qvisibility option to specify visibility attributes for variables and functions if they do not get visibility attributes from pragma directives, explicitly specified attributes, or propagation rules. This option cannot be used to disable visibility attributes for variables or functions.
The following features require compilation with the use of an additional option:
Table 4. IBM XL C extensions for GNU C compatibility, requiring additional compiler options
Language feature Discussed in: Required compilation option
The __thread storage class specifier The __thread storage class specifier (IBM extension) -qtls
Dollar signs in identifiers Characters in identifiers -qdollar
The typeof keyword The typeof operator (IBM extension) -qkeyword=typeof