xref: /freebsd/sys/contrib/dev/acpica/compiler/aslerror.c (revision 5ab1c5846ff41be24b1f6beb0317bf8258cd4409)
1 /******************************************************************************
2  *
3  * Module Name: aslerror - Error handling and statistics
4  *
5  *****************************************************************************/
6 
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
16  * 2.1. This is your license from Intel Corp. under its intellectual property
17  * rights. You may have additional license terms from the party that provided
18  * you this software, covering your right to use that party's intellectual
19  * property rights.
20  *
21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22  * copy of the source code appearing in this file ("Covered Code") an
23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24  * base code distributed originally by Intel ("Original Intel Code") to copy,
25  * make derivatives, distribute, use and display any portion of the Covered
26  * Code in any form, with the right to sublicense such rights; and
27  *
28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29  * license (with the right to sublicense), under only those claims of Intel
30  * patents that are infringed by the Original Intel Code, to make, use, sell,
31  * offer to sell, and import the Covered Code and derivative works thereof
32  * solely to the minimum extent necessary to exercise the above copyright
33  * license, and in no event shall the patent license extend to any additions
34  * to or modifications of the Original Intel Code. No other license or right
35  * is granted directly or by implication, estoppel or otherwise;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43  * Redistribution of source code of any substantial portion of the Covered
44  * Code or modification with rights to further distribute source must include
45  * the above Copyright Notice, the above License, this list of Conditions,
46  * and the following Disclaimer and Export Compliance provision. In addition,
47  * Licensee must cause all Covered Code to which Licensee contributes to
48  * contain a file documenting the changes Licensee made to create that Covered
49  * Code and the date of any change. Licensee must include in that file the
50  * documentation of any changes made by any predecessor Licensee. Licensee
51  * must include a prominent statement that the modification is derived,
52  * directly or indirectly, from Original Intel Code.
53  *
54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55  * Redistribution of source code of any substantial portion of the Covered
56  * Code or modification without rights to further distribute source must
57  * include the following Disclaimer and Export Compliance provision in the
58  * documentation and/or other materials provided with distribution. In
59  * addition, Licensee may not authorize further sublicense of source of any
60  * portion of the Covered Code, and must include terms to the effect that the
61  * license from Licensee to its licensee is limited to the intellectual
62  * property embodied in the software Licensee provides to its licensee, and
63  * not to intellectual property embodied in modifications its licensee may
64  * make.
65  *
66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67  * substantial portion of the Covered Code or modification must reproduce the
68  * above Copyright Notice, and the following Disclaimer and Export Compliance
69  * provision in the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76  * Intel shall be used in advertising or otherwise to promote the sale, use or
77  * other dealings in products derived from or relating to the Covered Code
78  * without prior written authorization from Intel.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88  * PARTICULAR PURPOSE.
89  *
90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97  * LIMITED REMEDY.
98  *
99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100  * software or system incorporating such software without first obtaining any
101  * required license or other approval from the U. S. Department of Commerce or
102  * any other agency or department of the United States Government. In the
103  * event Licensee exports any such software from the United States or
104  * re-exports any such software from a foreign destination, Licensee shall
105  * ensure that the distribution and export/re-export of the software is in
106  * compliance with all laws, regulations, orders, or other restrictions of the
107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108  * any of its subsidiaries will export/re-export any technical data, process,
109  * software, or service, directly or indirectly, to any country for which the
110  * United States government or any agency thereof requires an export license,
111  * other governmental approval, or letter of assurance, without first obtaining
112  * such license, approval or letter.
113  *
114  *****************************************************************************
115  *
116  * Alternatively, you may choose to be licensed under the terms of the
117  * following license:
118  *
119  * Redistribution and use in source and binary forms, with or without
120  * modification, are permitted provided that the following conditions
121  * are met:
122  * 1. Redistributions of source code must retain the above copyright
123  *    notice, this list of conditions, and the following disclaimer,
124  *    without modification.
125  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126  *    substantially similar to the "NO WARRANTY" disclaimer below
127  *    ("Disclaimer") and any redistribution must be conditioned upon
128  *    including a substantially similar Disclaimer requirement for further
129  *    binary redistribution.
130  * 3. Neither the names of the above-listed copyright holders nor the names
131  *    of any contributors may be used to endorse or promote products derived
132  *    from this software without specific prior written permission.
133  *
134  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145  *
146  * Alternatively, you may choose to be licensed under the terms of the
147  * GNU General Public License ("GPL") version 2 as published by the Free
148  * Software Foundation.
149  *
150  *****************************************************************************/
151 
152 #include <contrib/dev/acpica/compiler/aslcompiler.h>
153 
154 #define _COMPONENT          ACPI_COMPILER
155         ACPI_MODULE_NAME    ("aslerror")
156 
157 /* Local prototypes */
158 
159 static void
160 AeAddToErrorLog (
161     ASL_ERROR_MSG           *Enode);
162 
163 static BOOLEAN
164 AslIsExceptionExpected (
165     UINT8                   Level,
166     UINT16                  MessageId);
167 
168 static BOOLEAN
169 AslIsExceptionDisabled (
170     UINT8                   Level,
171     UINT16                  MessageId);
172 
173 static void AslInitEnode (
174     ASL_ERROR_MSG           **Enode,
175     UINT8                   Level,
176     UINT16                  MessageId,
177     UINT32                  LineNumber,
178     UINT32                  LogicalLineNumber,
179     UINT32                  LogicalByteOffset,
180     UINT32                  Column,
181     char                    *Filename,
182     char                    *Message,
183     char                    *SourceLine,
184     ASL_ERROR_MSG           *SubError);
185 
186 static void
187 AslLogNewError (
188     UINT8                   Level,
189     UINT16                  MessageId,
190     UINT32                  LineNumber,
191     UINT32                  LogicalLineNumber,
192     UINT32                  LogicalByteOffset,
193     UINT32                  Column,
194     char                    *Filename,
195     char                    *Message,
196     char                    *SourceLine,
197     ASL_ERROR_MSG           *SubError);
198 
199 static void
200 AePrintSubError (
201     FILE                    *OutputFile,
202     ASL_ERROR_MSG           *Enode);
203 
204 static UINT8
205 GetModifiedLevel (
206     UINT8                   Level,
207     UINT16                  MessageId);
208 
209 
210 /*******************************************************************************
211  *
212  * FUNCTION:    AslAbort
213  *
214  * PARAMETERS:  None
215  *
216  * RETURN:      None
217  *
218  * DESCRIPTION: Dump the error log and abort the compiler. Used for serious
219  *              I/O errors.
220  *
221  ******************************************************************************/
222 
223 void
224 AslAbort (
225     void)
226 {
227 
228     AePrintErrorLog (ASL_FILE_STDERR);
229     if (AslGbl_DebugFlag)
230     {
231         /* Print error summary to stdout also */
232 
233         AePrintErrorLog (ASL_FILE_STDOUT);
234     }
235 
236     exit (1);
237 }
238 
239 
240 /*******************************************************************************
241  *
242  * FUNCTION:    AeClearErrorLog
243  *
244  * PARAMETERS:  None
245  *
246  * RETURN:      None
247  *
248  * DESCRIPTION: Empty the error list
249  *
250  ******************************************************************************/
251 
252 void
253 AeClearErrorLog (
254     void)
255 {
256     ASL_ERROR_MSG           *Enode = AslGbl_ErrorLog;
257     ASL_ERROR_MSG           *Next;
258 
259 
260     /* Walk the error node list */
261 
262     while (Enode)
263     {
264         Next = Enode->Next;
265         ACPI_FREE (Enode);
266         Enode = Next;
267     }
268 
269    AslGbl_ErrorLog = NULL;
270 }
271 
272 
273 /*******************************************************************************
274  *
275  * FUNCTION:    AeAddToErrorLog
276  *
277  * PARAMETERS:  Enode       - An error node to add to the log
278  *
279  * RETURN:      None
280  *
281  * DESCRIPTION: Add a new error node to the error log. The error log is
282  *              ordered by the "logical" line number (cumulative line number
283  *              including all include files.)
284  *
285  ******************************************************************************/
286 
287 static void
288 AeAddToErrorLog (
289     ASL_ERROR_MSG           *Enode)
290 {
291     ASL_ERROR_MSG           *Next;
292     ASL_ERROR_MSG           *Prev;
293 
294 
295     /* If Gbl_ErrorLog is null, this is the first error node */
296 
297     if (!AslGbl_ErrorLog)
298     {
299         AslGbl_ErrorLog = Enode;
300         return;
301     }
302 
303     /*
304      * Walk error list until we find a line number greater than ours.
305      * List is sorted according to line number.
306      */
307     Prev = NULL;
308     Next = AslGbl_ErrorLog;
309 
310     while ((Next) && (Next->LogicalLineNumber <= Enode->LogicalLineNumber))
311     {
312         Prev = Next;
313         Next = Next->Next;
314     }
315 
316     /* Found our place in the list */
317 
318     Enode->Next = Next;
319 
320     if (Prev)
321     {
322         Prev->Next = Enode;
323     }
324     else
325     {
326         AslGbl_ErrorLog = Enode;
327     }
328 }
329 
330 
331 /*******************************************************************************
332  *
333  * FUNCTION:    AeDecodeErrorMessageId
334  *
335  * PARAMETERS:  OutputFile      - Output file
336  *              Enode           - Error node to print
337  *              PrematureEOF    - True = PrematureEOF has been reached
338  *              Total           - Total legth of line
339  *
340  * RETURN:      None
341  *
342  * DESCRIPTION: Print the source line of an error.
343  *
344  ******************************************************************************/
345 
346 static void
347 AeDecodeErrorMessageId (
348     FILE                    *OutputFile,
349     ASL_ERROR_MSG           *Enode,
350     BOOLEAN                 PrematureEOF,
351     UINT32                  Total)
352 {
353     UINT32                  MsgLength;
354     const char              *MainMessage;
355     char                    *ExtraMessage;
356     UINT32                  SourceColumn;
357     UINT32                  ErrorColumn;
358 
359 
360     fprintf (OutputFile, "%s %4.4d -",
361         AeDecodeExceptionLevel (Enode->Level),
362         AeBuildFullExceptionCode (Enode->Level, Enode->MessageId));
363 
364     MainMessage = AeDecodeMessageId (Enode->MessageId);
365     ExtraMessage = Enode->Message;
366 
367     /* If a NULL line number, just print the decoded message */
368 
369     if (!Enode->LineNumber)
370     {
371         fprintf (OutputFile, " %s %s\n\n", MainMessage, ExtraMessage);
372         return;
373     }
374 
375     MsgLength = strlen (MainMessage);
376     if (MsgLength == 0)
377     {
378         /* Use the secondary/extra message as main message */
379 
380         MainMessage = Enode->Message;
381         if (!MainMessage)
382         {
383             MainMessage = "";
384         }
385 
386         MsgLength = strlen (MainMessage);
387         ExtraMessage = NULL;
388     }
389 
390     if (AslGbl_VerboseErrors && !PrematureEOF)
391     {
392         if (Total >= 256)
393         {
394             fprintf (OutputFile, "    %s",
395                 MainMessage);
396         }
397         else
398         {
399             SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2;
400             ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1;
401 
402             if ((MsgLength + ErrorColumn) < (SourceColumn - 1))
403             {
404                 fprintf (OutputFile, "%*s%s",
405                     (int) ((SourceColumn - 1) - ErrorColumn),
406                     MainMessage, " ^ ");
407             }
408             else
409             {
410                 fprintf (OutputFile, "%*s %s",
411                     (int) ((SourceColumn - ErrorColumn) + 1), "^",
412                     MainMessage);
413             }
414         }
415     }
416     else
417     {
418         fprintf (OutputFile, " %s", MainMessage);
419     }
420 
421     /* Print the extra info message if present */
422 
423     if (ExtraMessage)
424     {
425         fprintf (OutputFile, " (%s)", ExtraMessage);
426     }
427 
428     if (PrematureEOF)
429     {
430         fprintf (OutputFile, " and premature End-Of-File");
431     }
432 
433     fprintf (OutputFile, "\n");
434     if (AslGbl_VerboseErrors && !Enode->SubError)
435     {
436         fprintf (OutputFile, "\n");
437     }
438 }
439 
440 
441 /*******************************************************************************
442  *
443  * FUNCTION:    AePrintErrorSourceLine
444  *
445  * PARAMETERS:  OutputFile      - Output file
446  *              Enode           - Error node to print
447  *              PrematureEOF    - True = PrematureEOF has been reached
448  *              Total           - amount of characters printed so far
449  *
450  *
451  * RETURN:      Status
452  *
453  * DESCRIPTION: Print the source line of an error.
454  *
455  ******************************************************************************/
456 
457 static ACPI_STATUS
458 AePrintErrorSourceLine (
459     FILE                    *OutputFile,
460     ASL_ERROR_MSG           *Enode,
461     BOOLEAN                 *PrematureEOF,
462     UINT32                  *Total)
463 {
464     UINT8                   SourceByte;
465     int                     Actual;
466     size_t                  RActual;
467     FILE                    *SourceFile = NULL;
468     long                    FileSize;
469 
470 
471     if (!Enode->SourceLine)
472     {
473         /*
474          * Use the merged header/source file if present, otherwise
475          * use input file
476          */
477         SourceFile = FlGetFileHandle (ASL_FILE_SOURCE_OUTPUT,
478             ASL_FILE_SOURCE_OUTPUT, Enode->SourceFilename);
479         if (!SourceFile)
480         {
481             SourceFile = FlGetFileHandle (ASL_FILE_INPUT,
482                 ASL_FILE_INPUT, Enode->Filename);
483         }
484 
485         if (SourceFile)
486         {
487             /* Determine if the error occurred at source file EOF */
488 
489             fseek (SourceFile, 0, SEEK_END);
490             FileSize = ftell (SourceFile);
491 
492             if ((long) Enode->LogicalByteOffset >= FileSize)
493             {
494                 *PrematureEOF = TRUE;
495             }
496         }
497         else
498         {
499             fprintf (OutputFile,
500                 "[*** iASL: Source File Does not exist ***]\n");
501             return AE_IO_ERROR;
502         }
503     }
504 
505     /* Print filename and line number if present and valid */
506 
507     if (AslGbl_VerboseErrors)
508     {
509         fprintf (OutputFile, "%-8s", Enode->Filename);
510 
511         if (Enode->SourceLine && Enode->LineNumber)
512         {
513             fprintf (OutputFile, " %6u: %s",
514                 Enode->LineNumber, Enode->SourceLine);
515         }
516         else if (Enode->LineNumber)
517         {
518             fprintf (OutputFile, " %6u: ", Enode->LineNumber);
519 
520             /*
521              * If not at EOF, get the corresponding source code line
522              * and display it. Don't attempt this if we have a
523              * premature EOF condition.
524              */
525             if (*PrematureEOF)
526             {
527                 fprintf (OutputFile, "\n");
528                 return AE_OK;
529             }
530             /*
531              * Seek to the offset in the combined source file,
532              * read the source line, and write it to the output.
533              */
534             Actual = fseek (SourceFile,
535                 (long) Enode->LogicalByteOffset, (int) SEEK_SET);
536             if (Actual)
537             {
538                 fprintf (OutputFile,
539                     "[*** iASL: Seek error on source code temp file %s ***]",
540                     AslGbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
541 
542                 fprintf (OutputFile, "\n");
543                 return AE_OK;
544             }
545             RActual = fread (&SourceByte, 1, 1, SourceFile);
546             if (RActual != 1)
547             {
548                 fprintf (OutputFile,
549                     "[*** iASL: Read error on source code temp file %s ***]",
550                     AslGbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
551                 return AE_IO_ERROR;
552             }
553                 /* Read/write the source line, up to the maximum line length */
554 
555             while (RActual && SourceByte && (SourceByte != '\n'))
556             {
557                 if (*Total < 256)
558                 {
559                     /* After the max line length, we will just read the line, no write */
560 
561                     if (fwrite (&SourceByte, 1, 1, OutputFile) != 1)
562                     {
563                         printf ("[*** iASL: Write error on output file ***]\n");
564                         return AE_IO_ERROR;
565                     }
566                 }
567                 else if (*Total == 256)
568                 {
569                     fprintf (OutputFile,
570                         "\n[*** iASL: Very long input line, message below refers to column %u ***]",
571                         Enode->Column);
572                 }
573 
574                 RActual = fread (&SourceByte, 1, 1, SourceFile);
575                 if (RActual != 1)
576                 {
577                     fprintf (OutputFile,
578                         "[*** iASL: Read error on source code temp file %s ***]",
579                         AslGbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
580 
581                     return AE_IO_ERROR;
582                 }
583                 *Total += 1;
584             }
585 
586             fprintf (OutputFile, "\n");
587         }
588     }
589     else
590     {
591         /*
592          * Less verbose version of the error message, enabled via the
593          * -vi switch. The format is compatible with MS Visual Studio.
594          */
595         fprintf (OutputFile, "%s", Enode->Filename);
596 
597         if (Enode->LineNumber)
598         {
599             fprintf (OutputFile, "(%u) : ",
600                 Enode->LineNumber);
601         }
602     }
603 
604     return AE_OK;
605 }
606 
607 /*******************************************************************************
608  *
609  * FUNCTION:    AePrintException
610  *
611  * PARAMETERS:  FileId          - ID of output file
612  *              Enode           - Error node to print
613  *              Header          - Additional text before each message
614  *
615  * RETURN:      None
616  *
617  * DESCRIPTION: Print the contents of an error node.
618  *
619  * NOTE:        We don't use the FlxxxFile I/O functions here because on error
620  *              they abort the compiler and call this function!  Since we
621  *              are reporting errors here, we ignore most output errors and
622  *              just try to get out as much as we can.
623  *
624  ******************************************************************************/
625 
626 void
627 AePrintException (
628     UINT32                  FileId,
629     ASL_ERROR_MSG           *Enode,
630     char                    *Header)
631 {
632     FILE                    *OutputFile;
633     BOOLEAN                 PrematureEOF = FALSE;
634     UINT32                  Total = 0;
635     ACPI_STATUS             Status;
636     ASL_ERROR_MSG           *Child = Enode->SubError;
637 
638 
639     if (AslGbl_NoErrors)
640     {
641         return;
642     }
643 
644     /*
645      * Only listing files have a header, and remarks/optimizations
646      * are always output
647      */
648     if (!Header)
649     {
650         /* Ignore remarks if requested */
651 
652         switch (Enode->Level)
653         {
654         case ASL_WARNING:
655         case ASL_WARNING2:
656         case ASL_WARNING3:
657 
658             if (!AslGbl_DisplayWarnings)
659             {
660                 return;
661             }
662             break;
663 
664         case ASL_REMARK:
665 
666             if (!AslGbl_DisplayRemarks)
667             {
668                 return;
669             }
670             break;
671 
672         case ASL_OPTIMIZATION:
673 
674             if (!AslGbl_DisplayOptimizations)
675             {
676                 return;
677             }
678             break;
679 
680         default:
681 
682             break;
683         }
684     }
685 
686     /* Get the various required file handles */
687 
688     OutputFile = AslGbl_Files[FileId].Handle;
689 
690     if (Header)
691     {
692         fprintf (OutputFile, "%s", Header);
693     }
694 
695     if (!Enode->Filename)
696     {
697         AeDecodeErrorMessageId (OutputFile, Enode, PrematureEOF, Total);
698         return;
699     }
700 
701     Status = AePrintErrorSourceLine (OutputFile, Enode, &PrematureEOF, &Total);
702     if (ACPI_FAILURE (Status))
703     {
704         return;
705     }
706 
707     /* If a NULL message ID, just print the raw message */
708 
709     if (Enode->MessageId == 0)
710     {
711         fprintf (OutputFile, "%s\n", Enode->Message);
712         return;
713     }
714 
715     AeDecodeErrorMessageId (OutputFile, Enode, PrematureEOF, Total);
716 
717     while (Child)
718     {
719         fprintf (OutputFile, "\n");
720         AePrintSubError (OutputFile, Child);
721         Child = Child->SubError;
722     }
723 }
724 
725 
726 /*******************************************************************************
727  *
728  * FUNCTION:    AePrintSubError
729  *
730  * PARAMETERS:  OutputFile      - Output file
731  *              Enode           - Error node to print
732  *
733  * RETURN:      None
734  *
735  * DESCRIPTION: Print the contents of an error nodes. This function is tailored
736  *              to print error nodes that are SubErrors within ASL_ERROR_MSG
737  *
738  ******************************************************************************/
739 
740 static void
741 AePrintSubError (
742     FILE                    *OutputFile,
743     ASL_ERROR_MSG           *Enode)
744 {
745     UINT32                  Total = 0;
746     BOOLEAN                 PrematureEOF = FALSE;
747     const char              *MainMessage;
748 
749 
750     MainMessage = AeDecodeMessageId (Enode->MessageId);
751 
752     fprintf (OutputFile, "    %s%s", MainMessage, "\n    ");
753     (void) AePrintErrorSourceLine (OutputFile, Enode, &PrematureEOF, &Total);
754     fprintf (OutputFile, "\n");
755 }
756 
757 
758 /*******************************************************************************
759  *
760  * FUNCTION:    AePrintErrorLog
761  *
762  * PARAMETERS:  FileId           - Where to output the error log
763  *
764  * RETURN:      None
765  *
766  * DESCRIPTION: Print the entire contents of the error log
767  *
768  ******************************************************************************/
769 
770 void
771 AePrintErrorLog (
772     UINT32                  FileId)
773 {
774     ASL_ERROR_MSG           *Enode = AslGbl_ErrorLog;
775 
776 
777     /* Walk the error node list */
778 
779     while (Enode)
780     {
781         AePrintException (FileId, Enode, NULL);
782         Enode = Enode->Next;
783     }
784 }
785 
786 
787 /*******************************************************************************
788  *
789  * FUNCTION:    AslInitEnode
790  *
791  * PARAMETERS:  InputEnode          - Input Error node to initialize
792  *              Level               - Seriousness (Warning/error, etc.)
793  *              MessageId           - Index into global message buffer
794  *              CurrentLineNumber   - Actual file line number
795  *              LogicalLineNumber   - Cumulative line number
796  *              LogicalByteOffset   - Byte offset in source file
797  *              Column              - Column in current line
798  *              Filename            - source filename
799  *              ExtraMessage        - additional error message
800  *              SourceLine          - Line of error source code
801  *              SubError            - SubError of this InputEnode
802  *
803  * RETURN:      None
804  *
805  * DESCRIPTION: Initialize an Error node
806  *
807  ******************************************************************************/
808 
809 static void AslInitEnode (
810     ASL_ERROR_MSG           **InputEnode,
811     UINT8                   Level,
812     UINT16                  MessageId,
813     UINT32                  LineNumber,
814     UINT32                  LogicalLineNumber,
815     UINT32                  LogicalByteOffset,
816     UINT32                  Column,
817     char                    *Filename,
818     char                    *ExtraMessage,
819     char                    *SourceLine,
820     ASL_ERROR_MSG           *SubError)
821 {
822     ASL_ERROR_MSG           *Enode;
823     ASL_GLOBAL_FILE_NODE    *FileNode;
824 
825 
826     *InputEnode = UtLocalCalloc (sizeof (ASL_ERROR_MSG));
827     Enode = *InputEnode;
828     Enode->Level                = Level;
829     Enode->MessageId            = MessageId;
830     Enode->LineNumber           = LineNumber;
831     Enode->LogicalLineNumber    = LogicalLineNumber;
832     Enode->LogicalByteOffset    = LogicalByteOffset;
833     Enode->Column               = Column;
834     Enode->SubError             = SubError;
835     Enode->Message              = NULL;
836     Enode->SourceLine           = NULL;
837     Enode->Filename             = NULL;
838 
839     if (ExtraMessage)
840     {
841         /* Allocate a buffer for the message and a new error node */
842 
843         Enode->Message = UtLocalCacheCalloc (strlen (ExtraMessage) + 1);
844 
845         /* Keep a copy of the extra message */
846 
847         strcpy (Enode->Message, ExtraMessage);
848     }
849 
850     if (SourceLine)
851     {
852         Enode->SourceLine = UtLocalCalloc (strlen (SourceLine) + 1);
853         strcpy (Enode->SourceLine, SourceLine);
854     }
855 
856 
857     if (Filename)
858     {
859         Enode->Filename = Filename;
860         Enode->FilenameLength = strlen (Filename);
861         if (Enode->FilenameLength < 6)
862         {
863             Enode->FilenameLength = 6;
864         }
865 
866         FileNode = FlGetCurrentFileNode ();
867         if (!FileNode)
868         {
869             return;
870         }
871 
872         Enode->SourceFilename =
873             FileNode->Files[ASL_FILE_SOURCE_OUTPUT].Filename;
874     }
875 }
876 
877 
878 /*******************************************************************************
879  *
880  * FUNCTION:    AslCommonError2
881  *
882  * PARAMETERS:  Level               - Seriousness (Warning/error, etc.)
883  *              MessageId           - Index into global message buffer
884  *              LineNumber          - Actual file line number
885  *              Column              - Column in current line
886  *              SourceLine          - Actual source code line
887  *              Filename            - source filename
888  *              ExtraMessage        - additional error message
889  *
890  * RETURN:      None
891  *
892  * DESCRIPTION: Create a new error node and add it to the error log
893  *
894  ******************************************************************************/
895 
896 void
897 AslCommonError2 (
898     UINT8                   Level,
899     UINT16                  MessageId,
900     UINT32                  LineNumber,
901     UINT32                  Column,
902     char                    *SourceLine,
903     char                    *Filename,
904     char                    *ExtraMessage)
905 {
906     AslLogNewError (Level, MessageId, LineNumber, LineNumber, 0, Column,
907         Filename, ExtraMessage, SourceLine, NULL);
908 }
909 
910 
911 /*******************************************************************************
912  *
913  * FUNCTION:    AslCommonError
914  *
915  * PARAMETERS:  Level               - Seriousness (Warning/error, etc.)
916  *              MessageId           - Index into global message buffer
917  *              CurrentLineNumber   - Actual file line number
918  *              LogicalLineNumber   - Cumulative line number
919  *              LogicalByteOffset   - Byte offset in source file
920  *              Column              - Column in current line
921  *              Filename            - source filename
922  *              ExtraMessage        - additional error message
923  *
924  * RETURN:      None
925  *
926  * DESCRIPTION: Create a new error node and add it to the error log
927  *
928  ******************************************************************************/
929 
930 void
931 AslCommonError (
932     UINT8                   Level,
933     UINT16                  MessageId,
934     UINT32                  CurrentLineNumber,
935     UINT32                  LogicalLineNumber,
936     UINT32                  LogicalByteOffset,
937     UINT32                  Column,
938     char                    *Filename,
939     char                    *ExtraMessage)
940 {
941     /* Check if user wants to ignore this exception */
942 
943     if (AslIsExceptionIgnored (Level, MessageId))
944     {
945         return;
946     }
947 
948     AslLogNewError (Level, MessageId, CurrentLineNumber, LogicalLineNumber,
949         LogicalByteOffset, Column, Filename, ExtraMessage,
950         NULL, NULL);
951 }
952 
953 
954 /*******************************************************************************
955  *
956  * FUNCTION:    AslLogNewError
957  *
958  * PARAMETERS:  Level               - Seriousness (Warning/error, etc.)
959  *              MessageId           - Index into global message buffer
960  *              CurrentLineNumber   - Actual file line number
961  *              LogicalLineNumber   - Cumulative line number
962  *              LogicalByteOffset   - Byte offset in source file
963  *              Column              - Column in current line
964  *              Filename            - source filename
965  *              Message             - additional error message
966  *              SourceLine          - Actual line of source code
967  *              SubError            - Sub-error associated with this error
968  *
969  * RETURN:      None
970  *
971  * DESCRIPTION: Create a new error node and add it to the error log
972  *
973  ******************************************************************************/
974 static void
975 AslLogNewError (
976     UINT8                   Level,
977     UINT16                  MessageId,
978     UINT32                  LineNumber,
979     UINT32                  LogicalLineNumber,
980     UINT32                  LogicalByteOffset,
981     UINT32                  Column,
982     char                    *Filename,
983     char                    *Message,
984     char                    *SourceLine,
985     ASL_ERROR_MSG           *SubError)
986 {
987     ASL_ERROR_MSG           *Enode = NULL;
988     UINT8                   ModifiedLevel = GetModifiedLevel (Level, MessageId);
989 
990 
991     AslInitEnode (&Enode, ModifiedLevel, MessageId, LineNumber,
992         LogicalLineNumber, LogicalByteOffset, Column, Filename, Message,
993         SourceLine, SubError);
994 
995     /* Add the new node to the error node list */
996 
997     AeAddToErrorLog (Enode);
998 
999     if (AslGbl_DebugFlag)
1000     {
1001         /* stderr is a file, send error to it immediately */
1002 
1003         AePrintException (ASL_FILE_STDERR, Enode, NULL);
1004     }
1005 
1006     AslGbl_ExceptionCount[ModifiedLevel]++;
1007     if (!AslGbl_IgnoreErrors && AslGbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
1008     {
1009         printf ("\nMaximum error count (%u) exceeded\n", ASL_MAX_ERROR_COUNT);
1010 
1011         AslGbl_SourceLine = 0;
1012         AslGbl_NextError = AslGbl_ErrorLog;
1013         CmCleanupAndExit ();
1014         exit(1);
1015     }
1016 
1017     return;
1018 }
1019 
1020 
1021 /*******************************************************************************
1022  *
1023  * FUNCTION:    GetModifiedLevel
1024  *
1025  * PARAMETERS:  Level           - Seriousness (Warning/error, etc.)
1026  *              MessageId       - Index into global message buffer
1027  *
1028  * RETURN:      UINT8           - modified level
1029  *
1030  * DESCRIPTION: Get the modified level of exception codes that are reported as
1031  *              errors from the -ww option.
1032  *
1033  ******************************************************************************/
1034 
1035 static UINT8
1036 GetModifiedLevel (
1037     UINT8                   Level,
1038     UINT16                  MessageId)
1039 {
1040     UINT16                  i;
1041     UINT16                  ExceptionCode;
1042 
1043 
1044     ExceptionCode = AeBuildFullExceptionCode (Level, MessageId);
1045 
1046     for (i = 0; i < AslGbl_ElevatedMessagesIndex; i++)
1047     {
1048         if (ExceptionCode == AslGbl_ElevatedMessages[i])
1049         {
1050             return (ASL_ERROR);
1051         }
1052     }
1053 
1054     return (Level);
1055 }
1056 
1057 
1058 /*******************************************************************************
1059  *
1060  * FUNCTION:    AslIsExceptionIgnored
1061  *
1062  * PARAMETERS:  Level           - Seriousness (Warning/error, etc.)
1063  *              MessageId       - Index into global message buffer
1064  *
1065  * RETURN:      BOOLEAN
1066  *
1067  * DESCRIPTION: Check if a particular exception is ignored. In this case it
1068  *              means that the exception is (expected or disabled.
1069  *
1070  ******************************************************************************/
1071 
1072 BOOLEAN
1073 AslIsExceptionIgnored (
1074     UINT8                   Level,
1075     UINT16                  MessageId)
1076 {
1077     BOOLEAN                 ExceptionIgnored;
1078 
1079 
1080     /* Note: this allows exception to be disabled and expected */
1081 
1082     ExceptionIgnored = AslIsExceptionDisabled (Level, MessageId);
1083     ExceptionIgnored |= AslIsExceptionExpected (Level, MessageId);
1084 
1085     return (AslGbl_AllExceptionsDisabled || ExceptionIgnored);
1086 }
1087 
1088 
1089 /*******************************************************************************
1090  *
1091  * FUNCTION:    AslCheckExpectException
1092  *
1093  * PARAMETERS:  none
1094  *
1095  * RETURN:      none
1096  *
1097  * DESCRIPTION: Check the global expected messages table and raise an error
1098  *              for each message that has not been received.
1099  *
1100  ******************************************************************************/
1101 
1102 void
1103 AslCheckExpectedExceptions (
1104     void)
1105 {
1106     UINT8                   i;
1107 
1108 
1109     for (i = 0; i < AslGbl_ExpectedMessagesIndex; ++i)
1110     {
1111         if (!AslGbl_ExpectedMessages[i].MessageReceived)
1112         {
1113             AslError (ASL_ERROR, ASL_MSG_EXCEPTION_NOT_RECEIVED, NULL,
1114                 AslGbl_ExpectedMessages[i].MessageIdStr);
1115         }
1116     }
1117 }
1118 
1119 
1120 /*******************************************************************************
1121  *
1122  * FUNCTION:    AslExpectException
1123  *
1124  * PARAMETERS:  MessageIdString     - ID of excepted exception during compile
1125  *
1126  * RETURN:      Status
1127  *
1128  * DESCRIPTION: Enter a message ID into the global expected messages table
1129  *              If these messages are not raised during the compilation, throw
1130  *              an error.
1131  *
1132  ******************************************************************************/
1133 
1134 ACPI_STATUS
1135 AslExpectException (
1136     char                    *MessageIdString)
1137 {
1138     UINT32                  MessageId;
1139 
1140 
1141     /* Convert argument to an integer and validate it */
1142 
1143     MessageId = (UINT32) strtoul (MessageIdString, NULL, 0);
1144 
1145     if (MessageId > 6999)
1146     {
1147         printf ("\"%s\" is not a valid warning/remark/erro ID\n",
1148             MessageIdString);
1149         return (AE_BAD_PARAMETER);
1150     }
1151 
1152     /* Insert value into the global expected message array */
1153 
1154     if (AslGbl_ExpectedMessagesIndex >= ASL_MAX_EXPECTED_MESSAGES)
1155     {
1156         printf ("Too many messages have been registered as expected (max %d)\n",
1157             ASL_MAX_DISABLED_MESSAGES);
1158         return (AE_LIMIT);
1159     }
1160 
1161     AslGbl_ExpectedMessages[AslGbl_ExpectedMessagesIndex].MessageId = MessageId;
1162     AslGbl_ExpectedMessages[AslGbl_ExpectedMessagesIndex].MessageIdStr = MessageIdString;
1163     AslGbl_ExpectedMessages[AslGbl_ExpectedMessagesIndex].MessageReceived = FALSE;
1164     AslGbl_ExpectedMessagesIndex++;
1165     return (AE_OK);
1166 }
1167 
1168 
1169 /*******************************************************************************
1170  *
1171  * FUNCTION:    AslDisableException
1172  *
1173  * PARAMETERS:  MessageIdString     - ID to be disabled
1174  *
1175  * RETURN:      Status
1176  *
1177  * DESCRIPTION: Enter a message ID into the global disabled messages table
1178  *
1179  ******************************************************************************/
1180 
1181 ACPI_STATUS
1182 AslDisableException (
1183     char                    *MessageIdString)
1184 {
1185     UINT32                  MessageId;
1186 
1187 
1188     /* Convert argument to an integer and validate it */
1189 
1190     MessageId = (UINT32) strtoul (MessageIdString, NULL, 0);
1191 
1192     if ((MessageId < 2000) || (MessageId > 6999))
1193     {
1194         printf ("\"%s\" is not a valid warning/remark/error ID\n",
1195             MessageIdString);
1196         return (AE_BAD_PARAMETER);
1197     }
1198 
1199     /* Insert value into the global disabled message array */
1200 
1201     if (AslGbl_DisabledMessagesIndex >= ASL_MAX_DISABLED_MESSAGES)
1202     {
1203         printf ("Too many messages have been disabled (max %d)\n",
1204             ASL_MAX_DISABLED_MESSAGES);
1205         return (AE_LIMIT);
1206     }
1207 
1208     AslGbl_DisabledMessages[AslGbl_DisabledMessagesIndex] = MessageId;
1209     AslGbl_DisabledMessagesIndex++;
1210     return (AE_OK);
1211 }
1212 
1213 
1214 /*******************************************************************************
1215  *
1216  * FUNCTION:    AslElevateException
1217  *
1218  * PARAMETERS:  MessageIdString     - ID of excepted exception during compile
1219  *
1220  * RETURN:      Status
1221  *
1222  * DESCRIPTION: Enter a message ID into the global elevated exceptions table.
1223  *              These messages will be considered as compilation errors.
1224  *
1225  ******************************************************************************/
1226 
1227 ACPI_STATUS
1228 AslElevateException (
1229     char                    *MessageIdString)
1230 {
1231     UINT32                  MessageId;
1232 
1233 
1234     /* Convert argument to an integer and validate it */
1235 
1236     MessageId = (UINT32) strtoul (MessageIdString, NULL, 0);
1237 
1238     if (MessageId > 6999)
1239     {
1240         printf ("\"%s\" is not a valid warning/remark/erro ID\n",
1241             MessageIdString);
1242         return (AE_BAD_PARAMETER);
1243     }
1244 
1245     /* Insert value into the global expected message array */
1246 
1247     if (AslGbl_ElevatedMessagesIndex >= ASL_MAX_ELEVATED_MESSAGES)
1248     {
1249         printf ("Too many messages have been registered as elevated (max %d)\n",
1250             ASL_MAX_DISABLED_MESSAGES);
1251         return (AE_LIMIT);
1252     }
1253 
1254     AslGbl_ElevatedMessages[AslGbl_ElevatedMessagesIndex] = MessageId;
1255     AslGbl_ElevatedMessagesIndex++;
1256     return (AE_OK);
1257 }
1258 
1259 /*******************************************************************************
1260  *
1261  * FUNCTION:    AslIsExceptionDisabled
1262  *
1263  * PARAMETERS:  Level           - Seriousness (Warning/error, etc.)
1264  *              MessageId       - Index into global message buffer
1265  *
1266  * RETURN:      TRUE if exception/message should be ignored
1267  *
1268  * DESCRIPTION: Check if the user has specified options such that this
1269  *              exception should be ignored
1270  *
1271  ******************************************************************************/
1272 
1273 static BOOLEAN
1274 AslIsExceptionExpected (
1275     UINT8                   Level,
1276     UINT16                  MessageId)
1277 {
1278     UINT32                  EncodedMessageId;
1279     UINT32                  i;
1280 
1281 
1282     /* Mark this exception as received */
1283 
1284     EncodedMessageId = AeBuildFullExceptionCode (Level, MessageId);
1285     for (i = 0; i < AslGbl_ExpectedMessagesIndex; i++)
1286     {
1287         /* Simple implementation via fixed array */
1288 
1289         if (EncodedMessageId == AslGbl_ExpectedMessages[i].MessageId)
1290         {
1291             return (AslGbl_ExpectedMessages[i].MessageReceived = TRUE);
1292         }
1293     }
1294 
1295     return (FALSE);
1296 }
1297 
1298 
1299 /*******************************************************************************
1300  *
1301  * FUNCTION:    AslIsExceptionDisabled
1302  *
1303  * PARAMETERS:  Level               - Seriousness (Warning/error, etc.)
1304  *              MessageId           - Index into global message buffer
1305  *
1306  * RETURN:      TRUE if exception/message should be ignored
1307  *
1308  * DESCRIPTION: Check if the user has specified options such that this
1309  *              exception should be ignored
1310  *
1311  ******************************************************************************/
1312 
1313 static BOOLEAN
1314 AslIsExceptionDisabled (
1315     UINT8                   Level,
1316     UINT16                  MessageId)
1317 {
1318     UINT32                  EncodedMessageId;
1319     UINT32                  i;
1320 
1321 
1322     switch (Level)
1323     {
1324     case ASL_WARNING2:
1325     case ASL_WARNING3:
1326 
1327         /* Check for global disable via -w1/-w2/-w3 options */
1328 
1329         if (Level > AslGbl_WarningLevel)
1330         {
1331             return (TRUE);
1332         }
1333         /* Fall through */
1334 
1335     case ASL_WARNING:
1336     case ASL_REMARK:
1337     case ASL_ERROR:
1338         /*
1339          * Ignore this error/warning/remark if it has been disabled by
1340          * the user (-vw option)
1341          */
1342         EncodedMessageId = AeBuildFullExceptionCode (Level, MessageId);
1343         for (i = 0; i < AslGbl_DisabledMessagesIndex; i++)
1344         {
1345             /* Simple implementation via fixed array */
1346 
1347             if (EncodedMessageId == AslGbl_DisabledMessages[i])
1348             {
1349                 return (TRUE);
1350             }
1351         }
1352         break;
1353 
1354     default:
1355         break;
1356     }
1357 
1358     return (FALSE);
1359 }
1360 
1361 
1362 /*******************************************************************************
1363  *
1364  * FUNCTION:    AslDualParseOpError
1365  *
1366  * PARAMETERS:  Level           - Seriousness (Warning/error, etc.)
1367  *              MainMsgId       - Index into global message buffer
1368  *              MainOp          - Parse node where error happened
1369  *              MainMsg         - Message pertaining to the MainOp
1370  *              SubMsgId        - Index into global message buffer
1371  *              SubOp           - Additional parse node for better message
1372  *              SubMsg          - Message pertainint to SubOp
1373  *
1374  *
1375  * RETURN:      None
1376  *
1377  * DESCRIPTION: Main error reporting routine for the ASL compiler for error
1378  *              messages that point to multiple parse objects.
1379  *
1380  ******************************************************************************/
1381 
1382 void
1383 AslDualParseOpError (
1384     UINT8                   Level,
1385     UINT16                  MainMsgId,
1386     ACPI_PARSE_OBJECT       *MainOp,
1387     char                    *MainMsg,
1388     UINT16                  SubMsgId,
1389     ACPI_PARSE_OBJECT       *SubOp,
1390     char                    *SubMsg)
1391 {
1392     ASL_ERROR_MSG           *SubEnode = NULL;
1393 
1394 
1395     /* Check if user wants to ignore this exception */
1396 
1397     if (AslIsExceptionIgnored (Level, MainMsgId) || !MainOp)
1398     {
1399         return;
1400     }
1401 
1402     if (SubOp)
1403     {
1404         AslInitEnode (&SubEnode, Level, SubMsgId, SubOp->Asl.LineNumber,
1405             SubOp->Asl.LogicalLineNumber, SubOp->Asl.LogicalByteOffset,
1406             SubOp->Asl.Column, SubOp->Asl.Filename, SubMsg,
1407             NULL, NULL);
1408     }
1409 
1410     AslLogNewError (Level, MainMsgId, MainOp->Asl.LineNumber,
1411         MainOp->Asl.LogicalLineNumber, MainOp->Asl.LogicalByteOffset,
1412         MainOp->Asl.Column, MainOp->Asl.Filename, MainMsg,
1413         NULL, SubEnode);
1414 }
1415 
1416 
1417 /*******************************************************************************
1418  *
1419  * FUNCTION:    AslError
1420  *
1421  * PARAMETERS:  Level               - Seriousness (Warning/error, etc.)
1422  *              MessageId           - Index into global message buffer
1423  *              Op                  - Parse node where error happened
1424  *              ExtraMessage        - additional error message
1425  *
1426  * RETURN:      None
1427  *
1428  * DESCRIPTION: Main error reporting routine for the ASL compiler (all code
1429  *              except the parser.)
1430  *
1431  ******************************************************************************/
1432 
1433 void
1434 AslError (
1435     UINT8                   Level,
1436     UINT16                  MessageId,
1437     ACPI_PARSE_OBJECT       *Op,
1438     char                    *ExtraMessage)
1439 {
1440     if (Op)
1441     {
1442         AslCommonError (Level, MessageId, Op->Asl.LineNumber,
1443             Op->Asl.LogicalLineNumber,
1444             Op->Asl.LogicalByteOffset,
1445             Op->Asl.Column,
1446             Op->Asl.Filename, ExtraMessage);
1447     }
1448     else
1449     {
1450         AslCommonError (Level, MessageId, 0,
1451             0, 0, 0, NULL, ExtraMessage);
1452     }
1453 }
1454 
1455 
1456 /*******************************************************************************
1457  *
1458  * FUNCTION:    AslCoreSubsystemError
1459  *
1460  * PARAMETERS:  Op                  - Parse node where error happened
1461  *              Status              - The ACPICA Exception
1462  *              ExtraMessage        - additional error message
1463  *              Abort               - TRUE -> Abort compilation
1464  *
1465  * RETURN:      None
1466  *
1467  * DESCRIPTION: Error reporting routine for exceptions returned by the ACPICA
1468  *              core subsystem.
1469  *
1470  ******************************************************************************/
1471 
1472 void
1473 AslCoreSubsystemError (
1474     ACPI_PARSE_OBJECT       *Op,
1475     ACPI_STATUS             Status,
1476     char                    *ExtraMessage,
1477     BOOLEAN                 Abort)
1478 {
1479 
1480     sprintf (AslGbl_MsgBuffer, "%s %s", AcpiFormatException (Status), ExtraMessage);
1481 
1482     if (Op)
1483     {
1484         AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION,
1485             Op->Asl.LineNumber,
1486             Op->Asl.LogicalLineNumber,
1487             Op->Asl.LogicalByteOffset,
1488             Op->Asl.Column,
1489             Op->Asl.Filename, AslGbl_MsgBuffer);
1490     }
1491     else
1492     {
1493         AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION,
1494             0, 0, 0, 0, NULL, AslGbl_MsgBuffer);
1495     }
1496 
1497     if (Abort)
1498     {
1499         AslAbort ();
1500     }
1501 }
1502 
1503 
1504 /*******************************************************************************
1505  *
1506  * FUNCTION:    AslCompilererror
1507  *
1508  * PARAMETERS:  CompilerMessage         - Error message from the parser
1509  *
1510  * RETURN:      Status (0 for now)
1511  *
1512  * DESCRIPTION: Report an error situation discovered in a production
1513  *              NOTE: don't change the name of this function, it is called
1514  *              from the auto-generated parser.
1515  *
1516  ******************************************************************************/
1517 
1518 int
1519 AslCompilererror (
1520     const char              *CompilerMessage)
1521 {
1522 
1523     AslGbl_SyntaxError++;
1524 
1525     AslCommonError (ASL_ERROR, ASL_MSG_SYNTAX, AslGbl_CurrentLineNumber,
1526         AslGbl_LogicalLineNumber, AslGbl_CurrentLineOffset,
1527         AslGbl_CurrentColumn, AslGbl_Files[ASL_FILE_INPUT].Filename,
1528         ACPI_CAST_PTR (char, CompilerMessage));
1529 
1530     return (0);
1531 }
1532