[PATCH 1/2] let handle_switches() also handle reverse logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some flags, for good or less good reasons, exist under two
different names: like a positive version and a negative one.
This is in addition of the 'no-' prefix.

The use case here is '-f[no-][un]signed-char'.

Make it easy and allow to specify that a given flag is the
negative version of another one so that '-fsigned-char' is
handled exactly as '-fno-unsigned-char'.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 lib.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib.c b/lib.c
index e4bb639e5..b018eb972 100644
--- a/lib.c
+++ b/lib.c
@@ -578,6 +578,8 @@ static int handle_switches(const char *ori, const char *opt, const struct flag *
 
 		// boolean flag
 		if (opt[0] == '\0' && flags->flag) {
+			if (flags->mask & OPT_INVERSE)
+				val = !val;
 			*flags->flag = val;
 			return 1;
 		}
-- 
2.15.0

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux