diff options
| author | Jung-uk Kim <jkim@FreeBSD.org> | 2018-12-13 19:04:25 +0000 | 
|---|---|---|
| committer | Jung-uk Kim <jkim@FreeBSD.org> | 2018-12-13 19:04:25 +0000 | 
| commit | d28459aaaf532373b12c80aa5b869f8b591954e7 (patch) | |
| tree | 22941844047df08d63d286d7dfbf38f3a8f79e0f /source/compiler | |
| parent | 4d4b15a0e8524e15826ac932bd05252dbd246422 (diff) | |
Notes
Diffstat (limited to 'source/compiler')
| -rw-r--r-- | source/compiler/aslcodegen.c | 6 | ||||
| -rw-r--r-- | source/compiler/aslcompile.c | 27 | ||||
| -rw-r--r-- | source/compiler/aslcompiler.h | 4 | ||||
| -rw-r--r-- | source/compiler/aslerror.c | 97 | ||||
| -rw-r--r-- | source/compiler/aslglobal.h | 4 | ||||
| -rw-r--r-- | source/compiler/aslhelp.c | 1 | ||||
| -rw-r--r-- | source/compiler/asllength.c | 5 | ||||
| -rw-r--r-- | source/compiler/aslopcodes.c | 9 | ||||
| -rw-r--r-- | source/compiler/asloptions.c | 17 | ||||
| -rw-r--r-- | source/compiler/asltransform.c | 6 | 
10 files changed, 132 insertions, 44 deletions
| diff --git a/source/compiler/aslcodegen.c b/source/compiler/aslcodegen.c index 7b2e3e5ce0c8..356011f0608c 100644 --- a/source/compiler/aslcodegen.c +++ b/source/compiler/aslcodegen.c @@ -773,12 +773,6 @@ CgWriteNode (          return;      } -    if ((Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) && -        AslGbl_DoExternals == FALSE) -    { -        return; -    } -      Op->Asl.FinalAmlLength = 0;      switch (Op->Asl.AmlOpcode) diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index 4ae190763cc9..1b8838aabae6 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -388,23 +388,20 @@ CmDoCompile (      /* Resolve External Declarations */ -    if (AslGbl_DoExternals) -    { -        Event = UtBeginEvent ("Resolve all Externals"); -        DbgPrint (ASL_DEBUG_OUTPUT, "\nResolve Externals\n\n"); +    Event = UtBeginEvent ("Resolve all Externals"); +    DbgPrint (ASL_DEBUG_OUTPUT, "\nResolve Externals\n\n"); -        if (AslGbl_DoExternalsInPlace) -        { -            TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, -                ExAmlExternalWalkBegin, NULL, NULL); -        } -        else -        { -            TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, -                ExAmlExternalWalkBegin, ExAmlExternalWalkEnd, NULL); -        } -        UtEndEvent (Event); +    if (AslGbl_DoExternalsInPlace) +    { +        TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, +            ExAmlExternalWalkBegin, NULL, NULL);      } +    else +    { +        TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, +            ExAmlExternalWalkBegin, ExAmlExternalWalkEnd, NULL); +    } +    UtEndEvent (Event);      /*       * Semantic analysis. This can happen only after the diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index bd02879d584a..c5e8cb0c2537 100644 --- a/source/compiler/aslcompiler.h +++ b/source/compiler/aslcompiler.h @@ -475,6 +475,10 @@ AslExpectException (      char                    *MessageIdString);  ACPI_STATUS +AslElevateException ( +    char                    *MessageIdString); + +ACPI_STATUS  AslDisableException (      char                    *MessageIdString); diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c index 10ea3ec1b4bd..2a18dded597e 100644 --- a/source/compiler/aslerror.c +++ b/source/compiler/aslerror.c @@ -201,6 +201,11 @@ AePrintSubError (      FILE                    *OutputFile,      ASL_ERROR_MSG           *Enode); +static UINT8 +GetModifiedLevel ( +    UINT8                   Level, +    UINT16                  MessageId); +  /*******************************************************************************   * @@ -968,11 +973,12 @@ AslLogNewError (      ASL_ERROR_MSG           *SubError)  {      ASL_ERROR_MSG           *Enode = NULL; +    UINT8                   ModifiedLevel = GetModifiedLevel (Level, MessageId); -    AslInitEnode (&Enode, Level, MessageId, LineNumber, LogicalLineNumber, -        LogicalByteOffset, Column, Filename, Message, SourceLine, -        SubError); +    AslInitEnode (&Enode, ModifiedLevel, MessageId, LineNumber, +        LogicalLineNumber, LogicalByteOffset, Column, Filename, Message, +        SourceLine, SubError);      /* Add the new node to the error node list */ @@ -985,7 +991,7 @@ AslLogNewError (          AePrintException (ASL_FILE_STDERR, Enode, NULL);      } -    AslGbl_ExceptionCount[Level]++; +    AslGbl_ExceptionCount[ModifiedLevel]++;      if (AslGbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)      {          printf ("\nMaximum error count (%u) exceeded\n", ASL_MAX_ERROR_COUNT); @@ -999,6 +1005,44 @@ AslLogNewError (      return;  } + +/******************************************************************************* + * + * FUNCTION:    GetModifiedLevel + * + * PARAMETERS:  Level           - Seriousness (Warning/error, etc.) + *              MessageId       - Index into global message buffer + * + * RETURN:      UINT8           - modified level + * + * DESCRIPTION: Get the modified level of exception codes that are reported as + *              errors from the -ww option. + * + ******************************************************************************/ + +static UINT8 +GetModifiedLevel ( +    UINT8                   Level, +    UINT16                  MessageId) +{ +    UINT16                  i; +    UINT16                  ExceptionCode; + + +    ExceptionCode = AeBuildFullExceptionCode (Level, MessageId); + +    for (i = 0; i < AslGbl_ElevatedMessagesIndex; i++) +    { +        if (ExceptionCode == AslGbl_ElevatedMessages[i]) +        { +            return (ASL_ERROR); +        } +    } + +    return (Level); +} + +  /*******************************************************************************   *   * FUNCTION:    AslIsExceptionIgnored @@ -1157,6 +1201,51 @@ AslDisableException (  /*******************************************************************************   * + * FUNCTION:    AslElevateException + * + * PARAMETERS:  MessageIdString     - ID of excepted exception during compile + * + * RETURN:      Status + * + * DESCRIPTION: Enter a message ID into the global elevated exceptions table. + *              These messages will be considered as compilation errors. + * + ******************************************************************************/ + +ACPI_STATUS +AslElevateException ( +    char                    *MessageIdString) +{ +    UINT32                  MessageId; + + +    /* Convert argument to an integer and validate it */ + +    MessageId = (UINT32) strtoul (MessageIdString, NULL, 0); + +    if (MessageId > 6999) +    { +        printf ("\"%s\" is not a valid warning/remark/erro ID\n", +            MessageIdString); +        return (AE_BAD_PARAMETER); +    } + +    /* Insert value into the global expected message array */ + +    if (AslGbl_ElevatedMessagesIndex >= ASL_MAX_ELEVATED_MESSAGES) +    { +        printf ("Too many messages have been registered as elevated (max %d)\n", +            ASL_MAX_DISABLED_MESSAGES); +        return (AE_LIMIT); +    } + +    AslGbl_ElevatedMessages[AslGbl_ExpectedMessagesIndex] = MessageId; +    AslGbl_ElevatedMessagesIndex++; +    return (AE_OK); +} + +/******************************************************************************* + *   * FUNCTION:    AslIsExceptionDisabled   *   * PARAMETERS:  Level           - Seriousness (Warning/error, etc.) diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h index c3e69cbbda3d..fd00da7802db 100644 --- a/source/compiler/aslglobal.h +++ b/source/compiler/aslglobal.h @@ -255,6 +255,7 @@ extern int                  AslCompilerdebug;  #define ASL_STRING_BUFFER_SIZE          (1024 * 32) /* 32k */  #define ASL_MAX_DISABLED_MESSAGES       32  #define ASL_MAX_EXPECTED_MESSAGES       32 +#define ASL_MAX_ELEVATED_MESSAGES       32  #define HEX_TABLE_LINE_SIZE             8  #define HEX_LISTING_LINE_SIZE           8 @@ -319,7 +320,6 @@ ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (AslGbl_AllExceptionsDisable  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (AslGbl_PruneParseTree, FALSE);  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (AslGbl_DoTypechecking, TRUE);  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (AslGbl_EnableReferenceTypechecking, FALSE); -ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (AslGbl_DoExternals, TRUE);  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (AslGbl_DoExternalsInPlace, FALSE);  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (AslGbl_DoAslConversion, FALSE);  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (AslGbl_OptimizeTrivialParseNodes, TRUE); @@ -394,6 +394,7 @@ ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (AslGbl_CurrentAmlOffset, 0)  ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (AslGbl_CurrentLine, 0);  ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (AslGbl_DisabledMessagesIndex, 0);  ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (AslGbl_ExpectedMessagesIndex, 0); +ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (AslGbl_ElevatedMessagesIndex, 0);  ASL_EXTERN UINT8                    ASL_INIT_GLOBAL (AslGbl_HexBytesWereWritten, FALSE);  ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (AslGbl_NumNamespaceObjects, 0);  ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (AslGbl_ReservedMethods, 0); @@ -435,6 +436,7 @@ ASL_EXTERN char                     AslGbl_StringBuffer[ASL_STRING_BUFFER_SIZE];  ASL_EXTERN char                     AslGbl_StringBuffer2[ASL_STRING_BUFFER_SIZE];  ASL_EXTERN UINT32                   AslGbl_DisabledMessages[ASL_MAX_DISABLED_MESSAGES];  ASL_EXTERN ASL_EXPECTED_MESSAGE     AslGbl_ExpectedMessages[ASL_MAX_EXPECTED_MESSAGES]; +ASL_EXTERN UINT32                   AslGbl_ElevatedMessages[ASL_MAX_ELEVATED_MESSAGES];  #endif /* __ASLGLOBAL_H */ diff --git a/source/compiler/aslhelp.c b/source/compiler/aslhelp.c index 608f18532b54..4377f83c6221 100644 --- a/source/compiler/aslhelp.c +++ b/source/compiler/aslhelp.c @@ -209,6 +209,7 @@ Usage (      ACPI_OPTION ("-vx <messageid>", "Expect a specific warning, remark, or error");      ACPI_OPTION ("-w <1|2|3>",      "Set warning reporting level");      ACPI_OPTION ("-we",             "Report warnings as errors"); +    ACPI_OPTION ("-ww <messageid>", "Report specific warning or remark as error");      printf ("\nAML Bytecode Generation (*.aml):\n");      ACPI_OPTION ("-oa",             "Disable all optimizations (compatibility mode)"); diff --git a/source/compiler/asllength.c b/source/compiler/asllength.c index 696dc2424128..8fef83b91742 100644 --- a/source/compiler/asllength.c +++ b/source/compiler/asllength.c @@ -519,10 +519,7 @@ CgGenerateAmlLengths (      case PARSEOP_EXTERNAL: -        if (AslGbl_DoExternals == TRUE) -        { -            CgGenerateAmlOpcodeLength (Op); -        } +        CgGenerateAmlOpcodeLength (Op);          break;      default: diff --git a/source/compiler/aslopcodes.c b/source/compiler/aslopcodes.c index 218223b836b1..32d04781c5d4 100644 --- a/source/compiler/aslopcodes.c +++ b/source/compiler/aslopcodes.c @@ -927,15 +927,6 @@ OpcGenerateAmlOpcode (          AslGbl_HasIncludeFiles = TRUE;          break; -    case PARSEOP_EXTERNAL: - -        if (AslGbl_DoExternals == FALSE) -        { -            Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; -            Op->Asl.Child->Asl.Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; -        } -        break; -      case PARSEOP_TIMER:          if (AcpiGbl_IntegerBitWidth == 32) diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c index 15519634ae92..325ee4aca7ca 100644 --- a/source/compiler/asloptions.c +++ b/source/compiler/asloptions.c @@ -982,6 +982,23 @@ AslDoOptions (              AslGbl_WarningsAsErrors = TRUE;              break; +        case 'w': + +            /* Get the required argument */ + +            if (AcpiGetoptArgument (argc, argv)) +            { +                return (-1); +            } + +            Status = AslElevateException (AcpiGbl_Optarg); +            if (ACPI_FAILURE (Status)) +            { +                return (-1); +            } +            break; + +          default:              printf ("Unknown option: -w%s\n", AcpiGbl_Optarg); diff --git a/source/compiler/asltransform.c b/source/compiler/asltransform.c index 324b0364dc9d..2bf32db4b9f8 100644 --- a/source/compiler/asltransform.c +++ b/source/compiler/asltransform.c @@ -460,11 +460,7 @@ TrTransformSubtree (      case PARSEOP_EXTERNAL: -        if (AslGbl_DoExternals == TRUE) -        { -            ExDoExternal (Op); -        } - +        ExDoExternal (Op);          break;      case PARSEOP___METHOD__: | 
