Commit a72c5f31 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] config: disable debug prints

From: Roman Zippel <zippel@linux-m68k.org>

This disables some debug prints, which are more confusing than helpful for
normal users.
parent 86b5b992
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#define LKC_DIRECT_LINK #define LKC_DIRECT_LINK
#include "lkc.h" #include "lkc.h"
#define DEBUG_EXPR 0
struct expr *expr_alloc_symbol(struct symbol *sym) struct expr *expr_alloc_symbol(struct symbol *sym)
{ {
struct expr *e = malloc(sizeof(*e)); struct expr *e = malloc(sizeof(*e));
...@@ -220,10 +222,12 @@ int expr_eq(struct expr *e1, struct expr *e2) ...@@ -220,10 +222,12 @@ int expr_eq(struct expr *e1, struct expr *e2)
/* panic */; /* panic */;
} }
print_expr(0, e1, 0); if (DEBUG_EXPR) {
expr_fprint(e1, stdout);
printf(" = "); printf(" = ");
print_expr(0, e2, 0); expr_fprint(e2, stdout);
printf(" ?\n"); printf(" ?\n");
}
return 0; return 0;
} }
...@@ -397,11 +401,13 @@ struct expr *expr_join_or(struct expr *e1, struct expr *e2) ...@@ -397,11 +401,13 @@ struct expr *expr_join_or(struct expr *e1, struct expr *e2)
return expr_alloc_symbol(&symbol_yes); return expr_alloc_symbol(&symbol_yes);
} }
printf("optimize "); if (DEBUG_EXPR) {
print_expr(0, e1, 0); printf("optimize (");
printf(" || "); expr_fprint(e1, stdout);
print_expr(0, e2, 0); printf(") || (");
printf(" ?\n"); expr_fprint(e2, stdout);
printf(")?\n");
}
return NULL; return NULL;
} }
...@@ -444,6 +450,11 @@ struct expr *expr_join_and(struct expr *e1, struct expr *e2) ...@@ -444,6 +450,11 @@ struct expr *expr_join_and(struct expr *e1, struct expr *e2)
// (a) && (a!='n') -> (a) // (a) && (a!='n') -> (a)
return expr_alloc_symbol(sym1); 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 (sym1->type == S_TRISTATE) {
if (e1->type == E_EQUAL && e2->type == E_UNEQUAL) { if (e1->type == E_EQUAL && e2->type == E_UNEQUAL) {
// (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b' // (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b'
...@@ -483,11 +494,14 @@ struct expr *expr_join_and(struct expr *e1, struct expr *e2) ...@@ -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)) (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_yes))
return NULL; return NULL;
} }
printf("optimize ");
print_expr(0, e1, 0); if (DEBUG_EXPR) {
printf(" && "); printf("optimize (");
print_expr(0, e2, 0); expr_fprint(e1, stdout);
printf(" ?\n"); printf(") && (");
expr_fprint(e2, stdout);
printf(")?\n");
}
return NULL; return NULL;
} }
...@@ -1073,11 +1087,3 @@ void expr_fprint(struct expr *e, FILE *out) ...@@ -1073,11 +1087,3 @@ void expr_fprint(struct expr *e, FILE *out)
{ {
expr_print(e, expr_print_file_helper, out, E_NONE); 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);
}
...@@ -174,7 +174,6 @@ void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, s ...@@ -174,7 +174,6 @@ void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, s
struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym); struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym);
void expr_fprint(struct expr *e, FILE *out); void expr_fprint(struct expr *e, FILE *out);
void print_expr(int mask, struct expr *e, int prevtoken);
static inline int expr_is_yes(struct expr *e) static inline int expr_is_yes(struct expr *e)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment