Language Extensions
CScout implements the
C language as defined in ANSI X3.159-1989.
In addition, it supports the following extensions:
- Preprocessor directives can appear within a call to a function-like macro (gcc)
- Initializers and compound literals can be empty (gcc)
- The
alignof operator can be used on types (gcc)
- A declaration expression as the first element of a
for statement (C99)
- The
restrict qualifier and the inline specifier (C99)
- The
_Bool type (C99)
- The
_Thread_local storage class specifier (C11)
- The
_Generic generic selection expression (C11)
- Support
static and other qualifiers in array type declarations (C99)
- Initialization designators (C99)
- Array initialization designators can include ranges (gcc)
- ANSI-style function definitions can be nested (gcc) (gcc also allows
nested K&R-style function definitions)
- The equals sign following an initializer designator is optional (gcc)
- Array and structure initialization (gcc)
- Compound literals (C99)
- Declarations can be intermixed with statements (C99).
- Recognise
__atribute__(__unused__) for determining which
identifiers should not be reported as unused (gcc).
-
// line comments (common extension)
-
__asm__ blocks (gcc)
-
enum lists ending with a comma (common extension)
- Anonymous
struct/union members (gcc, Microsoft C)
- Allow
case expression ranges (gcc).
- An enumeration list can be empty (Microsoft C)
- Allow braces around scalar initializers (common extension).
- Indirect
goto targets and the label address-of operator (gcc).
-
__typeof keyword (gcc)
- The ‘##’ token paste operator deletes the comma when placed between a comma and an empty variable argument (gcc)
-
__VA_OPT__ function macro (C23)
- A compound statement in brackets can be an expression (gcc)
- Macros expanding from
/##/ into
// are then treated as a line comment (Microsoft C)
- Exception handling using the
__try __except __finally __leave keywords (Microsoft C)
-
#include_next preprocessor directive (gcc)
-
#warning preprocessor directive (gcc)
- Variable number of arguments preprocessor macros
(support for both the gcc and the C99 syntax)
- Allow empty member declarations in aggregates (gcc)
-
long long type (common extension)
- A semicolon can appear as a declatation (common extension)
- An aggregate declaration body can be empty (gcc)
- Aggregate member initialization using the member: value syntax (gcc)
- Statement labels do not require a statement following them (gcc)
- #ident preprocessor directive (gcc)
- Allow assignment to case expressions (common extension)
- Accept an empty translation unit (common extension).
- Support locally declared labels (
__label__) (gcc).
- The second argument of a conditional expression can be omitted (gcc).
- Dereferencing a function yields a function (common extension).
Many other compiler-specific extensions are handled by suitable
macro definitions in the
CScout initialization file.