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 | extc1x | extended options
Table 2. Default IBM XL C extensions for GNU C compatibility
Language feature Discussed in:
__alignof and __alignof__ keywords The __alignof__ operator (IBM extension), Keywords for language extensions (IBM extension)
__align type qualifier The __align type qualifier (IBM extension)
__alignof__ operator The __alignof__ operator (IBM extension)
__attribute and __attribute__ keywords Variable attributes (IBM extension), Function attributes (IBM extension), Keywords for language extensions (IBM extension)
__complex__ keyword Keywords for language extensions (IBM extension)
__extension__ keyword Keywords for language extensions (IBM extension)
__imag__ and__real__ keywords The __real__ and __imag__ operators (IBM extension)Keywords for language extensions (IBM extension)
__imag__ and __real__ complex type operators The __real__ and __imag__ operators (IBM extension)
__inline__ keyword The inline function specifier, Keywords for language extensions (IBM extension)
__label__ keyword Nested functions (C only) (IBM extension), Locally declared labels (IBM extension), Keywords for language extensions (IBM extension)
__restrict and __restrict__ keywords The restrict type qualifier, Keywords for language extensions (IBM extension)
__thread keyword The __thread storage class specifier (IBM extension), Keywords for language extensions (IBM extension)
__typeof__ keyword The typeof operator (IBM extension), Keywords for language extensions (IBM extension)
__typeof__ operator The typeof operator (IBM extension)
#assert, #unassert preprocessor directives Assertion directives (IBM extension)
#warning preprocessor directive The #warning directive (IBM extension)
Alternate keywords Keywords for language extensions (IBM extension)
asm labels Assembly labels (IBM extension)
Cast to a union type Cast to union type (C only) (IBM extension)
Complex literal suffixes Complex literals
Computed goto statements Computed goto statement (IBM extension)
Function attributes Function attributes (IBM extension)
Generalized lvalues Lvalues and rvalues
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)
Linkage of inline functions Linkage of inline functions
Locally declared labels Locally declared labels (IBM extension)
Nested functions Nested functions (C only) (IBM extension)
Placement of flexible array members anywhere in structure or union Flexible array members
Postfix and unary operators on complex types (increment, decrement, and complex conjugation) Increment operator ++, Decrement operator --, Bitwise negation operator ~
Statements and declarations in expressions (statement expressions) Statement expressions (IBM extension)
Static initialization of flexible array members of aggregates Flexible array members
Structures with flexible array members being members of another structure 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 | extc1x | 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), Keywords for language extensions (IBM extension) -q[no]keyword=asm, -qasm
asm inline assembly-language statements Inline assembly statements (IBM extension) -qasm
typeof keyword The typeof operator (IBM extension), Keywords for language extensions (IBM extension) -q[no]keyword=typeof
typeof operator The typeof operator (IBM extension) -q[no]keyword=typeof
Visibility function attribute visibility (IBM extension) -fvisibility (-qvisibility)
Visibility variable attribute The visibility variable attribute (IBM extension) -fvisibility (-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
__thread storage class specifier The __thread storage class specifier (IBM extension) -qtls
Dollar signs in identifiers Characters in identifiers -qdollar


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us