summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2023-04-03 07:58:46 -0400
committerPaul Smith <psmith@gnu.org>2023-04-03 08:05:54 -0400
commit6cf6311332342cf045b716c93cc3dcd7ab877adc (patch)
tree4089b856e2ac1980f4d93f1a9d64014ea53dfdd9
parentc4329fb9531d75f627a02636d1347726f911ab01 (diff)
downloadmake-git-6cf6311332342cf045b716c93cc3dcd7ab877adc.tar.gz
* src/warnings.c (decode_warn_actions): [SV 63990] Handle errors
-rw-r--r--src/warning.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/src/warning.c b/src/warning.c
index c295fdc7..8cf9fff8 100644
--- a/src/warning.c
+++ b/src/warning.c
@@ -136,35 +136,39 @@ decode_warn_actions (const char *value, const floc *flocp)
{
enum warning_type type;
const char *cp = memchr (value, ':', ep - value);
+ int wl, al;
+
if (!cp)
cp = ep;
- type = decode_warn_name (value, cp - value);
+ wl = (int)(cp - value);
+ type = decode_warn_name (value, wl);
+ if (cp == ep)
+ action = w_warn;
+ else
+ {
+ /* There's a warning action: decode it. */
+ ++cp;
+ al = (int)(ep - cp);
+ action = decode_warn_action (cp, al);
+ }
+
if (type == wt_max)
{
- int l = (int)(cp - value);
if (!flocp)
- ONS (fatal, NILF, _("unknown warning '%.*s'"), l, value);
+ ONS (fatal, NILF, _("unknown warning '%.*s'"), wl, value);
ONS (error, flocp,
- _("unknown warning '%.*s': ignored"), l, value);
+ _("unknown warning '%.*s': ignored"), wl, value);
}
-
- /* If there's a warning action, decode it. */
- if (cp == ep)
- action = w_warn;
- else
+ else if (action == w_unset)
{
- ++cp;
- action = decode_warn_action (cp, ep - cp);
- if (action == w_unset)
- {
- int l = (int)(ep - cp);
- if (!flocp)
- ONS (fatal, NILF, _("unknown warning action '%.*s'"), l, cp);
- ONS (error, flocp,
- _("unknown warning action '%.*s': ignored"), l, cp);
- }
+ if (!flocp)
+ ONS (fatal, NILF,
+ _("unknown warning action '%.*s'"), al, cp);
+ ONS (error, flocp,
+ _("unknown warning action '%.*s': ignored"), al, cp);
}
- data->actions[type] = action;
+ else
+ data->actions[type] = action;
}
value = ep;