summaryrefslogtreecommitdiff
path: root/extra/config/expr.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-07-15 05:54:13 +0000
committerEric Andersen <andersen@codepoet.org>2004-07-15 05:54:13 +0000
commit6c2efd66d94ce13ac5b70aefd71cf2e66f4acbdf (patch)
tree4614629205be8798da130da69d369387d093ce38 /extra/config/expr.c
parentdb5a9ef35b66e495feb4daf2e9576883dd52926f (diff)
Peter Kjellerstedt at axis.com writes:
Hello, the attached patch should bring extra/config in line with the Linux 2.6.7 sources. The following are the commit messages for the respective files from the Linux bk-repository: checklist.c: * fix menuconfig choice item help display confdata.c: * config: choice fix * kconfig: don't rename target dir when saving config expr.c, expr.h: * config: disable debug prints mconf.c: * fix menuconfig choice item help display menu.c: * Kconfig: use select statements symbol.c: * config: choice fix * Avoid bogus warning about recursive dependencies * c99 struct initialiser conversions textbox.c: * janitor: don't init statics to 0 util.c: * fix lxdialog behaviour //Peter
Diffstat (limited to 'extra/config/expr.c')
-rw-r--r--extra/config/expr.c50
1 files changed, 28 insertions, 22 deletions
diff --git a/extra/config/expr.c b/extra/config/expr.c
index 3f15ae859..10f45232b 100644
--- a/extra/config/expr.c
+++ b/extra/config/expr.c
@@ -10,6 +10,8 @@
#define LKC_DIRECT_LINK
#include "lkc.h"
+#define DEBUG_EXPR 0
+
struct expr *expr_alloc_symbol(struct symbol *sym)
{
struct expr *e = malloc(sizeof(*e));
@@ -220,10 +222,12 @@ int expr_eq(struct expr *e1, struct expr *e2)
/* panic */;
}
- print_expr(0, e1, 0);
- printf(" = ");
- print_expr(0, e2, 0);
- printf(" ?\n");
+ if (DEBUG_EXPR) {
+ expr_fprint(e1, stdout);
+ printf(" = ");
+ expr_fprint(e2, stdout);
+ printf(" ?\n");
+ }
return 0;
}
@@ -397,11 +401,13 @@ struct expr *expr_join_or(struct expr *e1, struct expr *e2)
return expr_alloc_symbol(&symbol_yes);
}
- printf("optimize ");
- print_expr(0, e1, 0);
- printf(" || ");
- print_expr(0, e2, 0);
- printf(" ?\n");
+ if (DEBUG_EXPR) {
+ printf("optimize (");
+ expr_fprint(e1, stdout);
+ printf(") || (");
+ expr_fprint(e2, stdout);
+ printf(")?\n");
+ }
return NULL;
}
@@ -444,6 +450,11 @@ struct expr *expr_join_and(struct expr *e1, struct expr *e2)
// (a) && (a!='n') -> (a)
return expr_alloc_symbol(sym1);
+ if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_mod) ||
+ (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_mod))
+ // (a) && (a!='m') -> (a='y')
+ return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes);
+
if (sym1->type == S_TRISTATE) {
if (e1->type == E_EQUAL && e2->type == E_UNEQUAL) {
// (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b'
@@ -483,11 +494,14 @@ struct expr *expr_join_and(struct expr *e1, struct expr *e2)
(e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_yes))
return NULL;
}
- printf("optimize ");
- print_expr(0, e1, 0);
- printf(" && ");
- print_expr(0, e2, 0);
- printf(" ?\n");
+
+ if (DEBUG_EXPR) {
+ printf("optimize (");
+ expr_fprint(e1, stdout);
+ printf(") && (");
+ expr_fprint(e2, stdout);
+ printf(")?\n");
+ }
return NULL;
}
@@ -1073,11 +1087,3 @@ void expr_fprint(struct expr *e, FILE *out)
{
expr_print(e, expr_print_file_helper, out, E_NONE);
}
-
-void print_expr(int mask, struct expr *e, int prevtoken)
-{
- if (!(cdebug & mask))
- return;
- expr_fprint(e, stdout);
-}
-