aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-12-17 06:44:48 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-07-02 18:42:06 +0200
commit851b48b8129bcb763447b908b0793b2782987441 (patch)
tree7eed9cf5c0c9604f1050c8ddf29d4c7bc102f2d2
parent60ffe1dd0fd4c982addde1dfa9c2452cecafe59b (diff)
downloadsparse-851b48b8129bcb763447b908b0793b2782987441.tar.gz
options: move -Wsparse-all's processing out of handle_onoff_switch()
Since handle_onoff_switch() can be used for other flags than the warnings, the processing of -Wsparse-all should move elsewhere. So move it into handle_switch_W(). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--lib.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib.c b/lib.c
index 709dd517..5128a5b6 100644
--- a/lib.c
+++ b/lib.c
@@ -535,14 +535,6 @@ static char **handle_onoff_switch(char *arg, char **next, const struct flag warn
char *p = arg + 1;
unsigned i;
- if (!strcmp(p, "sparse-all")) {
- for (i = 0; warnings[i].name; i++) {
- if (*warnings[i].flag != WARNING_FORCE_OFF && warnings[i].flag != &Wsparse_error)
- *warnings[i].flag = WARNING_ON;
- }
- return NULL;
- }
-
// Prefixes "no" and "no-" mean to turn warning off.
if (p[0] == 'n' && p[1] == 'o') {
p += 2;
@@ -798,6 +790,14 @@ static char **handle_switch_W(char *arg, char **next)
if (ret)
return ret;
+ if (!strcmp(arg, "Wsparse-all")) {
+ int i;
+ for (i = 0; warnings[i].name; i++) {
+ if (*warnings[i].flag != WARNING_FORCE_OFF && warnings[i].flag != &Wsparse_error)
+ *warnings[i].flag = WARNING_ON;
+ }
+ }
+
// Unknown.
return next;
}