mirror of
https://github.com/mirror/make.git
synced 2024-12-26 04:40:16 +08:00
* src/warning.h: Put warnings into alphabetical order.
* src/warning.c: Ditto. * tests/scripts/options/warn: Fix tests for the new order.
This commit is contained in:
parent
a9e3eb1eec
commit
69038e62e0
@ -32,10 +32,10 @@ static struct warning_data warn_flag;
|
||||
|
||||
static const char *w_action_map[w_error+1] = {NULL, "ignore", "warn", "error"};
|
||||
static const char *w_name_map[wt_max] = {
|
||||
"invalid-var",
|
||||
"circular-dep",
|
||||
"invalid-ref",
|
||||
"undefined-var",
|
||||
"circular-dep"
|
||||
"invalid-var",
|
||||
"undefined-var"
|
||||
};
|
||||
|
||||
#define encode_warn_action(_b,_s) \
|
||||
@ -64,10 +64,10 @@ warn_init ()
|
||||
|
||||
/* All warnings must have a default. */
|
||||
warn_default.global = w_warn;
|
||||
warn_default.actions[wt_invalid_var] = w_warn;
|
||||
warn_default.actions[wt_invalid_ref] = w_warn;
|
||||
warn_default.actions[wt_undefined_var] = w_ignore;
|
||||
warn_default.actions[wt_circular_dep] = w_warn;
|
||||
warn_default.actions[wt_invalid_ref] = w_warn;
|
||||
warn_default.actions[wt_invalid_var] = w_warn;
|
||||
warn_default.actions[wt_undefined_var] = w_ignore;
|
||||
|
||||
set_warnings ();
|
||||
}
|
||||
@ -76,7 +76,7 @@ static void
|
||||
init_data (struct warning_data *data)
|
||||
{
|
||||
data->global = w_unset;
|
||||
for (enum warning_type wt = wt_invalid_var; wt < wt_max; ++wt)
|
||||
for (enum warning_type wt = 0; wt < wt_max; ++wt)
|
||||
data->actions[wt] = w_unset;
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ decode_warn_action (const char *action, size_t length)
|
||||
static enum warning_type
|
||||
decode_warn_name (const char *name, size_t length)
|
||||
{
|
||||
for (enum warning_type wt = wt_invalid_var; wt < wt_max; ++wt)
|
||||
for (enum warning_type wt = 0; wt < wt_max; ++wt)
|
||||
{
|
||||
size_t len = strlen (w_name_map[wt]);
|
||||
if (length == len && strncasecmp (name, w_name_map[wt], length) == 0)
|
||||
|
@ -14,17 +14,18 @@ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Types of warnings we can show. */
|
||||
/* Types of warnings we can show.
|
||||
These can be rearranged but the first value must be 0. */
|
||||
enum warning_type
|
||||
{
|
||||
wt_invalid_var = 0, /* Assign to an invalid variable name. */
|
||||
wt_invalid_ref, /* Reference an invalid variable name. */
|
||||
wt_undefined_var, /* Reference an undefined variable name. */
|
||||
wt_circular_dep, /* A target depends on itself. */
|
||||
wt_circular_dep = 0, /* A target depends on itself. */
|
||||
wt_invalid_ref, /* Reference an invalid variable name. */
|
||||
wt_invalid_var, /* Assign to an invalid variable name. */
|
||||
wt_undefined_var, /* Reference an undefined variable name. */
|
||||
wt_max
|
||||
};
|
||||
|
||||
/* Action taken for a given warning. */
|
||||
/* Action taken for a given warning. Unset must be 0. */
|
||||
enum warning_action
|
||||
{
|
||||
w_unset = 0,
|
||||
|
@ -5,8 +5,8 @@ $description = "Test the --warn option.";
|
||||
my %warn_test = (
|
||||
'--warn' => '', '--warn=warn' => '', '--warn=error --warn=warn' => '',
|
||||
'--warn --warn=error' => '=error',
|
||||
'--warn=ignore --warn=error --warn=ignore --warn=invalid-var,invalid-ref,undefined-var' => '=ignore,invalid-var,invalid-ref,undefined-var',
|
||||
'--warn=invalid-ref:ignore --warn=error --warn=invalid-var:warn,,,,,undefined-var:error,,,,,' => '=error,invalid-var,invalid-ref:ignore,undefined-var:error'
|
||||
'--warn=ignore --warn=error --warn=ignore --warn=invalid-ref,invalid-var,undefined-var' => '=ignore,invalid-ref,invalid-var,undefined-var',
|
||||
'--warn=invalid-ref:ignore --warn=error --warn=invalid-var:warn,,,,,undefined-var:error,,,,,' => '=error,invalid-ref:ignore,invalid-var,undefined-var:error'
|
||||
);
|
||||
|
||||
# Verify the deprecated --warn-undefined-variables option
|
||||
|
Loading…
Reference in New Issue
Block a user