iASL: emit error on unresolved external when compiling multiple tables

This error is added because this can lead to unresolved references
during table load and control method execution. This warning helps
the user detect these issues during compilation rather than runtime.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
This commit is contained in:
Erik Schmauss 2019-03-01 23:59:58 -08:00
parent 7586a625f9
commit 8c7e732f98
3 changed files with 21 additions and 1 deletions

View File

@ -363,7 +363,8 @@ const char *AslCompilerMsgs [] =
/* ASL_MSG_PREFIX_NOT_EXIST */ "One or more prefix Scopes do not exist",
/* ASL_MSG_NAMEPATH_NOT_EXIST */ "One or more objects within the Pathname do not exist",
/* ASL_MSG_REGION_LENGTH */ "Operation Region declared with zero length",
/* ASL_MSG_TEMPORARY_OBJECT */ "Object is created temporarily in another method and cannot be accessed"
/* ASL_MSG_TEMPORARY_OBJECT */ "Object is created temporarily in another method and cannot be accessed",
/* ASL_MSG_UNDEFINED_EXTERNAL */ "Named object was declared external but the actual definition does not exist"
};
/* Table compiler */

View File

@ -366,6 +366,7 @@ typedef enum
ASL_MSG_NAMEPATH_NOT_EXIST,
ASL_MSG_REGION_LENGTH,
ASL_MSG_TEMPORARY_OBJECT,
ASL_MSG_UNDEFINED_EXTERNAL,
/* These messages are used by the Data Table compiler only */

View File

@ -1185,6 +1185,24 @@ XfNamespaceLocateBegin (
}
}
/*
* 5) Check for external resolution
* By this point, everything should be loaded in the namespace. If a
* namespace lookup results in a namespace node that is an external, it
* means that this named object was not defined in the input ASL. This
* causes issues because there are plenty of incidents where developers
* use the external keyword to suppress compiler errors about undefined
* objects. Note: this only applies when compiling multiple definition
* blocks.
*/
if (AslGbl_ParseTreeRoot->Asl.Child && AslGbl_ParseTreeRoot->Asl.Child->Asl.Next &&
(Op->Asl.ParseOpcode != PARSEOP_EXTERNAL &&
Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_EXTERNAL) &&
(Node->Flags & ANOBJ_IS_EXTERNAL))
{
AslError (ASL_ERROR, ASL_MSG_UNDEFINED_EXTERNAL, Op, NULL);
}
/* 5) Check for a connection object */
#if 0
else if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONNECTION)