From d6f6efa01a516522639de2d82f126233f848fd4a Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Tue, 7 Oct 2008 07:33:26 +0000 Subject: [PATCH] Print AST and error/warning summary even in the presence of preprocessor errors. [r22560] --- main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index 1dd4976..a103a60 100644 --- a/main.c +++ b/main.c @@ -1068,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) { @@ -1092,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) { -- 2.20.1