diff options
Diffstat (limited to 'scripts/kconfig/expr.c')
-rw-r--r-- | scripts/kconfig/expr.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index e1a39e90841d..77ffff3a053c 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c | |||
@@ -1,8 +1,10 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | 3 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> |
3 | * Released under the terms of the GNU GPL v2.0. | ||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <ctype.h> | ||
7 | #include <errno.h> | ||
6 | #include <stdio.h> | 8 | #include <stdio.h> |
7 | #include <stdlib.h> | 9 | #include <stdlib.h> |
8 | #include <string.h> | 10 | #include <string.h> |
@@ -980,7 +982,6 @@ enum string_value_kind { | |||
980 | k_string, | 982 | k_string, |
981 | k_signed, | 983 | k_signed, |
982 | k_unsigned, | 984 | k_unsigned, |
983 | k_invalid | ||
984 | }; | 985 | }; |
985 | 986 | ||
986 | union string_value { | 987 | union string_value { |
@@ -1011,13 +1012,10 @@ static enum string_value_kind expr_parse_string(const char *str, | |||
1011 | val->u = strtoull(str, &tail, 16); | 1012 | val->u = strtoull(str, &tail, 16); |
1012 | kind = k_unsigned; | 1013 | kind = k_unsigned; |
1013 | break; | 1014 | break; |
1014 | case S_STRING: | 1015 | default: |
1015 | case S_UNKNOWN: | ||
1016 | val->s = strtoll(str, &tail, 0); | 1016 | val->s = strtoll(str, &tail, 0); |
1017 | kind = k_signed; | 1017 | kind = k_signed; |
1018 | break; | 1018 | break; |
1019 | default: | ||
1020 | return k_invalid; | ||
1021 | } | 1019 | } |
1022 | return !errno && !*tail && tail > str && isxdigit(tail[-1]) | 1020 | return !errno && !*tail && tail > str && isxdigit(tail[-1]) |
1023 | ? kind : k_string; | 1021 | ? kind : k_string; |
@@ -1073,13 +1071,7 @@ tristate expr_calc_value(struct expr *e) | |||
1073 | 1071 | ||
1074 | if (k1 == k_string || k2 == k_string) | 1072 | if (k1 == k_string || k2 == k_string) |
1075 | res = strcmp(str1, str2); | 1073 | res = strcmp(str1, str2); |
1076 | else if (k1 == k_invalid || k2 == k_invalid) { | 1074 | else if (k1 == k_unsigned || k2 == k_unsigned) |
1077 | if (e->type != E_EQUAL && e->type != E_UNEQUAL) { | ||
1078 | printf("Cannot compare \"%s\" and \"%s\"\n", str1, str2); | ||
1079 | return no; | ||
1080 | } | ||
1081 | res = strcmp(str1, str2); | ||
1082 | } else if (k1 == k_unsigned || k2 == k_unsigned) | ||
1083 | res = (lval.u > rval.u) - (lval.u < rval.u); | 1075 | res = (lval.u > rval.u) - (lval.u < rval.u); |
1084 | else /* if (k1 == k_signed && k2 == k_signed) */ | 1076 | else /* if (k1 == k_signed && k2 == k_signed) */ |
1085 | res = (lval.s > rval.s) - (lval.s < rval.s); | 1077 | res = (lval.s > rval.s) - (lval.s < rval.s); |