Abstract-syntax-purep
Definition of the predicates that check whether
the abstract syntax is pure, i.e. without side effects.
We use fty::deffold-reduce to define these predicates concisely.
We use t as :default because
non-recursive constructs (e.g. variables, constants) tend to be pure.
The :combine operator is and,
because we need to check all sub-expressions.
We generate predicates for the unary and binary operators
so that they are automatically used in unary and binary expressions.
We exclude assignments as well as pre/post increment/decrement.
We generate predicates for expressions and related entities,
but not for function definitions, external declarations, etc.,
because the notion of purity does not really apply to them.
We conservatively exclude function calls,
even though, depending on the called function,
the call may be actually free of side effects.
But this requires a more complicated analysis.
We exclude structure, union, and enumeration specifiers,
which may bring new types into existence.
We exclude (parameter and plain) declarations,
which may bring new entities into existence.
This implies that block items that are declarations are excluded too.
We exclude assembler statements,
because they may have side effects.
Subtopics
- Exprs/decls/stmts-purep
- Binop-purep
- Unop-purep
- Typequal/attribspec-list-purep
- Typequal/attribspec-list-list-purep
- Typequal/attribspec-purep
- Struni-spec-purep
- Struct-declor-purep
- Struct-declor-list-purep
- Struct-declon-purep
- Struct-declon-list-purep
- Statassert-purep
- Spec/qual-purep
- Spec/qual-list-purep
- Param-declor-purep
- Param-declon-purep
- Param-declon-list-purep
- Member-designor-purep
- Initer-option-purep
- Initdeclor-purep
- Initdeclor-list-purep
- Genassoc-list-purep
- Expr-option-purep
- Enumer-list-purep
- Dirabsdeclor-purep
- Dirabsdeclor-option-purep
- Desiniter-list-purep
- Designor-list-purep
- Declor-option-purep
- Decl-spec-list-purep
- Const-expr-purep
- Const-expr-option-purep
- Block-item-purep
- Block-item-list-purep
- Attrib-spec-purep
- Attrib-spec-list-purep
- Attrib-list-purep
- Asm-output-purep
- Asm-output-list-purep
- Asm-input-list-purep
- Amb-expr/tyname-purep
- Amb-decl/stmt-purep
- Amb-declor/absdeclor-purep
- Align-spec-purep
- Absdeclor-option-purep
- Type-spec-purep
- Tyname-purep
- Stmt-purep
- Label-purep
- Initer-purep
- Genassoc-purep
- Expr-purep
- Expr-list-purep
- Enumer-purep
- Enum-spec-purep
- Dirdeclor-purep
- Desiniter-purep
- Designor-purep
- Declor-purep
- Decl-spec-purep
- Decl-purep
- Decl-list-purep
- Comp-stmt-purep
- Attrib-purep
- Asm-stmt-purep
- Asm-input-purep
- Absdeclor-purep