coan 4.2.4
|
![]() |
Modules | |
Macro-generated code | |
Files | |
file | contradiction.c |
file | contradiction.h |
Typedefs | |
typedef enum contradiction_policy | contradiction_policy_t |
Enumerations | |
enum | contradiction_policy { CONTRADICTION_DELETE, CONTRADICTION_COMMENT, CONTRADICTION_ERROR } |
Functions | |
void | contradiction_policy (contradiction_policy_t pol) |
void | insert_contradiction (char const *sub_format) |
void | forget_contradiction (void) |
void | flush_contradiction (void) |
void | save_contradiction (char const *sub_format) |
typedef enum contradiction_policy contradiction_policy_t |
Enumeration of policies for handling hash-define or hash-undef directives that conflict with --define
or --undefine
options.
enum contradiction_policy |
Enumeration of policies for handling hash-define or hash-undef directives that conflict with --define
or --undefine
options.
Definition at line 56 of file contradiction.h.
void contradiction_policy | ( | contradiction_policy_t | pol | ) |
Select the policy for handling hash-define or hash-undef directives.
pol | An enumerated constant that represents the selected policy. |
The policy is set in accordance with the --conflict
option.
Definition at line 236 of file contradiction.c.
References CONTRADICTION_COMMENT, CONTRADICTION_DELETE, CONTRADICTION_ERROR, GRIPE_COMMENTED_CONTRADICTION, GRIPE_DELETED_CONTRADICTION, GRIPE_ERRORED_CONTRADICTION, and SET_STATE.
void flush_contradiction | ( | void | ) |
When we have dropped an hash-undef directive that conflicts with a --define
option, and the conflict is not annulled by a following hash-define, we have a pending diagnostic action to discharge. It will consist of writing a warning to stderr, unless warnings are suppressed, and inserting a diagnostic comment or hash-error in the output, unless the --conflict
policy is delete
.
This function discharges the pending action.
Definition at line 260 of file contradiction.c.
References ERR_MSG_BUF, GET_STATE, and insert_pending_contradiction().
Referenced by eval_line(), symbol_define(), and symbol_undefine().
void forget_contradiction | ( | void | ) |
Forget about an apparent conflict that would be governed by the --conflict
policy when later input shows it to be innocuous.
This function copes with the complication created by the common precautionary idioms:
hash-undef FOO
hash-define FOO
and:
hash-undef FOO
hash-define FOO XYZ
This input may be encountered when FOO
is the subject of a --define
option. In this case the precautionary hash-undef FOO will at first appear to conflict with that --define
, but the ensuing hash-define will show that the conflict is only apparent.
To cope with these cases, we defer diagnostic action on the hash-undef until we see what follows. If a hash-define follows that agrees with the --define
options, with only whitespace and comments intervening, then we forget about the pending contradiction. This function clears the pending diagnostic action.
--conflict
policies will require it either to be simply dropped, or else dropped and replaced with a diagnostic insertion. If the hash-undef is anulled by a following hash-define, then both will be dropped because the hash-define in isolation would be dropped. Definition at line 268 of file contradiction.c.
References forget_pending_contradiction(), GET_STATE, MSGCLASS_WARNING, OUT_MSG_BUF, and set_exit_flags().
Referenced by eval_line(), and symbol_define().
void insert_contradiction | ( | char const * | sub_format | ) |
Insert an error diagnostic into the output as an hash-error directive or a comment (depending on the --conflict
policy) to replace an hash-undef directive that conflicts with a --define
option. Reiterate the diagnostic on stderr.
sub_format | A printf format with which to compose the appropriate diagnostic. Varies depending on whether we want to complain of an hash-undef that contradicts a --define option, or of a hash-define that conflicts with a --define option by differently redfining a symbol. |
Definition at line 228 of file contradiction.c.
References insert_pending_contradiction(), and save_contradiction().
Referenced by symbol_define().
void save_contradiction | ( | char const * | sub_format | ) |
When an hash-undef directive is read that conflicts with a --define
option, we will diagnose a conflict if the hash-undef is not followed by a hash-define that agrees with the conflicting --define
.
sub_format | A printf format with which to compose the appropriate diaqnostic diagnostic. |
This function saves the diagnostic information pending our decision whether to use it or forget it.
Definition at line 279 of file contradiction.c.
References compose_contradiction_insert_format(), ERR_MSG_BUF, flatten_line(), format_output(), get_exit_flags(), GET_PUBLIC, GET_STATE, line_len(), MSGCLASS_WARNING, OUT_MSG_BUF, report(), and SET_STATE.
Referenced by insert_contradiction(), and symbol_undefine().