summaryrefslogtreecommitdiff
path: root/source/compiler/aslerror.c
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2017-09-29 17:08:30 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2017-09-29 17:08:30 +0000
commit2c673001fb88105f2d160032c4d4b76cb518e37f (patch)
tree3fc3b6aef8822267bd455907a6fce55c3f98b2ed /source/compiler/aslerror.c
parent0810e26699e1b40b9384eca2137be6155de0a5ba (diff)
Notes
Diffstat (limited to 'source/compiler/aslerror.c')
-rw-r--r--source/compiler/aslerror.c794
1 files changed, 510 insertions, 284 deletions
diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c
index 56b5cabb9476..087f06ef10bd 100644
--- a/source/compiler/aslerror.c
+++ b/source/compiler/aslerror.c
@@ -170,6 +170,37 @@ AslIsExceptionDisabled (
UINT8 Level,
UINT16 MessageId);
+static void AslInitEnode (
+ ASL_ERROR_MSG **Enode,
+ UINT8 Level,
+ UINT16 MessageId,
+ UINT32 LineNumber,
+ UINT32 LogicalLineNumber,
+ UINT32 LogicalByteOffset,
+ UINT32 Column,
+ char *Filename,
+ char *Message,
+ char *SourceLine,
+ ASL_ERROR_MSG *SubError);
+
+static void
+AslLogNewError (
+ UINT8 Level,
+ UINT16 MessageId,
+ UINT32 LineNumber,
+ UINT32 LogicalLineNumber,
+ UINT32 LogicalByteOffset,
+ UINT32 Column,
+ char *Filename,
+ char *Message,
+ char *SourceLine,
+ ASL_ERROR_MSG *SubError);
+
+static void
+AePrintSubError (
+ FILE *OutputFile,
+ ASL_ERROR_MSG *Enode);
+
/*******************************************************************************
*
@@ -220,6 +251,7 @@ AeClearErrorLog (
ASL_ERROR_MSG *Enode = Gbl_ErrorLog;
ASL_ERROR_MSG *Next;
+
/* Walk the error node list */
while (Enode)
@@ -270,8 +302,7 @@ AeAddToErrorLog (
Prev = NULL;
Next = Gbl_ErrorLog;
- while ((Next) &&
- (Next->LogicalLineNumber <= Enode->LogicalLineNumber))
+ while ((Next) && (Next->LogicalLineNumber <= Enode->LogicalLineNumber))
{
Prev = Next;
Next = Next->Next;
@@ -294,94 +325,143 @@ AeAddToErrorLog (
/*******************************************************************************
*
- * FUNCTION: AePrintException
+ * FUNCTION: AeDecodeErrorMessageId
*
- * PARAMETERS: FileId - ID of output file
+ * PARAMETERS: OutputFile - Output file
* Enode - Error node to print
- * Header - Additional text before each message
+ * PrematureEOF - True = PrematureEOF has been reached
+ * Total - Total legth of line
*
* RETURN: None
*
- * DESCRIPTION: Print the contents of an error node.
- *
- * NOTE: We don't use the FlxxxFile I/O functions here because on error
- * they abort the compiler and call this function! Since we
- * are reporting errors here, we ignore most output errors and
- * just try to get out as much as we can.
+ * DESCRIPTION: Print the source line of an error.
*
******************************************************************************/
-void
-AePrintException (
- UINT32 FileId,
+static void
+AeDecodeErrorMessageId (
+ FILE *OutputFile,
ASL_ERROR_MSG *Enode,
- char *Header)
+ BOOLEAN PrematureEOF,
+ UINT32 Total)
{
- UINT8 SourceByte;
- int Actual;
- size_t RActual;
UINT32 MsgLength;
const char *MainMessage;
char *ExtraMessage;
UINT32 SourceColumn;
UINT32 ErrorColumn;
- FILE *OutputFile;
- FILE *SourceFile = NULL;
- long FileSize;
- BOOLEAN PrematureEOF = FALSE;
- UINT32 Total = 0;
- if (Gbl_NoErrors)
+ fprintf (OutputFile, "%s %4.4d -",
+ AeDecodeExceptionLevel (Enode->Level),
+ AeBuildFullExceptionCode (Enode->Level, Enode->MessageId));
+
+ MainMessage = AeDecodeMessageId (Enode->MessageId);
+ ExtraMessage = Enode->Message;
+
+ /* If a NULL line number, just print the decoded message */
+
+ if (!Enode->LineNumber)
{
+ fprintf (OutputFile, " %s %s\n\n", MainMessage, ExtraMessage);
return;
}
- /*
- * Only listing files have a header, and remarks/optimizations
- * are always output
- */
- if (!Header)
+ MsgLength = strlen (MainMessage);
+ if (MsgLength == 0)
{
- /* Ignore remarks if requested */
+ /* Use the secondary/extra message as main message */
- switch (Enode->Level)
+ MainMessage = Enode->Message;
+ if (!MainMessage)
{
- case ASL_WARNING:
- case ASL_WARNING2:
- case ASL_WARNING3:
+ MainMessage = "";
+ }
- if (!Gbl_DisplayWarnings)
- {
- return;
- }
- break;
+ MsgLength = strlen (MainMessage);
+ ExtraMessage = NULL;
+ }
- case ASL_REMARK:
+ if (Gbl_VerboseErrors && !PrematureEOF)
+ {
+ if (Total >= 256)
+ {
+ fprintf (OutputFile, " %s",
+ MainMessage);
+ }
+ else
+ {
+ SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2;
+ ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1;
- if (!Gbl_DisplayRemarks)
+ if ((MsgLength + ErrorColumn) < (SourceColumn - 1))
{
- return;
+ fprintf (OutputFile, "%*s%s",
+ (int) ((SourceColumn - 1) - ErrorColumn),
+ MainMessage, " ^ ");
}
- break;
-
- case ASL_OPTIMIZATION:
-
- if (!Gbl_DisplayOptimizations)
+ else
{
- return;
+ fprintf (OutputFile, "%*s %s",
+ (int) ((SourceColumn - ErrorColumn) + 1), "^",
+ MainMessage);
}
- break;
+ }
+ }
+ else
+ {
+ fprintf (OutputFile, " %s", MainMessage);
+ }
- default:
+ /* Print the extra info message if present */
- break;
- }
+ if (ExtraMessage)
+ {
+ fprintf (OutputFile, " (%s)", ExtraMessage);
}
- /* Get the various required file handles */
+ if (PrematureEOF)
+ {
+ fprintf (OutputFile, " and premature End-Of-File");
+ }
+
+ fprintf (OutputFile, "\n");
+ if (Gbl_VerboseErrors && !Enode->SubError)
+ {
+ fprintf (OutputFile, "\n");
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AePrintErrorSourceLine
+ *
+ * PARAMETERS: OutputFile - Output file
+ * Enode - Error node to print
+ * PrematureEOF - True = PrematureEOF has been reached
+ * Total - amount of characters printed so far
+ *
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Print the source line of an error.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AePrintErrorSourceLine (
+ FILE *OutputFile,
+ ASL_ERROR_MSG *Enode,
+ BOOLEAN *PrematureEOF,
+ UINT32 *Total)
+{
+ UINT8 SourceByte;
+ int Actual;
+ size_t RActual;
+ FILE *SourceFile = NULL;
+ long FileSize;
- OutputFile = Gbl_Files[FileId].Handle;
if (!Enode->SourceLine)
{
@@ -404,213 +484,272 @@ AePrintException (
if ((long) Enode->LogicalByteOffset >= FileSize)
{
- PrematureEOF = TRUE;
+ *PrematureEOF = TRUE;
}
}
- }
-
- if (Header)
- {
- fprintf (OutputFile, "%s", Header);
+ else
+ {
+ fprintf (OutputFile,
+ "[*** iASL: Source File Does not exist ***]\n");
+ return AE_IO_ERROR;
+ }
}
/* Print filename and line number if present and valid */
- if (Enode->Filename)
+ if (Gbl_VerboseErrors)
{
- if (Gbl_VerboseErrors)
+ fprintf (OutputFile, "%-8s", Enode->Filename);
+
+ if (Enode->SourceLine && Enode->LineNumber)
+ {
+ fprintf (OutputFile, " %6u: %s",
+ Enode->LineNumber, Enode->SourceLine);
+ }
+ else if (Enode->LineNumber)
{
- fprintf (OutputFile, "%-8s", Enode->Filename);
+ fprintf (OutputFile, " %6u: ", Enode->LineNumber);
- if (Enode->LineNumber)
+ /*
+ * If not at EOF, get the corresponding source code line
+ * and display it. Don't attempt this if we have a
+ * premature EOF condition.
+ */
+ if (*PrematureEOF)
{
- if (Enode->SourceLine)
- {
- fprintf (OutputFile, " %6u: %s",
- Enode->LineNumber, Enode->SourceLine);
- }
- else
+ fprintf (OutputFile, "\n");
+ return AE_OK;
+ }
+ /*
+ * Seek to the offset in the combined source file,
+ * read the source line, and write it to the output.
+ */
+ Actual = fseek (SourceFile,
+ (long) Enode->LogicalByteOffset, (int) SEEK_SET);
+ if (Actual)
+ {
+ fprintf (OutputFile,
+ "[*** iASL: Seek error on source code temp file %s ***]",
+ Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
+
+ fprintf (OutputFile, "\n");
+ return AE_OK;
+ }
+ RActual = fread (&SourceByte, 1, 1, SourceFile);
+ if (RActual != 1)
+ {
+ fprintf (OutputFile,
+ "[*** iASL: Read error on source code temp file %s ***]",
+ Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
+ return AE_IO_ERROR;
+ }
+ /* Read/write the source line, up to the maximum line length */
+
+ while (RActual && SourceByte && (SourceByte != '\n'))
+ {
+ if (*Total < 256)
{
- fprintf (OutputFile, " %6u: ", Enode->LineNumber);
-
- /*
- * If not at EOF, get the corresponding source code line
- * and display it. Don't attempt this if we have a
- * premature EOF condition.
- */
- if (!PrematureEOF)
+ /* After the max line length, we will just read the line, no write */
+
+ if (fwrite (&SourceByte, 1, 1, OutputFile) != 1)
{
- /*
- * Seek to the offset in the combined source file,
- * read the source line, and write it to the output.
- */
- Actual = fseek (SourceFile,
- (long) Enode->LogicalByteOffset, (int) SEEK_SET);
- if (Actual)
- {
- fprintf (OutputFile,
- "[*** iASL: Seek error on source code temp file %s ***]",
- Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
- }
- else
- {
- RActual = fread (&SourceByte, 1, 1, SourceFile);
- if (RActual != 1)
- {
- fprintf (OutputFile,
- "[*** iASL: Read error on source code temp file %s ***]",
- Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
- }
- else
- {
- /* Read/write the source line, up to the maximum line length */
-
- while (RActual && SourceByte && (SourceByte != '\n'))
- {
- if (Total < 256)
- {
- /* After the max line length, we will just read the line, no write */
-
- if (fwrite (&SourceByte, 1, 1, OutputFile) != 1)
- {
- printf ("[*** iASL: Write error on output file ***]\n");
- return;
- }
- }
- else if (Total == 256)
- {
- fprintf (OutputFile,
- "\n[*** iASL: Very long input line, message below refers to column %u ***]",
- Enode->Column);
- }
-
- RActual = fread (&SourceByte, 1, 1, SourceFile);
- if (RActual != 1)
- {
- fprintf (OutputFile,
- "[*** iASL: Read error on source code temp file %s ***]",
- Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
- return;
- }
- Total++;
- }
- }
- }
+ printf ("[*** iASL: Write error on output file ***]\n");
+ return AE_IO_ERROR;
}
+ }
+ else if (*Total == 256)
+ {
+ fprintf (OutputFile,
+ "\n[*** iASL: Very long input line, message below refers to column %u ***]",
+ Enode->Column);
+ }
+
+ RActual = fread (&SourceByte, 1, 1, SourceFile);
+ if (RActual != 1)
+ {
+ fprintf (OutputFile,
+ "[*** iASL: Read error on source code temp file %s ***]",
+ Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
- fprintf (OutputFile, "\n");
+ return AE_IO_ERROR;
}
+ *Total += 1;
}
- }
- else
- {
- /*
- * Less verbose version of the error message, enabled via the
- * -vi switch. The format is compatible with MS Visual Studio.
- */
- fprintf (OutputFile, "%s", Enode->Filename);
- if (Enode->LineNumber)
- {
- fprintf (OutputFile, "(%u) : ",
- Enode->LineNumber);
- }
+ fprintf (OutputFile, "\n");
}
}
-
- /* If a NULL message ID, just print the raw message */
-
- if (Enode->MessageId == 0)
+ else
{
- fprintf (OutputFile, "%s\n", Enode->Message);
- return;
+ /*
+ * Less verbose version of the error message, enabled via the
+ * -vi switch. The format is compatible with MS Visual Studio.
+ */
+ fprintf (OutputFile, "%s", Enode->Filename);
+
+ if (Enode->LineNumber)
+ {
+ fprintf (OutputFile, "(%u) : ",
+ Enode->LineNumber);
+ }
}
- /* Decode the message ID */
+ return AE_OK;
+}
- fprintf (OutputFile, "%s %4.4d -",
- AeDecodeExceptionLevel (Enode->Level),
- AeBuildFullExceptionCode (Enode->Level, Enode->MessageId));
+/*******************************************************************************
+ *
+ * FUNCTION: AePrintException
+ *
+ * PARAMETERS: FileId - ID of output file
+ * Enode - Error node to print
+ * Header - Additional text before each message
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print the contents of an error node.
+ *
+ * NOTE: We don't use the FlxxxFile I/O functions here because on error
+ * they abort the compiler and call this function! Since we
+ * are reporting errors here, we ignore most output errors and
+ * just try to get out as much as we can.
+ *
+ ******************************************************************************/
- MainMessage = AeDecodeMessageId (Enode->MessageId);
- ExtraMessage = Enode->Message;
+void
+AePrintException (
+ UINT32 FileId,
+ ASL_ERROR_MSG *Enode,
+ char *Header)
+{
+ FILE *OutputFile;
+ BOOLEAN PrematureEOF = FALSE;
+ UINT32 Total = 0;
+ ACPI_STATUS Status;
+ ASL_ERROR_MSG *Child = Enode->SubError;
- /* If a NULL line number, just print the decoded message */
- if (!Enode->LineNumber)
+ if (Gbl_NoErrors)
{
- fprintf (OutputFile, " %s %s\n\n", MainMessage, ExtraMessage);
return;
}
- MsgLength = strlen (MainMessage);
- if (MsgLength == 0)
+ /*
+ * Only listing files have a header, and remarks/optimizations
+ * are always output
+ */
+ if (!Header)
{
- /* Use the secondary/extra message as main message */
+ /* Ignore remarks if requested */
- MainMessage = Enode->Message;
- if (!MainMessage)
+ switch (Enode->Level)
{
- MainMessage = "";
- }
+ case ASL_WARNING:
+ case ASL_WARNING2:
+ case ASL_WARNING3:
- MsgLength = strlen (MainMessage);
- ExtraMessage = NULL;
- }
+ if (!Gbl_DisplayWarnings)
+ {
+ return;
+ }
+ break;
- if (Gbl_VerboseErrors && !PrematureEOF)
- {
- if (Total >= 256)
- {
- fprintf (OutputFile, " %s",
- MainMessage);
- }
- else
- {
- SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2;
- ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1;
+ case ASL_REMARK:
- if ((MsgLength + ErrorColumn) < (SourceColumn - 1))
+ if (!Gbl_DisplayRemarks)
{
- fprintf (OutputFile, "%*s%s",
- (int) ((SourceColumn - 1) - ErrorColumn),
- MainMessage, " ^ ");
+ return;
}
- else
+ break;
+
+ case ASL_OPTIMIZATION:
+
+ if (!Gbl_DisplayOptimizations)
{
- fprintf (OutputFile, "%*s %s",
- (int) ((SourceColumn - ErrorColumn) + 1), "^",
- MainMessage);
+ return;
}
+ break;
+
+ default:
+
+ break;
}
}
- else
+
+ /* Get the various required file handles */
+
+ OutputFile = Gbl_Files[FileId].Handle;
+
+ if (Header)
{
- fprintf (OutputFile, " %s", MainMessage);
+ fprintf (OutputFile, "%s", Header);
}
- /* Print the extra info message if present */
+ if (!Enode->Filename)
+ {
+ AeDecodeErrorMessageId (OutputFile, Enode, PrematureEOF, Total);
+ return;
+ }
- if (ExtraMessage)
+ Status = AePrintErrorSourceLine (OutputFile, Enode, &PrematureEOF, &Total);
+ if (ACPI_FAILURE (Status))
{
- fprintf (OutputFile, " (%s)", ExtraMessage);
+ return;
}
- if (PrematureEOF)
+ /* If a NULL message ID, just print the raw message */
+
+ if (Enode->MessageId == 0)
{
- fprintf (OutputFile, " and premature End-Of-File");
+ fprintf (OutputFile, "%s\n", Enode->Message);
+ return;
}
- fprintf (OutputFile, "\n");
- if (Gbl_VerboseErrors)
+ AeDecodeErrorMessageId (OutputFile, Enode, PrematureEOF, Total);
+
+ while (Child)
{
fprintf (OutputFile, "\n");
+ AePrintSubError (OutputFile, Child);
+ Child = Child->SubError;
}
}
/*******************************************************************************
*
+ * FUNCTION: AePrintSubError
+ *
+ * PARAMETERS: OutputFile - Output file
+ * Enode - Error node to print
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print the contents of an error nodes. This function is tailored
+ * to print error nodes that are SubErrors within ASL_ERROR_MSG
+ *
+ ******************************************************************************/
+
+static void
+AePrintSubError (
+ FILE *OutputFile,
+ ASL_ERROR_MSG *Enode)
+{
+ UINT32 Total = 0;
+ BOOLEAN PrematureEOF = FALSE;
+ const char *MainMessage;
+
+
+ MainMessage = AeDecodeMessageId (Enode->MessageId);
+
+ fprintf (OutputFile, " %s%s", MainMessage, "\n ");
+ (void) AePrintErrorSourceLine (OutputFile, Enode, &PrematureEOF, &Total);
+ fprintf (OutputFile, "\n");
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AePrintErrorLog
*
* PARAMETERS: FileId - Where to output the error log
@@ -640,54 +779,72 @@ AePrintErrorLog (
/*******************************************************************************
*
- * FUNCTION: AslCommonError2
+ * FUNCTION: AslInitEnode
*
- * PARAMETERS: Level - Seriousness (Warning/error, etc.)
+ * PARAMETERS: InputEnode - Input Error node to initialize
+ * Level - Seriousness (Warning/error, etc.)
* MessageId - Index into global message buffer
- * LineNumber - Actual file line number
+ * CurrentLineNumber - Actual file line number
+ * LogicalLineNumber - Cumulative line number
+ * LogicalByteOffset - Byte offset in source file
* Column - Column in current line
- * SourceLine - Actual source code line
* Filename - source filename
* ExtraMessage - additional error message
+ * SourceLine - Line of error source code
+ * SubError - SubError of this InputEnode
*
* RETURN: None
*
- * DESCRIPTION: Create a new error node and add it to the error log
+ * DESCRIPTION: Initialize an Error node
*
******************************************************************************/
-void
-AslCommonError2 (
+static void AslInitEnode (
+ ASL_ERROR_MSG **InputEnode,
UINT8 Level,
UINT16 MessageId,
UINT32 LineNumber,
+ UINT32 LogicalLineNumber,
+ UINT32 LogicalByteOffset,
UINT32 Column,
- char *SourceLine,
char *Filename,
- char *ExtraMessage)
+ char *ExtraMessage,
+ char *SourceLine,
+ ASL_ERROR_MSG *SubError)
{
- char *MessageBuffer = NULL;
- char *LineBuffer;
ASL_ERROR_MSG *Enode;
- Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG));
+ *InputEnode = UtLocalCalloc (sizeof (ASL_ERROR_MSG));
+ Enode = *InputEnode;
+ Enode->Level = Level;
+ Enode->MessageId = MessageId;
+ Enode->LineNumber = LineNumber;
+ Enode->LogicalLineNumber = LogicalLineNumber;
+ Enode->LogicalByteOffset = LogicalByteOffset;
+ Enode->Column = Column;
+ Enode->SubError = SubError;
+ Enode->Message = NULL;
+ Enode->SourceLine = NULL;
+ Enode->Filename = NULL;
if (ExtraMessage)
{
/* Allocate a buffer for the message and a new error node */
- MessageBuffer = UtStringCacheCalloc (strlen (ExtraMessage) + 1);
+ Enode->Message = UtLocalCacheCalloc (strlen (ExtraMessage) + 1);
/* Keep a copy of the extra message */
- strcpy (MessageBuffer, ExtraMessage);
+ strcpy (Enode->Message, ExtraMessage);
}
- LineBuffer = UtLocalCalloc (strlen (SourceLine) + 1);
- strcpy (LineBuffer, SourceLine);
+ if (SourceLine)
+ {
+ Enode->SourceLine = UtLocalCalloc (strlen (SourceLine) + 1);
+ strcpy (Enode->SourceLine, SourceLine);
+ }
- /* Initialize the error node */
if (Filename)
{
@@ -698,28 +855,39 @@ AslCommonError2 (
Enode->FilenameLength = 6;
}
}
+}
- Enode->MessageId = MessageId;
- Enode->Level = Level;
- Enode->LineNumber = LineNumber;
- Enode->LogicalLineNumber = LineNumber;
- Enode->LogicalByteOffset = 0;
- Enode->Column = Column;
- Enode->Message = MessageBuffer;
- Enode->SourceLine = LineBuffer;
-
- /* Add the new node to the error node list */
-
- AeAddToErrorLog (Enode);
-
- if (Gbl_DebugFlag)
- {
- /* stderr is a file, send error to it immediately */
- AePrintException (ASL_FILE_STDERR, Enode, NULL);
- }
+/*******************************************************************************
+ *
+ * FUNCTION: AslCommonError2
+ *
+ * PARAMETERS: Level - Seriousness (Warning/error, etc.)
+ * MessageId - Index into global message buffer
+ * LineNumber - Actual file line number
+ * Column - Column in current line
+ * SourceLine - Actual source code line
+ * Filename - source filename
+ * ExtraMessage - additional error message
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Create a new error node and add it to the error log
+ *
+ ******************************************************************************/
- Gbl_ExceptionCount[Level]++;
+void
+AslCommonError2 (
+ UINT8 Level,
+ UINT16 MessageId,
+ UINT32 LineNumber,
+ UINT32 Column,
+ char *SourceLine,
+ char *Filename,
+ char *ExtraMessage)
+{
+ AslLogNewError (Level, MessageId, LineNumber, LineNumber, 0, Column,
+ Filename, ExtraMessage, SourceLine, NULL);
}
@@ -753,48 +921,51 @@ AslCommonError (
char *Filename,
char *ExtraMessage)
{
- char *MessageBuffer = NULL;
- ASL_ERROR_MSG *Enode;
-
-
- if (AslIsExceptionIgnored (Level, MessageId))
- {
- return;
- }
-
- Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG));
-
- if (ExtraMessage)
- {
- /* Allocate a buffer for the message and a new error node */
-
- MessageBuffer = UtStringCacheCalloc (strlen (ExtraMessage) + 1);
-
- /* Keep a copy of the extra message */
+ AslLogNewError (Level, MessageId, CurrentLineNumber, LogicalLineNumber,
+ LogicalByteOffset, Column, Filename, ExtraMessage,
+ NULL, NULL);
+}
- strcpy (MessageBuffer, ExtraMessage);
- }
- /* Initialize the error node */
+/*******************************************************************************
+ *
+ * FUNCTION: AslLogNewError
+ *
+ * PARAMETERS: Level - Seriousness (Warning/error, etc.)
+ * MessageId - Index into global message buffer
+ * CurrentLineNumber - Actual file line number
+ * LogicalLineNumber - Cumulative line number
+ * LogicalByteOffset - Byte offset in source file
+ * Column - Column in current line
+ * Filename - source filename
+ * Message - additional error message
+ * SourceLine - Actual line of source code
+ * SubError - Sub-error associated with this error
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Create a new error node and add it to the error log
+ *
+ ******************************************************************************/
+static void
+AslLogNewError (
+ UINT8 Level,
+ UINT16 MessageId,
+ UINT32 LineNumber,
+ UINT32 LogicalLineNumber,
+ UINT32 LogicalByteOffset,
+ UINT32 Column,
+ char *Filename,
+ char *Message,
+ char *SourceLine,
+ ASL_ERROR_MSG *SubError)
+{
+ ASL_ERROR_MSG *Enode = NULL;
- if (Filename)
- {
- Enode->Filename = Filename;
- Enode->FilenameLength = strlen (Filename);
- if (Enode->FilenameLength < 6)
- {
- Enode->FilenameLength = 6;
- }
- }
- Enode->MessageId = MessageId;
- Enode->Level = Level;
- Enode->LineNumber = CurrentLineNumber;
- Enode->LogicalLineNumber = LogicalLineNumber;
- Enode->LogicalByteOffset = LogicalByteOffset;
- Enode->Column = Column;
- Enode->Message = MessageBuffer;
- Enode->SourceLine = NULL;
+ AslInitEnode (&Enode, Level, MessageId, LineNumber, LogicalLineNumber,
+ LogicalByteOffset, Column, Filename, Message, SourceLine,
+ SubError);
/* Add the new node to the error node list */
@@ -825,8 +996,8 @@ AslCommonError (
*
* FUNCTION: AslIsExceptionIgnored
*
- * PARAMETERS: Level - Seriousness (Warning/error, etc.)
- * MessageId - Index into global message buffer
+ * PARAMETERS: Level - Seriousness (Warning/error, etc.)
+ * MessageId - Index into global message buffer
*
* RETURN: BOOLEAN
*
@@ -840,7 +1011,7 @@ AslIsExceptionIgnored (
UINT8 Level,
UINT16 MessageId)
{
- BOOLEAN ExceptionIgnored;
+ BOOLEAN ExceptionIgnored;
/* Note: this allows exception to be disabled and expected */
@@ -869,7 +1040,8 @@ void
AslCheckExpectedExceptions (
void)
{
- UINT8 i;
+ UINT8 i;
+
for (i = 0; i < Gbl_ExpectedMessagesIndex; ++i)
{
@@ -980,8 +1152,8 @@ AslDisableException (
*
* FUNCTION: AslIsExceptionDisabled
*
- * PARAMETERS: Level - Seriousness (Warning/error, etc.)
- * MessageId - Index into global message buffer
+ * PARAMETERS: Level - Seriousness (Warning/error, etc.)
+ * MessageId - Index into global message buffer
*
* RETURN: TRUE if exception/message should be ignored
*
@@ -999,9 +1171,8 @@ AslIsExceptionExpected (
UINT32 i;
- /*
- * Mark this exception as received
- */
+ /* Mark this exception as received */
+
EncodedMessageId = AeBuildFullExceptionCode (Level, MessageId);
for (i = 0; i < Gbl_ExpectedMessagesIndex; i++)
{
@@ -1082,6 +1253,61 @@ AslIsExceptionDisabled (
/*******************************************************************************
*
+ * FUNCTION: AslDualParseOpError
+ *
+ * PARAMETERS: Level - Seriousness (Warning/error, etc.)
+ * MainMsgId - Index into global message buffer
+ * MainOp - Parse node where error happened
+ * MainMsg - Message pertaining to the MainOp
+ * SubMsgId - Index into global message buffer
+ * SubOp - Additional parse node for better message
+ * SubMsg - Message pertainint to SubOp
+ *
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Main error reporting routine for the ASL compiler for error
+ * messages that point to multiple parse objects.
+ *
+ ******************************************************************************/
+
+void
+AslDualParseOpError (
+ UINT8 Level,
+ UINT16 MainMsgId,
+ ACPI_PARSE_OBJECT *MainOp,
+ char *MainMsg,
+ UINT16 SubMsgId,
+ ACPI_PARSE_OBJECT *SubOp,
+ char *SubMsg)
+{
+ ASL_ERROR_MSG *SubEnode = NULL;
+
+
+ /* Check if user wants to ignore this exception */
+
+ if (AslIsExceptionIgnored (Level, MainMsgId) || !MainOp)
+ {
+ return;
+ }
+
+ if (SubOp)
+ {
+ AslInitEnode (&SubEnode, Level, SubMsgId, SubOp->Asl.LineNumber,
+ SubOp->Asl.LogicalLineNumber, SubOp->Asl.LogicalByteOffset,
+ SubOp->Asl.Column, SubOp->Asl.Filename, SubMsg,
+ NULL, NULL);
+ }
+
+ AslLogNewError (Level, MainMsgId, MainOp->Asl.LineNumber,
+ MainOp->Asl.LogicalLineNumber, MainOp->Asl.LogicalByteOffset,
+ MainOp->Asl.Column, MainOp->Asl.Filename, MainMsg,
+ NULL, SubEnode);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AslError
*
* PARAMETERS: Level - Seriousness (Warning/error, etc.)