Skip to content

Progress

bigconvience edited this page Feb 17, 2023 · 2 revisions

C11(N1570) Language support

Expressions

  1. Primary expressions
  • identifier
  • constant
  • string-literal
  • ( expression )
  • generic-seletion
  1. Postfix operators
  • Array subscripting
  • Function calls
  • [] Structure and union members
  • Postfix increment and decrement operators
  • [] Compound literals
  1. Unary operators
  • Prefix increment and decrement operators
  • Address and indirection operators
  • Unary arithmetic operators: & * + - ~ !
  • The sizeof and _Alignof operators
  1. Binary operators
  • Cast operators
  • Multiplicative operators: * / %
  • Additive operators: + -
  • Bitwise shift operators: << >>
  • Relational operators: < <= > >=
  • Equality operators: == !=
  • Bitwise AND operator: &
  • Bitwise exclusive OR operator: ^
  • Bitwise inclusive OR operator: |
  • Logical AND operator: &&
  • Logical OR operator: ||
  1. Conditional operator
  • conditional-expression: ? :
  1. Assignment operators
  • Simple assignment: =
  • Compound assignment: *= /= %= += -= <<= >>= &= ^= |=
  1. Comma operator
  • ( , )

Declarations

Storage-class specifiers

  • typedef
  • [] extern
  • static
  • [] _Thread_local
  • [] auto
  • [] register

Type specifiers

  • [] void
  • char
  • short
  • int
  • long
  • float
  • double
  • signed
  • unsigned
  • _Bool
  • [] _Complex
  • [] atomic-type-specifier
  • [] struct-or-union-specifier
  • enum-specifier
  • [] typedef-name

Type qualifiers

  • [*] const
  • [] restrict
  • [] volatile
  • [] Atomic

Function specifiers

  • [] inline
  • [] _Noreturn

Alignment specifier

  • _Alignas ( type-name )
  • _Alignas ( type-name )

Declarators

Pointer declarators

  • *** type-qualifier-listopt
  • [] *** type-qualifier-listopt pointer

Array declarators

  • direct-declarator [ type-qualifier-listopt assignment-expressionopt ]
  • [] direct-declarator [ static type-qualifier-listopt assignment-expression ]
  • [] direct-declarator [ type-qualifier-list static assignment-expression ]
  • [] direct-declarator [ type-qualifier-listopt *** ]

Function declarators (including prototypes)

  • direct-declarator ( parameter-type-list )
  • [] direct-declarator ( parameter-type-list, ... )
  • direct-declarator ( identifier-listopt )

Initialization

  • assignment-expression
  • { initializer-list , [ constant-expression ] = initializer }
  • { initializer-list , [ . identifier ] = initializer }

Static assertions

-[] _Static_assert ( constant-expression , string-literal ) ;

Statements and blocks

  • Labeled statements
  • Compound statement
  • Expression and null statements
  • If statement
  • Switch statement
  • While statement
  • Do statement
  • For statement
  • Goto statement
  • Continue statement
  • Break statement
  • Return statement

External definitions

  1. Function definitions

  2. External object definitions

GNU C extensions support

  • Statements and Declarations in Expressions
  • Conditionals with Omitted Operands
  • Case Ranges

References

N1570 cppreference GUN C extensions chibicc TinyCC

chibicc test case passed

  • [] alignof.c
  • alloca.c
  • arith.c
  • [] asm.c
  • [] atomic.c
  • [] function.c
  • generic.c
  • pointer.c
  • variable.c
  • [] vla.c