cex: rename -Wcounterexample as -Wcounterexamples, and support -Wcex

Plural vs. singular is always a problem...

But we already have conflicts-sr and conflicts-rr, so counterexamples
makes more sense than counterexample.  Besides, -Wcounterexample will
still be accepted as an unambiguous prefix of -Wcounterexamples.

Add -Wcex as a convenient alias.

While at it, use only "counterexample", never "counter example".

* src/complain.h, src/complain.c
(Wcounterexample, warning_counterexample): Rename as...
(Wcounterexamples, warning_counterexamples): these.
(argmatch_warning_docs): Rename -Wcounterexample as -Wcounterexamples.
(argmatch_warning_args): Likewise.
Add support for -Wcex.
Adjust dependencies.
This commit is contained in:
Akim Demaille
2020-06-10 07:35:47 +02:00
parent a53c6026cd
commit d2acc4b401
6 changed files with 22 additions and 22 deletions

View File

@@ -114,7 +114,7 @@ static const argmatch_warning_doc argmatch_warning_docs[] =
{
{ "conflicts-sr", N_("S/R conflicts (enabled by default)") },
{ "conflicts-rr", N_("R/R conflicts (enabled by default)") },
{ "counterexample", N_("Conflict counter examples") },
{ "counterexamples", N_("generate conflict counterexamples") },
{ "dangling-alias", N_("string aliases not attached to a symbol") },
{ "deprecated", N_("obsolete constructs") },
{ "empty-rule", N_("empty rules without %empty") },
@@ -122,7 +122,7 @@ static const argmatch_warning_doc argmatch_warning_docs[] =
{ "precedence", N_("useless precedence and associativity") },
{ "yacc", N_("incompatibilities with POSIX Yacc") },
{ "other", N_("all other warnings (enabled by default)") },
{ "all", N_("all the warnings except 'dangling-alias' and 'yacc'") },
{ "all", N_("all the warnings except 'counterexamples', 'dangling-alias' and 'yacc'") },
{ "no-CATEGORY", N_("turn off warnings in CATEGORY") },
{ "none", N_("turn off all the warnings") },
{ "error[=CATEGORY]", N_("treat warnings as errors") },
@@ -131,19 +131,19 @@ static const argmatch_warning_doc argmatch_warning_docs[] =
static const argmatch_warning_arg argmatch_warning_args[] =
{
{ "all", Wall },
{ "conflicts-rr", Wconflicts_rr },
{ "conflicts-sr", Wconflicts_sr },
{ "counterexample", Wcounterexample },
{ "dangling-alias", Wdangling_alias },
{ "deprecated", Wdeprecated },
{ "empty-rule", Wempty_rule },
{ "everything", Weverything },
{ "midrule-values", Wmidrule_values },
{ "none", Wnone },
{ "other", Wother },
{ "precedence", Wprecedence },
{ "yacc", Wyacc },
{ "all", Wall },
{ "conflicts-rr", Wconflicts_rr },
{ "conflicts-sr", Wconflicts_sr },
{ "counterexamples", Wcounterexamples }, { "cex", Wcounterexamples }, // Show cex second.
{ "dangling-alias", Wdangling_alias },
{ "deprecated", Wdeprecated },
{ "empty-rule", Wempty_rule },
{ "everything", Weverything },
{ "midrule-values", Wmidrule_values },
{ "none", Wnone },
{ "other", Wother },
{ "precedence", Wprecedence },
{ "yacc", Wyacc },
{ NULL, Wnone }
};

View File

@@ -46,7 +46,7 @@ typedef enum
{
warning_conflicts_rr,
warning_conflicts_sr,
warning_counterexample,
warning_counterexamples,
warning_dangling_alias,
warning_deprecated,
warning_empty_rule,
@@ -107,7 +107,7 @@ typedef enum
Wconflicts_rr = 1 << warning_conflicts_rr,
Wconflicts_sr = 1 << warning_conflicts_sr,
Wcounterexample = 1 << warning_counterexample,
Wcounterexamples = 1 << warning_counterexamples,
Wdangling_alias = 1 << warning_dangling_alias,
Wdeprecated = 1 << warning_deprecated,
Wempty_rule = 1 << warning_empty_rule,
@@ -124,7 +124,7 @@ typedef enum
/**< All above warnings. */
Weverything = ~complaint & ~fatal & ~silent,
Wall = Weverything & ~Wcounterexample & ~Wdangling_alias & ~Wyacc
Wall = Weverything & ~Wcounterexamples & ~Wdangling_alias & ~Wyacc
} warnings;
/** Whether the warnings of \a flags are all unset.

View File

@@ -723,7 +723,7 @@ rule_conflicts_print (void)
r->code, rr, expected_rr);
}
}
if (warning_is_enabled (Wcounterexample))
if (warning_is_enabled (Wcounterexamples))
report_counterexamples ();
}

View File

@@ -1036,7 +1036,7 @@ generate_next_states (search_state *ss, state_item *conflict1,
}
/*
* Perform the actual counter example search,
* Perform the actual counterexample search,
* keeps track of what stage of the search algorithm
* we are at and gives the appropriate counterexample
* type based off of time constraints.

View File

@@ -145,7 +145,7 @@ main (int argc, char *argv[])
conflicts_update_state_numbers (old_to_new, nstates_old);
free (old_to_new);
}
if (warning_is_enabled (Wcounterexample))
if (warning_is_enabled (Wcounterexamples))
counterexample_init ();
conflicts_print ();
timevar_pop (tv_conflicts);

View File

@@ -21,7 +21,7 @@ m4_define([AT_BISON_CHECK_CEX],
[AT_DATA([experr], [$4])
sed -e ['s/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g'] \
experr >expout
AT_BISON_CHECK([-Wcounterexample $1], [$2], [$3], [stderr])
AT_BISON_CHECK([-Wcounterexamples $1], [$2], [$3], [stderr])
AT_CHECK([[sed -e 's/time limit exceeded: [0-9][.0-9]*/time limit exceeded: XXX/g' stderr]],
[], [expout])
])