Home | History | Annotate | Download | only in Ecc
      1 ## @file

      2 # Standardized Error Hanlding infrastructures.

      3 #

      4 # Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>

      5 # This program and the accompanying materials

      6 # are licensed and made available under the terms and conditions of the BSD License

      7 # which accompanies this distribution.  The full text of the license may be found at

      8 # http://opensource.org/licenses/bsd-license.php

      9 #

     10 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,

     11 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

     12 #

     13 
     14 ERROR_GENERAL_CHECK_ALL = 1000
     15 ERROR_GENERAL_CHECK_NO_TAB = 1001
     16 ERROR_GENERAL_CHECK_INDENTATION = 1002
     17 ERROR_GENERAL_CHECK_LINE = 1003
     18 ERROR_GENERAL_CHECK_NO_ASM = 1004
     19 ERROR_GENERAL_CHECK_NO_PROGMA = 1005
     20 ERROR_GENERAL_CHECK_CARRIAGE_RETURN = 1006
     21 ERROR_GENERAL_CHECK_FILE_EXISTENCE = 1007
     22 ERROR_GENERAL_CHECK_NON_ACSII = 1008
     23 ERROR_GENERAL_CHECK_UNI = 1009
     24 ERROR_GENERAL_CHECK_UNI_HELP_INFO = 1010
     25 
     26 ERROR_SPACE_CHECK_ALL = 2000
     27 
     28 ERROR_PREDICATE_EXPRESSION_CHECK_ALL = 3000
     29 ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE = 3001
     30 ERROR_PREDICATE_EXPRESSION_CHECK_NO_BOOLEAN_OPERATOR = 3002
     31 ERROR_PREDICATE_EXPRESSION_CHECK_COMPARISON_NULL_TYPE = 3003
     32 
     33 ERROR_HEADER_CHECK_ALL = 4000
     34 ERROR_HEADER_CHECK_FILE = 4001
     35 ERROR_HEADER_CHECK_FUNCTION = 4002
     36 
     37 ERROR_C_FUNCTION_LAYOUT_CHECK_ALL = 5000
     38 ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE = 5001
     39 ERROR_C_FUNCTION_LAYOUT_CHECK_OPTIONAL_FUNCTIONAL_MODIFIER = 5002
     40 ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_NAME = 5003
     41 ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE = 5004
     42 ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY = 5005
     43 ERROR_C_FUNCTION_LAYOUT_CHECK_DATA_DECLARATION = 5006
     44 ERROR_C_FUNCTION_LAYOUT_CHECK_NO_INIT_OF_VARIABLE = 5007
     45 ERROR_C_FUNCTION_LAYOUT_CHECK_NO_STATIC = 5008
     46 ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_2 = 5009
     47 ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_3 = 5010
     48 
     49 ERROR_INCLUDE_FILE_CHECK_ALL = 6000
     50 ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_1 = 6001
     51 ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_2 = 6002
     52 ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_3 = 6003
     53 ERROR_INCLUDE_FILE_CHECK_DATA = 6004
     54 ERROR_INCLUDE_FILE_CHECK_NAME = 6005
     55 
     56 ERROR_DECLARATION_DATA_TYPE_CHECK_ALL = 7000
     57 ERROR_DECLARATION_DATA_TYPE_CHECK_NO_USE_C_TYPE = 7001
     58 ERROR_DECLARATION_DATA_TYPE_CHECK_IN_OUT_MODIFIER = 7002
     59 ERROR_DECLARATION_DATA_TYPE_CHECK_EFI_API_MODIFIER = 7003
     60 ERROR_DECLARATION_DATA_TYPE_CHECK_ENUMERATED_TYPE = 7004
     61 ERROR_DECLARATION_DATA_TYPE_CHECK_STRUCTURE_DECLARATION = 7005
     62 ERROR_DECLARATION_DATA_TYPE_CHECK_SAME_STRUCTURE = 7007
     63 ERROR_DECLARATION_DATA_TYPE_CHECK_UNION_TYPE = 7006
     64 ERROR_DECLARATION_DATA_TYPE_CHECK_NESTED_STRUCTURE = 7008
     65 
     66 ERROR_NAMING_CONVENTION_CHECK_ALL = 8000
     67 ERROR_NAMING_CONVENTION_CHECK_DEFINE_STATEMENT = 8001
     68 ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT = 8002
     69 ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT = 8003
     70 ERROR_NAMING_CONVENTION_CHECK_PATH_NAME = 8004
     71 ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME = 8005
     72 ERROR_NAMING_CONVENTION_CHECK_FUNCTION_NAME = 8006
     73 ERROR_NAMING_CONVENTION_CHECK_SINGLE_CHARACTER_VARIABLE = 8007
     74 
     75 ERROR_DOXYGEN_CHECK_ALL = 9000
     76 ERROR_DOXYGEN_CHECK_FILE_HEADER = 9001
     77 ERROR_DOXYGEN_CHECK_FUNCTION_HEADER = 9002
     78 ERROR_DOXYGEN_CHECK_COMMENT_DESCRIPTION = 9003
     79 ERROR_DOXYGEN_CHECK_COMMENT_FORMAT = 9004
     80 ERROR_DOXYGEN_CHECK_COMMAND = 9005
     81 
     82 ERROR_META_DATA_FILE_CHECK_ALL = 10000
     83 ERROR_META_DATA_FILE_CHECK_PATH_NAME = 10001
     84 ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1 = 10002
     85 ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_2 = 10003
     86 ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_DEPENDENT = 10004
     87 ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_ORDER = 10005
     88 ERROR_META_DATA_FILE_CHECK_LIBRARY_NO_USE = 10006
     89 ERROR_META_DATA_FILE_CHECK_BINARY_INF_IN_FDF = 10007
     90 ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE = 10008
     91 ERROR_META_DATA_FILE_CHECK_PCD_FLASH = 10009
     92 ERROR_META_DATA_FILE_CHECK_PCD_NO_USE = 10010
     93 ERROR_META_DATA_FILE_CHECK_DUPLICATE_GUID = 10011
     94 ERROR_META_DATA_FILE_CHECK_DUPLICATE_PROTOCOL = 10012
     95 ERROR_META_DATA_FILE_CHECK_DUPLICATE_PPI = 10013
     96 ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE = 10014
     97 ERROR_META_DATA_FILE_CHECK_PCD_TYPE = 10015
     98 ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION = 10016
     99 ERROR_META_DATA_FILE_CHECK_LIBRARY_NAME_DUPLICATE = 10017
    100 ERROR_META_DATA_FILE_CHECK_FORMAT_GUID = 10018
    101 ERROR_META_DATA_FILE_CHECK_FORMAT_PROTOCOL = 10019
    102 ERROR_META_DATA_FILE_CHECK_FORMAT_PPI = 10020
    103 ERROR_META_DATA_FILE_CHECK_FORMAT_PCD = 10021
    104 ERROR_META_DATA_FILE_CHECK_LIBRARY_NOT_DEFINED = 10022
    105 
    106 ERROR_SPELLING_CHECK_ALL = 11000
    107 
    108 gEccErrorMessage = {
    109     ERROR_GENERAL_CHECK_ALL : "",
    110     ERROR_GENERAL_CHECK_NO_TAB : "'TAB' character is not allowed in source code, please replace each 'TAB' with two spaces",
    111     ERROR_GENERAL_CHECK_INDENTATION : "Indentation does not follow coding style",
    112     ERROR_GENERAL_CHECK_LINE : "The width of each line does not follow coding style",
    113     ERROR_GENERAL_CHECK_NO_ASM : "There should be no use of _asm in the source file",
    114     ERROR_GENERAL_CHECK_NO_PROGMA : """There should be no use of "#progma" in source file except "#pragma pack(#)\"""",

    115     ERROR_GENERAL_CHECK_CARRIAGE_RETURN : "There should be a carriage return at the end of the file",
    116     ERROR_GENERAL_CHECK_FILE_EXISTENCE : "File not found",
    117     ERROR_GENERAL_CHECK_NON_ACSII : "File has invalid Non-ACSII char",
    118     ERROR_GENERAL_CHECK_UNI : "File is not a valid UTF-16 UNI file",
    119     ERROR_GENERAL_CHECK_UNI_HELP_INFO : "UNI file that is associated by INF or DEC file need define the prompt and help information.",
    120 
    121     ERROR_SPACE_CHECK_ALL : "",
    122 
    123     ERROR_PREDICATE_EXPRESSION_CHECK_ALL : "",
    124     ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE : "Boolean values and variable type BOOLEAN should not use explicit comparisons to TRUE or FALSE",
    125     ERROR_PREDICATE_EXPRESSION_CHECK_NO_BOOLEAN_OPERATOR : "Non-Boolean comparisons should use a compare operator (==, !=, >, < >=, <=)",
    126     ERROR_PREDICATE_EXPRESSION_CHECK_COMPARISON_NULL_TYPE : "A comparison of any pointer to zero must be done via the NULL type",
    127 
    128     ERROR_HEADER_CHECK_ALL : "",
    129     ERROR_HEADER_CHECK_FILE : "File header doesn't exist",
    130     ERROR_HEADER_CHECK_FUNCTION : "Function header doesn't exist",
    131 
    132     ERROR_C_FUNCTION_LAYOUT_CHECK_ALL : "",
    133     ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE : "Return type of a function should exist and in the first line",
    134     ERROR_C_FUNCTION_LAYOUT_CHECK_OPTIONAL_FUNCTIONAL_MODIFIER : "Any optional functional modifiers should exist and next to the return type",
    135     ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_NAME : """Function name should be left justified, followed by the beginning of the parameter list, with the closing parenthesis on its own line, indented two spaces""",
    136     ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE : "Function prototypes in include files have the same form as function definitions",
    137     ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_2 : "Function prototypes in include files have different parameter number with function definitions",
    138     ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_3 : "Function prototypes in include files have different parameter modifier with function definitions",
    139     ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY : "The body of a function should be contained by open and close braces that must be in the first column",
    140     ERROR_C_FUNCTION_LAYOUT_CHECK_DATA_DECLARATION : "The data declarations should be the first code in a module",
    141     ERROR_C_FUNCTION_LAYOUT_CHECK_NO_INIT_OF_VARIABLE : "There should be no initialization of a variable as part of its declaration",
    142     ERROR_C_FUNCTION_LAYOUT_CHECK_NO_STATIC : "There should be no use of STATIC for functions",
    143 
    144     ERROR_INCLUDE_FILE_CHECK_ALL : "",
    145     ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_1 : "All include file contents should be guarded by a #ifndef statement.",
    146     ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_2 : "The #ifndef must be the first line of code following the file header comment",
    147     ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_3 : "The #endif must appear on the last line in the file",
    148     ERROR_INCLUDE_FILE_CHECK_DATA : "Include files should contain only public or only private data and cannot contain code or define data variables",
    149     ERROR_INCLUDE_FILE_CHECK_NAME : "No permission for the inlcude file with same names",
    150 
    151     ERROR_DECLARATION_DATA_TYPE_CHECK_ALL : "",
    152     ERROR_DECLARATION_DATA_TYPE_CHECK_NO_USE_C_TYPE : "There should be no use of int, unsigned, char, void, static, long in any .c, .h or .asl files",
    153     ERROR_DECLARATION_DATA_TYPE_CHECK_IN_OUT_MODIFIER : """The modifiers IN, OUT, OPTIONAL, and UNALIGNED should be used only to qualify arguments to a function and should not appear in a data type declaration""",
    154     ERROR_DECLARATION_DATA_TYPE_CHECK_EFI_API_MODIFIER : "The EFIAPI modifier should be used at the entry of drivers, events, and member functions of protocols",
    155     ERROR_DECLARATION_DATA_TYPE_CHECK_ENUMERATED_TYPE : "Enumerated Type should have a 'typedef' and the name must be in capital letters",
    156     ERROR_DECLARATION_DATA_TYPE_CHECK_STRUCTURE_DECLARATION : "Structure Type should have a 'typedef' and the name must be in capital letters",
    157     ERROR_DECLARATION_DATA_TYPE_CHECK_SAME_STRUCTURE : "No permission for the structure with same names",
    158     ERROR_DECLARATION_DATA_TYPE_CHECK_UNION_TYPE : "Union Type should have a 'typedef' and the name must be in capital letters",
    159     ERROR_DECLARATION_DATA_TYPE_CHECK_NESTED_STRUCTURE : "Complex types should be typedef-ed",
    160 
    161     ERROR_NAMING_CONVENTION_CHECK_ALL : "",
    162     ERROR_NAMING_CONVENTION_CHECK_DEFINE_STATEMENT : "Only capital letters are allowed to be used for #define declarations",
    163     ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT : "Only capital letters are allowed to be used for typedef declarations",
    164     ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT : "The #ifndef at the start of an include file should use both prefix and postfix underscore characters, '_'",
    165     ERROR_NAMING_CONVENTION_CHECK_PATH_NAME : """Path name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters""",
    166     ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME : """Variable name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters 4. Global variable name must start with a 'g'""",
    167     ERROR_NAMING_CONVENTION_CHECK_FUNCTION_NAME : """Function name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters""",
    168     ERROR_NAMING_CONVENTION_CHECK_SINGLE_CHARACTER_VARIABLE : "There should be no use of short (single character) variable names",
    169 
    170     ERROR_DOXYGEN_CHECK_ALL : "",
    171     ERROR_DOXYGEN_CHECK_FILE_HEADER : "The file headers should follow Doxygen special documentation blocks in section 2.3.5",
    172     ERROR_DOXYGEN_CHECK_FUNCTION_HEADER : "The function headers should follow Doxygen special documentation blocks in section 2.3.5",
    173     ERROR_DOXYGEN_CHECK_COMMENT_DESCRIPTION : """The first line of text in a comment block should be a brief description of the element being documented and the brief description must end with a period.""",
    174     ERROR_DOXYGEN_CHECK_COMMENT_FORMAT : "For comment line with '///< ... text ...' format, if it is used, it should be after the code section",
    175     ERROR_DOXYGEN_CHECK_COMMAND : "Only Doxygen commands '@bug', '@todo', '@example', '@file', '@attention', '@param', '@post', '@pre', '@retval', '@return', '@sa', '@since', '@test', '@note', '@par' are allowed to mark the code",
    176 
    177     ERROR_META_DATA_FILE_CHECK_ALL : "",
    178     ERROR_META_DATA_FILE_CHECK_PATH_NAME : "The file defined in meta-data does not exist",
    179     ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1 : "A library instances defined for a given module (or dependent library instance) doesn't match the module's type.",
    180     ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_2 : "A library instance must specify the Supported Module Types in its INF file",
    181     ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_DEPENDENT : "A library instance must be defined for all dependent library classes",
    182     ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_ORDER : "The library Instances specified by the LibraryClasses sections should be listed in order of dependencies",
    183     ERROR_META_DATA_FILE_CHECK_LIBRARY_NO_USE : "There should be no unnecessary inclusion of library classes in the INF file",
    184     ERROR_META_DATA_FILE_CHECK_LIBRARY_NAME_DUPLICATE : "Duplicate Library Class Name found",
    185     ERROR_META_DATA_FILE_CHECK_BINARY_INF_IN_FDF : "An INF file is specified in the FDF file, but not in the DSC file, therefore the INF file must be for a Binary module only",
    186     ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE : "Duplicate PCDs found",
    187     ERROR_META_DATA_FILE_CHECK_PCD_FLASH : "PCD settings in the FDF file should only be related to flash",
    188     ERROR_META_DATA_FILE_CHECK_PCD_NO_USE : "There should be no PCDs declared in INF files that are not specified in in either a DSC or FDF file",
    189     ERROR_META_DATA_FILE_CHECK_DUPLICATE_GUID : "Duplicate GUID found",
    190     ERROR_META_DATA_FILE_CHECK_DUPLICATE_PROTOCOL : "Duplicate PROTOCOL found",
    191     ERROR_META_DATA_FILE_CHECK_DUPLICATE_PPI : "Duplicate PPI found",
    192     ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE : "No used module files found",
    193     ERROR_META_DATA_FILE_CHECK_PCD_TYPE : "Wrong C code function used for this kind of PCD",
    194     ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION : "Module file has FILE_GUID collision with other module file",
    195     ERROR_META_DATA_FILE_CHECK_FORMAT_GUID : "Wrong GUID Format used in Module file",
    196     ERROR_META_DATA_FILE_CHECK_FORMAT_PROTOCOL : "Wrong Protocol Format used in Module file",
    197     ERROR_META_DATA_FILE_CHECK_FORMAT_PPI : "Wrong Ppi Format used in Module file",
    198     ERROR_META_DATA_FILE_CHECK_FORMAT_PCD : "Wrong Pcd Format used in Module file",
    199     ERROR_META_DATA_FILE_CHECK_LIBRARY_NOT_DEFINED : "Not defined LibraryClass used in the Module file.",
    200     ERROR_SPELLING_CHECK_ALL : "",
    201     }
    202 
    203