coan 4.2.4
|
![]() |
Modules | |
The Contradiction component interface | |
The Contradiction component internals | |
Files | |
file | contradiction.h |
This component handles contradictions between commandline -D or -U options and in-source #define or #undef directives, e.g. where -DSYM[=VAL] is a coimmandline option and an in-source #undef SYM is parsed, or #define SYM OTHERVAL is parsed.
An in-source directive that contradictions a commandline option is dealt with according to the operative --conflict policy.
A complication arises from the undesirability of diagnosing a contradiction in cases where -DSYM[=VAL] is a commandline option and then an in-source #undef SYM is parsed that is followed with no intervening directives by #define SYM [VAL], i.e. the contradictory #undef is a precautionary prologue to defining the symbol in a way that concurs with the commandline option.
To avoid complaining in these cases, we need to record and save a diagnostic when we parse the contradictory #undef and then either discard the diagnostic if the next directive is a #define that echoes the commandline option, or emit the diagnostic otherwise.
Accommodating this complication accounts for most of the code in the module.