aboutsummaryrefslogtreecommitdiff
path: root/source/compiler/aslfiles.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/compiler/aslfiles.c')
-rw-r--r--source/compiler/aslfiles.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c
index de8e1cab39b5..947e465fe35a 100644
--- a/source/compiler/aslfiles.c
+++ b/source/compiler/aslfiles.c
@@ -49,9 +49,10 @@
/* Local prototypes */
-FILE *
+static FILE *
FlOpenIncludeWithPrefix (
char *PrefixDir,
+ ACPI_PARSE_OBJECT *Op,
char *Filename);
@@ -294,9 +295,10 @@ ConvertBackslashes:
*
******************************************************************************/
-FILE *
+static FILE *
FlOpenIncludeWithPrefix (
char *PrefixDir,
+ ACPI_PARSE_OBJECT *Op,
char *Filename)
{
FILE *IncludeFile;
@@ -320,6 +322,26 @@ FlOpenIncludeWithPrefix (
return (NULL);
}
+#ifdef _MUST_HANDLE_COMMENTS
+ /*
+ * Check entire include file for any # preprocessor directives.
+ * This is because there may be some confusion between the #include
+ * preprocessor directive and the ASL Include statement.
+ */
+ while (fgets (Gbl_CurrentLineBuffer, Gbl_LineBufferSize, IncludeFile))
+ {
+ if (Gbl_CurrentLineBuffer[0] == '#')
+ {
+ AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE,
+ Op, "use #include instead");
+ }
+ }
+#endif
+
+ /* Must seek back to the start of the file */
+
+ fseek (IncludeFile, 0, SEEK_SET);
+
/* Push the include file on the open input file stack */
AslPushInputFileStack (IncludeFile, Pathname);
@@ -376,7 +398,7 @@ FlOpenIncludeFile (
(Op->Asl.Value.String[0] == '\\') ||
(Op->Asl.Value.String[1] == ':'))
{
- IncludeFile = FlOpenIncludeWithPrefix ("", Op->Asl.Value.String);
+ IncludeFile = FlOpenIncludeWithPrefix ("", Op, Op->Asl.Value.String);
if (!IncludeFile)
{
goto ErrorExit;
@@ -392,7 +414,7 @@ FlOpenIncludeFile (
*
* Construct the file pathname from the global directory name.
*/
- IncludeFile = FlOpenIncludeWithPrefix (Gbl_DirectoryPath, Op->Asl.Value.String);
+ IncludeFile = FlOpenIncludeWithPrefix (Gbl_DirectoryPath, Op, Op->Asl.Value.String);
if (IncludeFile)
{
return;
@@ -405,7 +427,7 @@ FlOpenIncludeFile (
NextDir = Gbl_IncludeDirList;
while (NextDir)
{
- IncludeFile = FlOpenIncludeWithPrefix (NextDir->Dir, Op->Asl.Value.String);
+ IncludeFile = FlOpenIncludeWithPrefix (NextDir->Dir, Op, Op->Asl.Value.String);
if (IncludeFile)
{
return;