aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/expr.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/expr.c')
-rw-r--r--scripts/kconfig/expr.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index 87238afb21b7..6f98dbfe70cf 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -1013,73 +1013,73 @@ int expr_compare_type(enum expr_type t1, enum expr_type t2)
1013#endif 1013#endif
1014} 1014}
1015 1015
1016void expr_print(struct expr *e, void (*fn)(void *, const char *), void *data, int prevtoken) 1016void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken)
1017{ 1017{
1018 if (!e) { 1018 if (!e) {
1019 fn(data, "y"); 1019 fn(data, NULL, "y");
1020 return; 1020 return;
1021 } 1021 }
1022 1022
1023 if (expr_compare_type(prevtoken, e->type) > 0) 1023 if (expr_compare_type(prevtoken, e->type) > 0)
1024 fn(data, "("); 1024 fn(data, NULL, "(");
1025 switch (e->type) { 1025 switch (e->type) {
1026 case E_SYMBOL: 1026 case E_SYMBOL:
1027 if (e->left.sym->name) 1027 if (e->left.sym->name)
1028 fn(data, e->left.sym->name); 1028 fn(data, e->left.sym, e->left.sym->name);
1029 else 1029 else
1030 fn(data, "<choice>"); 1030 fn(data, NULL, "<choice>");
1031 break; 1031 break;
1032 case E_NOT: 1032 case E_NOT:
1033 fn(data, "!"); 1033 fn(data, NULL, "!");
1034 expr_print(e->left.expr, fn, data, E_NOT); 1034 expr_print(e->left.expr, fn, data, E_NOT);
1035 break; 1035 break;
1036 case E_EQUAL: 1036 case E_EQUAL:
1037 fn(data, e->left.sym->name); 1037 fn(data, e->left.sym, e->left.sym->name);
1038 fn(data, "="); 1038 fn(data, NULL, "=");
1039 fn(data, e->right.sym->name); 1039 fn(data, e->right.sym, e->right.sym->name);
1040 break; 1040 break;
1041 case E_UNEQUAL: 1041 case E_UNEQUAL:
1042 fn(data, e->left.sym->name); 1042 fn(data, e->left.sym, e->left.sym->name);
1043 fn(data, "!="); 1043 fn(data, NULL, "!=");
1044 fn(data, e->right.sym->name); 1044 fn(data, e->right.sym, e->right.sym->name);
1045 break; 1045 break;
1046 case E_OR: 1046 case E_OR:
1047 expr_print(e->left.expr, fn, data, E_OR); 1047 expr_print(e->left.expr, fn, data, E_OR);
1048 fn(data, " || "); 1048 fn(data, NULL, " || ");
1049 expr_print(e->right.expr, fn, data, E_OR); 1049 expr_print(e->right.expr, fn, data, E_OR);
1050 break; 1050 break;
1051 case E_AND: 1051 case E_AND:
1052 expr_print(e->left.expr, fn, data, E_AND); 1052 expr_print(e->left.expr, fn, data, E_AND);
1053 fn(data, " && "); 1053 fn(data, NULL, " && ");
1054 expr_print(e->right.expr, fn, data, E_AND); 1054 expr_print(e->right.expr, fn, data, E_AND);
1055 break; 1055 break;
1056 case E_CHOICE: 1056 case E_CHOICE:
1057 fn(data, e->right.sym->name); 1057 fn(data, e->right.sym, e->right.sym->name);
1058 if (e->left.expr) { 1058 if (e->left.expr) {
1059 fn(data, " ^ "); 1059 fn(data, NULL, " ^ ");
1060 expr_print(e->left.expr, fn, data, E_CHOICE); 1060 expr_print(e->left.expr, fn, data, E_CHOICE);
1061 } 1061 }
1062 break; 1062 break;
1063 case E_RANGE: 1063 case E_RANGE:
1064 fn(data, "["); 1064 fn(data, NULL, "[");
1065 fn(data, e->left.sym->name); 1065 fn(data, e->left.sym, e->left.sym->name);
1066 fn(data, " "); 1066 fn(data, NULL, " ");
1067 fn(data, e->right.sym->name); 1067 fn(data, e->right.sym, e->right.sym->name);
1068 fn(data, "]"); 1068 fn(data, NULL, "]");
1069 break; 1069 break;
1070 default: 1070 default:
1071 { 1071 {
1072 char buf[32]; 1072 char buf[32];
1073 sprintf(buf, "<unknown type %d>", e->type); 1073 sprintf(buf, "<unknown type %d>", e->type);
1074 fn(data, buf); 1074 fn(data, NULL, buf);
1075 break; 1075 break;
1076 } 1076 }
1077 } 1077 }
1078 if (expr_compare_type(prevtoken, e->type) > 0) 1078 if (expr_compare_type(prevtoken, e->type) > 0)
1079 fn(data, ")"); 1079 fn(data, NULL, ")");
1080} 1080}
1081 1081
1082static void expr_print_file_helper(void *data, const char *str) 1082static void expr_print_file_helper(void *data, struct symbol *sym, const char *str)
1083{ 1083{
1084 fwrite(str, strlen(str), 1, data); 1084 fwrite(str, strlen(str), 1, data);
1085} 1085}
@@ -1089,7 +1089,7 @@ void expr_fprint(struct expr *e, FILE *out)
1089 expr_print(e, expr_print_file_helper, out, E_NONE); 1089 expr_print(e, expr_print_file_helper, out, E_NONE);
1090} 1090}
1091 1091
1092static void expr_print_gstr_helper(void *data, const char *str) 1092static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *str)
1093{ 1093{
1094 str_append((struct gstr*)data, str); 1094 str_append((struct gstr*)data, str);
1095} 1095}