CFLAGS += -Wall -W -Wstrict-prototypes -Wmissing-prototypes -Werror -std=c99 -pedantic
CFLAGS += -O0 -g3
-ICC_CFLAGS = -O0 -g3 -std=c99 -Wall -Werror
#CFLAGS += -O3 -march=pentium4 -fomit-frame-pointer -DNDEBUG
+#CFLAGS += -pg -O3 -fno-inline
+ICC_CFLAGS = -O0 -g3 -std=c99 -Wall -Werror
+LFLAGS += -pg
ICC ?= true
GCCO1 ?= true
[EXPR_BINARY_ISLESSGREATER] = PREC_PRIM,
[EXPR_BINARY_ISUNORDERED] = PREC_PRIM
};
-#ifndef NDEBUG
- if ((unsigned)kind >= (sizeof(prec)/sizeof(prec[0]))) {
- panic("wrong expression kind");
- }
+ assert((unsigned)kind < (sizeof(prec)/sizeof(prec[0])));
unsigned res = prec[kind];
- if (res == PREC_BOTTOM) {
- panic("expression kind not defined in get_expression_precedence()");
- }
-#endif
+
+ assert(res != PREC_BOTTOM);
return res;
}
case EXPR_UNARY_BITFIELD_EXTRACT:
struct scope_t {
- declaration_t *declarations; /**< List of declarations in this scope. */
+ declaration_t *declarations; /**< List of declarations in this scope. */
+ declaration_t *last_declaration;
};
struct expression_base_t {
}
typedef enum compile_mode_t {
+ BenchmarkParser,
ParseOnly,
Compile,
CompileDump,
strict_mode = true;
} else if(strcmp(option, "lextest") == 0) {
mode = LexTest;
+ } else if(strcmp(option, "benchmark") == 0) {
+ mode = BenchmarkParser;
} else if(strcmp(option, "print-ast") == 0) {
mode = PrintAst;
} else if(strcmp(option, "print-implicit-cast") == 0) {
char outnamebuf[4096];
if(outname == NULL) {
switch(mode) {
+ case BenchmarkParser:
case PrintAst:
case PrintFluffy:
case LexTest:
fprintf(stderr, "%u warning(s)\n", warning_count);
}
+ if(mode == BenchmarkParser) {
+ return 0;
+ }
+
if(mode == PrintAst) {
type_set_output(out);
ast_set_output(out);
static void set_scope(scope_t *new_scope)
{
+ if(scope != NULL) {
+ scope->last_declaration = last_declaration;
+ }
scope = new_scope;
- last_declaration = new_scope->declarations;
- if(last_declaration != NULL) {
- while(last_declaration->next != NULL) {
- last_declaration = last_declaration->next;
- }
- }
+ last_declaration = new_scope->last_declaration;
}
/**
assert(type1->kind == TYPE_POINTER);
assert(type2->kind == TYPE_POINTER);
+ (void) type1;
+ (void) type2;
/* TODO */
return true;
}