summaryrefslogtreecommitdiff
path: root/src/complain.c
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2019-01-15 21:00:41 +0100
committerAkim Demaille <akim.demaille@gmail.com>2019-01-16 07:59:16 +0100
commit169fe80c7f1f0061bb0ee5b01d35185232045f5d (patch)
tree300957fd7e97d0ef2d1f7d5cc597a7251b422c0a /src/complain.c
parentb7e0d3131d2e0e5a370d3dea4c89958366d59d28 (diff)
downloadbison-169fe80c7f1f0061bb0ee5b01d35185232045f5d.tar.gz
fixits: suggest running --update if there are fixits
* src/fixits.h, src/fixits.c (fixits_empty): New. * src/complain.c (deprecated_directive): Register the Wdeprecated fixits only if -Wdeprecated was enabled, so that we don't apply updates if the user didn't ask for them. * src/main.c (main): If there were fixits, issue a warning suggesting running with --update. Free uniqstrs after the fixits, since the latter use the former. * tests/headers.at, tests/input.at: Update expectations.
Diffstat (limited to 'src/complain.c')
-rw-r--r--src/complain.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/complain.c b/src/complain.c
index b9e832e9..af2d337e 100644
--- a/src/complain.c
+++ b/src/complain.c
@@ -394,7 +394,9 @@ deprecated_directive (location const *loc, char const *old, char const *upd)
complain (loc, Wdeprecated,
_("deprecated directive: %s, use %s"),
quote (old), quote_n (1, upd));
- fixits_register (loc, upd);
+ /* Register updates only if -Wdeprecated is enabled. */
+ if (warnings_flag[warning_deprecated] != severity_disabled)
+ fixits_register (loc, upd);
}
void