summaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/expr.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-12-29 16:03:29 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-12-29 16:03:29 -0500
commit769e47094dcc0ddc8fe8e04c13565a71134ec1a2 (patch)
treeaaf8201e1bef3ca7cb317624661b63e9f8355cc7 /scripts/kconfig/expr.c
parent668c35f69cc750aaf07bd5fe7710a47e2aed6e43 (diff)
parentf222b7f43661c3dddd44ee493c16e04e8f231542 (diff)
Merge tag 'kconfig-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kconfig updates from Masahiro Yamada: - support -y option for merge_config.sh to avoid downgrading =y to =m - remove S_OTHER symbol type, and touch include/config/*.h files correctly - fix file name and line number in lexer warnings - fix memory leak when EOF is encountered in quotation - resolve all shift/reduce conflicts of the parser - warn no new line at end of file - make 'source' statement more strict to take only string literal - rewrite the lexer and remove the keyword lookup table - convert to SPDX License Identifier - compile C files independently instead of including them from zconf.y - fix various warnings of gconfig - misc cleanups * tag 'kconfig-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (39 commits) kconfig: surround dbg_sym_flags with #ifdef DEBUG to fix gconf warning kconfig: split images.c out of qconf.cc/gconf.c to fix gconf warnings kconfig: add static qualifiers to fix gconf warnings kconfig: split the lexer out of zconf.y kconfig: split some C files out of zconf.y kconfig: convert to SPDX License Identifier kconfig: remove keyword lookup table entirely kconfig: update current_pos in the second lexer kconfig: switch to ASSIGN_VAL state in the second lexer kconfig: stop associating kconf_id with yylval kconfig: refactor end token rules kconfig: stop supporting '.' and '/' in unquoted words treewide: surround Kconfig file paths with double quotes microblaze: surround string default in Kconfig with double quotes kconfig: use T_WORD instead of T_VARIABLE for variables kconfig: use specific tokens instead of T_ASSIGN for assignments kconfig: refactor scanning and parsing "option" properties kconfig: use distinct tokens for type and default properties kconfig: remove redundant token defines kconfig: rename depends_list to comment_option_list ...
Diffstat (limited to 'scripts/kconfig/expr.c')
-rw-r--r--scripts/kconfig/expr.c18
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
986union string_value { 987union 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);