summaryrefslogtreecommitdiff
path: root/source/compiler/aslfileio.c
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2015-06-16 19:48:16 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2015-06-16 19:48:16 +0000
commit8811b910b092027f905013bced1da3e87c6b07b9 (patch)
treeb0c56a23f2d8877b9431deb3cab73df3c1913fb7 /source/compiler/aslfileio.c
parent0c85196b0c51b4e5eba8fcace026f947f9112c9e (diff)
Notes
Diffstat (limited to 'source/compiler/aslfileio.c')
-rw-r--r--source/compiler/aslfileio.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/source/compiler/aslfileio.c b/source/compiler/aslfileio.c
index c7d398d8423a..4db97a67358a 100644
--- a/source/compiler/aslfileio.c
+++ b/source/compiler/aslfileio.c
@@ -218,6 +218,19 @@ FlWriteFile (
FlFileError (FileId, ASL_MSG_WRITE);
AslAbort ();
}
+
+ if ((FileId == ASL_FILE_PREPROCESSOR) && Gbl_PreprocessorOutputFlag)
+ {
+ /* Duplicate the output to the user preprocessor (.i) file */
+
+ Actual = fwrite ((char *) Buffer, 1, Length,
+ Gbl_Files[ASL_FILE_PREPROCESSOR_USER].Handle);
+ if (Actual != Length)
+ {
+ FlFileError (FileId, ASL_MSG_WRITE);
+ AslAbort ();
+ }
+ }
}
@@ -247,7 +260,6 @@ FlPrintFile (
va_start (Args, Format);
-
Actual = vfprintf (Gbl_Files[FileId].Handle, Format, Args);
va_end (Args);
@@ -256,6 +268,30 @@ FlPrintFile (
FlFileError (FileId, ASL_MSG_WRITE);
AslAbort ();
}
+
+ if ((FileId == ASL_FILE_PREPROCESSOR) && Gbl_PreprocessorOutputFlag)
+ {
+ /*
+ * Duplicate the output to the user preprocessor (.i) file,
+ * except: no #line directives.
+ */
+ if (!strncmp (Format, "#line", 5))
+ {
+ return;
+ }
+
+ va_start (Args, Format);
+ Actual = vfprintf (Gbl_Files[ASL_FILE_PREPROCESSOR_USER].Handle,
+ Format, Args);
+ va_end (Args);
+
+ if (Actual == -1)
+ {
+ FlFileError (FileId, ASL_MSG_WRITE);
+ AslAbort ();
+ }
+ }
+
}