summaryrefslogtreecommitdiff
path: root/source/compiler/aslcompile.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/compiler/aslcompile.c')
-rw-r--r--source/compiler/aslcompile.c42
1 files changed, 36 insertions, 6 deletions
diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c
index 8f16bf3547f2..6c368a098980 100644
--- a/source/compiler/aslcompile.c
+++ b/source/compiler/aslcompile.c
@@ -457,6 +457,17 @@ CmDoCompile (
Event = UtBeginEvent ("Open input and output files");
UtEndEvent (Event);
+ /* Preprocessor */
+
+ Event = UtBeginEvent ("Preprocess input file");
+ PrDoPreprocess ();
+ UtEndEvent (Event);
+ if (Gbl_PreprocessOnly)
+ {
+ CmCleanupAndExit ();
+ return 0;
+ }
+
/* Build the parse tree */
Event = UtBeginEvent ("Parse source code and build parse tree");
@@ -474,8 +485,7 @@ CmDoCompile (
{
AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL,
NULL, "- Could not resolve parse tree root node");
- CmCleanupAndExit ();
- return -1;
+ goto ErrorExit;
}
/* Optional parse tree dump, compiler debug output only */
@@ -508,12 +518,12 @@ CmDoCompile (
*/
Event = UtBeginEvent ("Open AML output file");
Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix);
+ UtEndEvent (Event);
if (ACPI_FAILURE (Status))
{
AePrintErrorLog (ASL_FILE_STDERR);
return -1;
}
- UtEndEvent (Event);
/* Interpret and generate all compile-time constants */
@@ -552,6 +562,7 @@ CmDoCompile (
AePrintErrorLog (ASL_FILE_STDERR);
UtDisplaySummary (ASL_FILE_STDERR);
}
+ UtEndEvent (FullCompile);
return 0;
}
@@ -566,7 +577,7 @@ CmDoCompile (
UtEndEvent (Event);
if (ACPI_FAILURE (Status))
{
- return -1;
+ goto ErrorExit;
}
/* Namespace cross-reference */
@@ -575,7 +586,7 @@ CmDoCompile (
Status = LkCrossReferenceNamespace ();
if (ACPI_FAILURE (Status))
{
- return -1;
+ goto ErrorExit;
}
/* Namespace - Check for non-referenced objects */
@@ -646,6 +657,11 @@ CmDoCompile (
UtEndEvent (FullCompile);
CmCleanupAndExit ();
return 0;
+
+ErrorExit:
+ UtEndEvent (FullCompile);
+ CmCleanupAndExit ();
+ return (-1);
}
@@ -799,7 +815,9 @@ CmCleanupAndExit (
/* Close all open files */
- for (i = 2; i < ASL_MAX_FILE_TYPE; i++)
+ Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .i file is same as source file */
+
+ for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++)
{
FlCloseFile (i);
}
@@ -817,6 +835,18 @@ CmCleanupAndExit (
}
}
+ /* Delete the preprocessor output file (.i) unless -li flag is set */
+
+ if (!Gbl_PreprocessorOutputFlag && Gbl_Files[ASL_FILE_PREPROCESSOR].Filename)
+ {
+ if (remove (Gbl_Files[ASL_FILE_PREPROCESSOR].Filename))
+ {
+ printf ("%s: ",
+ Gbl_Files[ASL_FILE_PREPROCESSOR].Filename);
+ perror ("Could not delete preprocessor .i file");
+ }
+ }
+
/*
* Delete intermediate ("combined") source file (if -ls flag not set)
* This file is created during normal ASL/AML compiles. It is not