aboutsummaryrefslogtreecommitdiff
path: root/gas/cond.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2022-05-18 09:36:00 +0200
committerJan Beulich <jbeulich@suse.com>2022-05-18 09:36:00 +0200
commit2e55c34282273f69099bf90bc6d2f38959545e10 (patch)
tree3e09030de3af9b63e2f43c6c975b9e04ea83401a /gas/cond.c
parent818432e841552c2271861200e39ef1f877751ecc (diff)
downloadgdb-2e55c34282273f69099bf90bc6d2f38959545e10.zip
gdb-2e55c34282273f69099bf90bc6d2f38959545e10.tar.gz
gdb-2e55c34282273f69099bf90bc6d2f38959545e10.tar.bz2
gas: simplify ignore_input()
First of all convert to switch(), in preparation of adding another directive here which may not be ignored. While doing so drop dead code: A string the first two characters of which do not match "if" also wont match "ifdef" or "ifndef".
Diffstat (limited to 'gas/cond.c')
-rw-r--r--gas/cond.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/gas/cond.c b/gas/cond.c
index b6e538a..ee441e1 100644
--- a/gas/cond.c
+++ b/gas/cond.c
@@ -513,17 +513,19 @@ ignore_input (void)
}
/* We cannot ignore certain pseudo ops. */
- if (((s[0] == 'i'
- || s[0] == 'I')
- && (!strncasecmp (s, "if", 2)
- || !strncasecmp (s, "ifdef", 5)
- || !strncasecmp (s, "ifndef", 6)))
- || ((s[0] == 'e'
- || s[0] == 'E')
- && (!strncasecmp (s, "else", 4)
- || !strncasecmp (s, "endif", 5)
- || !strncasecmp (s, "endc", 4))))
- return 0;
+ switch (s[0])
+ {
+ case 'i': case 'I':
+ if (s[1] == 'f' || s[1] == 'F')
+ return 0;
+ break;
+ case 'e': case 'E':
+ if (!strncasecmp (s, "else", 4)
+ || !strncasecmp (s, "endif", 5)
+ || !strncasecmp (s, "endc", 4))
+ return 0;
+ break;
+ }
return (current_cframe != NULL) && (current_cframe->ignoring);
}