X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=main.c;h=a103a6028ec79c0540bd7a6e5fc507028c2a0bbd;hb=f9b99f31447f156dd8f835ab26573da2722d81a0;hp=b13751865b393df8a1c8484c8cbb9132ade3a1fe;hpb=865258432a1a335a2858b74e07e3e2c69db025af;p=cparser diff --git a/main.c b/main.c index b137518..a103a60 100644 --- a/main.c +++ b/main.c @@ -114,6 +114,9 @@ bool strict_mode = false; /** use builtins for some libc functions */ bool use_builtins = false; +/** we have extern function with const attribute. */ +bool have_const_functions = false; + /* to switch on printing of implicit casts */ extern bool print_implicit_casts; @@ -567,7 +570,7 @@ int main(int argc, char **argv) default: case 4: set_option("strict-aliasing"); - use_builtins = true; + /* use_builtins = true; */ /* fallthrough */ case 3: set_option("cond-eval"); @@ -1065,12 +1068,6 @@ int main(int argc, char **argv) /* preprocess and compile */ if (filetype == FILETYPE_PREPROCESSED_C) { translation_unit_t *const unit = do_parsing(in, filename); - if (in == preprocessed_in) { - int pp_result = pclose(preprocessed_in); - if (pp_result != EXIT_SUCCESS) { - exit(EXIT_FAILURE); - } - } /* prints the AST even if errors occurred */ if (mode == PrintAst) { @@ -1089,6 +1086,13 @@ int main(int argc, char **argv) fprintf(stderr, "%u warning(s)\n", warning_count); } + if (in == preprocessed_in) { + int pp_result = pclose(preprocessed_in); + if (pp_result != EXIT_SUCCESS) { + exit(EXIT_FAILURE); + } + } + if(mode == BenchmarkParser) { return result; } else if(mode == PrintFluffy) { @@ -1131,7 +1135,7 @@ int main(int argc, char **argv) } gen_firm_finish(asm_out, filename, /*c_mode=*/1, - /*firm_const_exists=*/0); + have_const_functions); if (asm_out != out) { fclose(asm_out); }