Print AST and error/warning summary even in the presence of preprocessor errors.
authorChristoph Mallon <christoph.mallon@gmx.de>
Tue, 7 Oct 2008 07:33:26 +0000 (07:33 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Tue, 7 Oct 2008 07:33:26 +0000 (07:33 +0000)
[r22560]

main.c

diff --git a/main.c b/main.c
index 1dd4976..a103a60 100644 (file)
--- 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) {