aslerror.c revision 259065
1/******************************************************************************
2 *
3 * Module Name: aslerror - Error handling and statistics
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 *    notice, this list of conditions, and the following disclaimer,
16 *    without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 *    substantially similar to the "NO WARRANTY" disclaimer below
19 *    ("Disclaimer") and any redistribution must be conditioned upon
20 *    including a substantially similar Disclaimer requirement for further
21 *    binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 *    of any contributors may be used to endorse or promote products derived
24 *    from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#define ASL_EXCEPTIONS
45#include <contrib/dev/acpica/compiler/aslcompiler.h>
46
47#define _COMPONENT          ACPI_COMPILER
48        ACPI_MODULE_NAME    ("aslerror")
49
50/* Local prototypes */
51
52static void
53AeAddToErrorLog (
54    ASL_ERROR_MSG           *Enode);
55
56
57/*******************************************************************************
58 *
59 * FUNCTION:    AeClearErrorLog
60 *
61 * PARAMETERS:  None
62 *
63 * RETURN:      None
64 *
65 * DESCRIPTION: Empty the error list
66 *
67 ******************************************************************************/
68
69void
70AeClearErrorLog (
71    void)
72{
73    ASL_ERROR_MSG           *Enode = Gbl_ErrorLog;
74    ASL_ERROR_MSG           *Next;
75
76    /* Walk the error node list */
77
78    while (Enode)
79    {
80        Next = Enode->Next;
81        ACPI_FREE (Enode);
82        Enode = Next;
83    }
84
85    Gbl_ErrorLog = NULL;
86}
87
88
89/*******************************************************************************
90 *
91 * FUNCTION:    AeAddToErrorLog
92 *
93 * PARAMETERS:  Enode       - An error node to add to the log
94 *
95 * RETURN:      None
96 *
97 * DESCRIPTION: Add a new error node to the error log. The error log is
98 *              ordered by the "logical" line number (cumulative line number
99 *              including all include files.)
100 *
101 ******************************************************************************/
102
103static void
104AeAddToErrorLog (
105    ASL_ERROR_MSG           *Enode)
106{
107    ASL_ERROR_MSG           *Next;
108    ASL_ERROR_MSG           *Prev;
109
110
111    /* If Gbl_ErrorLog is null, this is the first error node */
112
113    if (!Gbl_ErrorLog)
114    {
115        Gbl_ErrorLog = Enode;
116        return;
117    }
118
119    /*
120     * Walk error list until we find a line number greater than ours.
121     * List is sorted according to line number.
122     */
123    Prev = NULL;
124    Next = Gbl_ErrorLog;
125
126    while ((Next) &&
127           (Next->LogicalLineNumber <= Enode->LogicalLineNumber))
128    {
129        Prev = Next;
130        Next = Next->Next;
131    }
132
133    /* Found our place in the list */
134
135    Enode->Next = Next;
136
137    if (Prev)
138    {
139        Prev->Next = Enode;
140    }
141    else
142    {
143        Gbl_ErrorLog = Enode;
144    }
145}
146
147
148/*******************************************************************************
149 *
150 * FUNCTION:    AePrintException
151 *
152 * PARAMETERS:  FileId          - ID of output file
153 *              Enode           - Error node to print
154 *              Header          - Additional text before each message
155 *
156 * RETURN:      None
157 *
158 * DESCRIPTION: Print the contents of an error node.
159 *
160 * NOTE:        We don't use the FlxxxFile I/O functions here because on error
161 *              they abort the compiler and call this function!  Since we
162 *              are reporting errors here, we ignore most output errors and
163 *              just try to get out as much as we can.
164 *
165 ******************************************************************************/
166
167void
168AePrintException (
169    UINT32                  FileId,
170    ASL_ERROR_MSG           *Enode,
171    char                    *Header)
172{
173    UINT8                   SourceByte;
174    int                     Actual;
175    size_t                  RActual;
176    UINT32                  MsgLength;
177    char                    *MainMessage;
178    char                    *ExtraMessage;
179    UINT32                  SourceColumn;
180    UINT32                  ErrorColumn;
181    FILE                    *OutputFile;
182    FILE                    *SourceFile = NULL;
183    long                    FileSize;
184    BOOLEAN                 PrematureEOF = FALSE;
185    UINT32                  Total = 0;
186
187
188    if (Gbl_NoErrors)
189    {
190        return;
191    }
192
193    /*
194     * Only listing files have a header, and remarks/optimizations
195     * are always output
196     */
197    if (!Header)
198    {
199        /* Ignore remarks if requested */
200
201        switch (Enode->Level)
202        {
203        case ASL_REMARK:
204
205            if (!Gbl_DisplayRemarks)
206            {
207                return;
208            }
209            break;
210
211        case ASL_OPTIMIZATION:
212
213            if (!Gbl_DisplayOptimizations)
214            {
215                return;
216            }
217            break;
218
219        default:
220
221            break;
222        }
223    }
224
225    /* Get the file handles */
226
227    OutputFile = Gbl_Files[FileId].Handle;
228
229
230    if (!Enode->SourceLine)
231    {
232        /* Use the merged header/source file if present, otherwise use input file */
233
234        SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle;
235        if (!SourceFile)
236        {
237            SourceFile = Gbl_Files[ASL_FILE_INPUT].Handle;
238        }
239
240        if (SourceFile)
241        {
242            /* Determine if the error occurred at source file EOF */
243
244            fseek (SourceFile, 0, SEEK_END);
245            FileSize = ftell (SourceFile);
246
247            if ((long) Enode->LogicalByteOffset >= FileSize)
248            {
249                PrematureEOF = TRUE;
250            }
251        }
252    }
253
254    if (Header)
255    {
256        fprintf (OutputFile, "%s", Header);
257    }
258
259    /* Print filename and line number if present and valid */
260
261    if (Enode->Filename)
262    {
263        if (Gbl_VerboseErrors)
264        {
265            fprintf (OutputFile, "%-8s", Enode->Filename);
266
267            if (Enode->LineNumber)
268            {
269                if (Enode->SourceLine)
270                {
271                    fprintf (OutputFile, " %6u: %s",
272                        Enode->LineNumber, Enode->SourceLine);
273                }
274                else
275                {
276                    fprintf (OutputFile, " %6u: ", Enode->LineNumber);
277
278                    /*
279                     * If not at EOF, get the corresponding source code line and
280                     * display it. Don't attempt this if we have a premature EOF
281                     * condition.
282                     */
283                    if (!PrematureEOF)
284                    {
285                        /*
286                         * Seek to the offset in the combined source file, read
287                         * the source line, and write it to the output.
288                         */
289                        Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset,
290                                    (int) SEEK_SET);
291                        if (Actual)
292                        {
293                            fprintf (OutputFile,
294                                "[*** iASL: Seek error on source code temp file %s ***]",
295                                Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
296                        }
297                        else
298                        {
299                            RActual = fread (&SourceByte, 1, 1, SourceFile);
300                            if (RActual != 1)
301                            {
302                                fprintf (OutputFile,
303                                    "[*** iASL: Read error on source code temp file %s ***]",
304                                    Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
305                            }
306                            else
307                            {
308                                /* Read/write the source line, up to the maximum line length */
309
310                                while (RActual && SourceByte && (SourceByte != '\n'))
311                                {
312                                    if (Total < 256)
313                                    {
314                                        /* After the max line length, we will just read the line, no write */
315
316                                        if (fwrite (&SourceByte, 1, 1, OutputFile) != 1)
317                                        {
318                                            printf ("[*** iASL: Write error on output file ***]\n");
319                                            return;
320                                        }
321                                    }
322                                    else if (Total == 256)
323                                    {
324                                        fprintf (OutputFile,
325                                            "\n[*** iASL: Very long input line, message below refers to column %u ***]",
326                                            Enode->Column);
327                                    }
328
329                                    RActual = fread (&SourceByte, 1, 1, SourceFile);
330                                    if (RActual != 1)
331                                    {
332                                        fprintf (OutputFile,
333                                            "[*** iASL: Read error on source code temp file %s ***]",
334                                            Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
335                                        return;
336                                    }
337                                    Total++;
338                                }
339                            }
340                        }
341                    }
342
343                    fprintf (OutputFile, "\n");
344                }
345            }
346        }
347        else
348        {
349            /*
350             * Less verbose version of the error message, enabled via the
351             * -vi switch. The format is compatible with MS Visual Studio.
352             */
353            fprintf (OutputFile, "%s", Enode->Filename);
354
355            if (Enode->LineNumber)
356            {
357                fprintf (OutputFile, "(%u) : ",
358                    Enode->LineNumber);
359            }
360        }
361    }
362
363    /* NULL message ID, just print the raw message */
364
365    if (Enode->MessageId == 0)
366    {
367        fprintf (OutputFile, "%s\n", Enode->Message);
368    }
369    else
370    {
371        /* Decode the message ID */
372
373        if (Gbl_VerboseErrors)
374        {
375            fprintf (OutputFile, "%s %4.4d -",
376                        AslErrorLevel[Enode->Level],
377                        Enode->MessageId + ((Enode->Level+1) * 1000));
378        }
379        else /* IDE case */
380        {
381            fprintf (OutputFile, "%s %4.4d:",
382                        AslErrorLevelIde[Enode->Level],
383                        Enode->MessageId + ((Enode->Level+1) * 1000));
384        }
385
386        MainMessage = AslMessages[Enode->MessageId];
387        ExtraMessage = Enode->Message;
388
389        if (Enode->LineNumber)
390        {
391            /* Main message: try to use string from AslMessages first */
392
393            if (!MainMessage)
394            {
395                MainMessage = "";
396            }
397
398            MsgLength = strlen (MainMessage);
399            if (MsgLength == 0)
400            {
401                /* Use the secondary/extra message as main message */
402
403                MainMessage = Enode->Message;
404                if (!MainMessage)
405                {
406                    MainMessage = "";
407                }
408
409                MsgLength = strlen (MainMessage);
410                ExtraMessage = NULL;
411            }
412
413            if (Gbl_VerboseErrors && !PrematureEOF)
414            {
415                if (Total >= 256)
416                {
417                    fprintf (OutputFile, "    %s",
418                        MainMessage);
419                }
420                else
421                {
422                    SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2;
423                    ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1;
424
425                    if ((MsgLength + ErrorColumn) < (SourceColumn - 1))
426                    {
427                        fprintf (OutputFile, "%*s%s",
428                            (int) ((SourceColumn - 1) - ErrorColumn),
429                            MainMessage, " ^ ");
430                    }
431                    else
432                    {
433                        fprintf (OutputFile, "%*s %s",
434                            (int) ((SourceColumn - ErrorColumn) + 1), "^",
435                            MainMessage);
436                    }
437                }
438            }
439            else
440            {
441                fprintf (OutputFile, " %s", MainMessage);
442            }
443
444            /* Print the extra info message if present */
445
446            if (ExtraMessage)
447            {
448                fprintf (OutputFile, " (%s)", ExtraMessage);
449            }
450
451            if (PrematureEOF)
452            {
453                fprintf (OutputFile, " and premature End-Of-File");
454            }
455
456            fprintf (OutputFile, "\n");
457            if (Gbl_VerboseErrors)
458            {
459                fprintf (OutputFile, "\n");
460            }
461        }
462        else
463        {
464            fprintf (OutputFile, " %s %s\n\n", MainMessage, ExtraMessage);
465        }
466    }
467}
468
469
470/*******************************************************************************
471 *
472 * FUNCTION:    AePrintErrorLog
473 *
474 * PARAMETERS:  FileId           - Where to output the error log
475 *
476 * RETURN:      None
477 *
478 * DESCRIPTION: Print the entire contents of the error log
479 *
480 ******************************************************************************/
481
482void
483AePrintErrorLog (
484    UINT32                  FileId)
485{
486    ASL_ERROR_MSG           *Enode = Gbl_ErrorLog;
487
488
489    /* Walk the error node list */
490
491    while (Enode)
492    {
493        AePrintException (FileId, Enode, NULL);
494        Enode = Enode->Next;
495    }
496}
497
498
499/*******************************************************************************
500 *
501 * FUNCTION:    AslCommonError2
502 *
503 * PARAMETERS:  Level               - Seriousness (Warning/error, etc.)
504 *              MessageId           - Index into global message buffer
505 *              LineNumber          - Actual file line number
506 *              Column              - Column in current line
507 *              SourceLine          - Actual source code line
508 *              Filename            - source filename
509 *              ExtraMessage        - additional error message
510 *
511 * RETURN:      None
512 *
513 * DESCRIPTION: Create a new error node and add it to the error log
514 *
515 ******************************************************************************/
516
517void
518AslCommonError2 (
519    UINT8                   Level,
520    UINT8                   MessageId,
521    UINT32                  LineNumber,
522    UINT32                  Column,
523    char                    *SourceLine,
524    char                    *Filename,
525    char                    *ExtraMessage)
526{
527    char                    *MessageBuffer = NULL;
528    char                    *LineBuffer;
529    ASL_ERROR_MSG           *Enode;
530
531
532    Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG));
533
534    if (ExtraMessage)
535    {
536        /* Allocate a buffer for the message and a new error node */
537
538        MessageBuffer = UtLocalCalloc (strlen (ExtraMessage) + 1);
539
540        /* Keep a copy of the extra message */
541
542        ACPI_STRCPY (MessageBuffer, ExtraMessage);
543    }
544
545    LineBuffer = UtLocalCalloc (strlen (SourceLine) + 1);
546    ACPI_STRCPY (LineBuffer, SourceLine);
547
548    /* Initialize the error node */
549
550    if (Filename)
551    {
552        Enode->Filename       = Filename;
553        Enode->FilenameLength = strlen (Filename);
554        if (Enode->FilenameLength < 6)
555        {
556            Enode->FilenameLength = 6;
557        }
558    }
559
560    Enode->MessageId            = MessageId;
561    Enode->Level                = Level;
562    Enode->LineNumber           = LineNumber;
563    Enode->LogicalLineNumber    = LineNumber;
564    Enode->LogicalByteOffset    = 0;
565    Enode->Column               = Column;
566    Enode->Message              = MessageBuffer;
567    Enode->SourceLine           = LineBuffer;
568
569    /* Add the new node to the error node list */
570
571    AeAddToErrorLog (Enode);
572
573    if (Gbl_DebugFlag)
574    {
575        /* stderr is a file, send error to it immediately */
576
577        AePrintException (ASL_FILE_STDERR, Enode, NULL);
578    }
579
580    Gbl_ExceptionCount[Level]++;
581}
582
583
584/*******************************************************************************
585 *
586 * FUNCTION:    AslCommonError
587 *
588 * PARAMETERS:  Level               - Seriousness (Warning/error, etc.)
589 *              MessageId           - Index into global message buffer
590 *              CurrentLineNumber   - Actual file line number
591 *              LogicalLineNumber   - Cumulative line number
592 *              LogicalByteOffset   - Byte offset in source file
593 *              Column              - Column in current line
594 *              Filename            - source filename
595 *              ExtraMessage        - additional error message
596 *
597 * RETURN:      None
598 *
599 * DESCRIPTION: Create a new error node and add it to the error log
600 *
601 ******************************************************************************/
602
603void
604AslCommonError (
605    UINT8                   Level,
606    UINT8                   MessageId,
607    UINT32                  CurrentLineNumber,
608    UINT32                  LogicalLineNumber,
609    UINT32                  LogicalByteOffset,
610    UINT32                  Column,
611    char                    *Filename,
612    char                    *ExtraMessage)
613{
614    UINT32                  MessageSize;
615    char                    *MessageBuffer = NULL;
616    ASL_ERROR_MSG           *Enode;
617
618
619    Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG));
620
621    if (ExtraMessage)
622    {
623        /* Allocate a buffer for the message and a new error node */
624
625        MessageSize   = strlen (ExtraMessage) + 1;
626        MessageBuffer = UtLocalCalloc (MessageSize);
627
628        /* Keep a copy of the extra message */
629
630        ACPI_STRCPY (MessageBuffer, ExtraMessage);
631    }
632
633    /* Initialize the error node */
634
635    if (Filename)
636    {
637        Enode->Filename       = Filename;
638        Enode->FilenameLength = strlen (Filename);
639        if (Enode->FilenameLength < 6)
640        {
641            Enode->FilenameLength = 6;
642        }
643    }
644
645    Enode->MessageId            = MessageId;
646    Enode->Level                = Level;
647    Enode->LineNumber           = CurrentLineNumber;
648    Enode->LogicalLineNumber    = LogicalLineNumber;
649    Enode->LogicalByteOffset    = LogicalByteOffset;
650    Enode->Column               = Column;
651    Enode->Message              = MessageBuffer;
652    Enode->SourceLine           = NULL;
653
654    /* Add the new node to the error node list */
655
656    AeAddToErrorLog (Enode);
657
658    if (Gbl_DebugFlag)
659    {
660        /* stderr is a file, send error to it immediately */
661
662        AePrintException (ASL_FILE_STDERR, Enode, NULL);
663    }
664
665    Gbl_ExceptionCount[Level]++;
666    if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
667    {
668        printf ("\nMaximum error count (%u) exceeded\n", ASL_MAX_ERROR_COUNT);
669
670        Gbl_SourceLine = 0;
671        Gbl_NextError = Gbl_ErrorLog;
672        CmCleanupAndExit ();
673        exit(1);
674    }
675
676    return;
677}
678
679
680/*******************************************************************************
681 *
682 * FUNCTION:    AslDisableException
683 *
684 * PARAMETERS:  MessageIdString     - ID to be disabled
685 *
686 * RETURN:      Status
687 *
688 * DESCRIPTION: Enter a message ID into the global disabled messages table
689 *
690 ******************************************************************************/
691
692ACPI_STATUS
693AslDisableException (
694    char                    *MessageIdString)
695{
696    UINT32                  MessageId;
697
698
699    /* Convert argument to an integer and validate it */
700
701    MessageId = (UINT32) strtoul (MessageIdString, NULL, 0);
702
703    if ((MessageId < 2000) || (MessageId > 5999))
704    {
705        printf ("\"%s\" is not a valid warning/remark ID\n",
706            MessageIdString);
707        return (AE_BAD_PARAMETER);
708    }
709
710    /* Insert value into the global disabled message array */
711
712    if (Gbl_DisabledMessagesIndex >= ASL_MAX_DISABLED_MESSAGES)
713    {
714        printf ("Too many messages have been disabled (max %u)\n",
715            ASL_MAX_DISABLED_MESSAGES);
716        return (AE_LIMIT);
717    }
718
719    Gbl_DisabledMessages[Gbl_DisabledMessagesIndex] = MessageId;
720    Gbl_DisabledMessagesIndex++;
721    return (AE_OK);
722}
723
724
725/*******************************************************************************
726 *
727 * FUNCTION:    AslIsExceptionDisabled
728 *
729 * PARAMETERS:  Level               - Seriousness (Warning/error, etc.)
730 *              MessageId           - Index into global message buffer
731 *
732 * RETURN:      TRUE if exception/message should be ignored
733 *
734 * DESCRIPTION: Check if the user has specified options such that this
735 *              exception should be ignored
736 *
737 ******************************************************************************/
738
739BOOLEAN
740AslIsExceptionDisabled (
741    UINT8                   Level,
742    UINT8                   MessageId)
743{
744    UINT32                  EncodedMessageId;
745    UINT32                  i;
746
747
748    switch (Level)
749    {
750    case ASL_WARNING2:
751    case ASL_WARNING3:
752
753        /* Check for global disable via -w1/-w2/-w3 options */
754
755        if (Level > Gbl_WarningLevel)
756        {
757            return (TRUE);
758        }
759        /* Fall through */
760
761    case ASL_WARNING:
762    case ASL_REMARK:
763        /*
764         * Ignore this warning/remark if it has been disabled by
765         * the user (-vw option)
766         */
767        EncodedMessageId = MessageId + ((Level + 1) * 1000);
768        for (i = 0; i < Gbl_DisabledMessagesIndex; i++)
769        {
770            /* Simple implementation via fixed array */
771
772            if (EncodedMessageId == Gbl_DisabledMessages[i])
773            {
774                return (TRUE);
775            }
776        }
777        break;
778
779    default:
780        break;
781    }
782
783    return (FALSE);
784}
785
786
787/*******************************************************************************
788 *
789 * FUNCTION:    AslError
790 *
791 * PARAMETERS:  Level               - Seriousness (Warning/error, etc.)
792 *              MessageId           - Index into global message buffer
793 *              Op                  - Parse node where error happened
794 *              ExtraMessage        - additional error message
795 *
796 * RETURN:      None
797 *
798 * DESCRIPTION: Main error reporting routine for the ASL compiler (all code
799 *              except the parser.)
800 *
801 ******************************************************************************/
802
803void
804AslError (
805    UINT8                   Level,
806    UINT8                   MessageId,
807    ACPI_PARSE_OBJECT       *Op,
808    char                    *ExtraMessage)
809{
810
811    /* Check if user wants to ignore this exception */
812
813    if (AslIsExceptionDisabled (Level, MessageId))
814    {
815        return;
816    }
817
818    if (Op)
819    {
820        AslCommonError (Level, MessageId, Op->Asl.LineNumber,
821            Op->Asl.LogicalLineNumber,
822            Op->Asl.LogicalByteOffset,
823            Op->Asl.Column,
824            Op->Asl.Filename, ExtraMessage);
825    }
826    else
827    {
828        AslCommonError (Level, MessageId, 0,
829            0, 0, 0, NULL, ExtraMessage);
830    }
831}
832
833
834/*******************************************************************************
835 *
836 * FUNCTION:    AslCoreSubsystemError
837 *
838 * PARAMETERS:  Op                  - Parse node where error happened
839 *              Status              - The ACPI CA Exception
840 *              ExtraMessage        - additional error message
841 *              Abort               - TRUE -> Abort compilation
842 *
843 * RETURN:      None
844 *
845 * DESCRIPTION: Error reporting routine for exceptions returned by the ACPI
846 *              CA core subsystem.
847 *
848 ******************************************************************************/
849
850void
851AslCoreSubsystemError (
852    ACPI_PARSE_OBJECT       *Op,
853    ACPI_STATUS             Status,
854    char                    *ExtraMessage,
855    BOOLEAN                 Abort)
856{
857
858    sprintf (MsgBuffer, "%s %s", AcpiFormatException (Status), ExtraMessage);
859
860    if (Op)
861    {
862        AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, Op->Asl.LineNumber,
863                        Op->Asl.LogicalLineNumber,
864                        Op->Asl.LogicalByteOffset,
865                        Op->Asl.Column,
866                        Op->Asl.Filename, MsgBuffer);
867    }
868    else
869    {
870        AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, 0,
871                        0, 0, 0, NULL, MsgBuffer);
872    }
873
874    if (Abort)
875    {
876        AslAbort ();
877    }
878}
879
880
881/*******************************************************************************
882 *
883 * FUNCTION:    AslCompilererror
884 *
885 * PARAMETERS:  CompilerMessage         - Error message from the parser
886 *
887 * RETURN:      Status (0 for now)
888 *
889 * DESCRIPTION: Report an error situation discovered in a production
890 *              NOTE: don't change the name of this function, it is called
891 *              from the auto-generated parser.
892 *
893 ******************************************************************************/
894
895int
896AslCompilererror (
897    const char              *CompilerMessage)
898{
899
900    AslCommonError (ASL_ERROR, ASL_MSG_SYNTAX, Gbl_CurrentLineNumber,
901        Gbl_LogicalLineNumber, Gbl_CurrentLineOffset,
902        Gbl_CurrentColumn, Gbl_Files[ASL_FILE_INPUT].Filename,
903        ACPI_CAST_PTR (char, CompilerMessage));
904
905    return (0);
906}
907