ECC: Fix misuse of error message type for boolean variable checking; fix intermediate...
authorjlin16 <jlin16@7335b38e-4728-0410-8992-fb3ffe349368>
Wed, 18 Jun 2008 08:02:21 +0000 (08:02 +0000)
committerjlin16 <jlin16@7335b38e-4728-0410-8992-fb3ffe349368>
Wed, 18 Jun 2008 08:02:21 +0000 (08:02 +0000)
git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1260 7335b38e-4728-0410-8992-fb3ffe349368

Source/Python/Ecc/c.py

index 7e0a14c..4797a12 100644 (file)
@@ -921,12 +921,12 @@ def GetFinalTypeValue(Type, FieldName, TypedefDict, SUDict):
         if not Field[Index - 1].isalnum():\r
             if Index + len(FieldName) == len(Field):\r
                 Type = GetDataTypeFromModifier(Field[0:Index])\r
-                return Type.split()[-1]\r
+                return Type.strip()\r
             else:\r
             # For the condition that the field in struct is an array with [] sufixes...               \r
                 if not Field[Index + len(FieldName)].isalnum():\r
                     Type = GetDataTypeFromModifier(Field[0:Index])\r
-                    return Type.split()[-1]\r
+                    return Type.strip()\r
                 \r
     return None\r
     \r
@@ -942,7 +942,7 @@ def GetRealType(Type, TypedefDict, TargetType = None):
 def GetTypeInfo(RefList, Modifier, FullFileName, TargetType = None):\r
     TypedefDict = GetTypedefDict(FullFileName)\r
     SUDict = GetSUDict(FullFileName)\r
-    Type = GetDataTypeFromModifier(Modifier).rstrip('*').strip()\r
+    Type = GetDataTypeFromModifier(Modifier).replace('*', '').strip()\r
     \r
     Type = Type.split()[-1]\r
     Index = 0\r
@@ -951,7 +951,16 @@ def GetTypeInfo(RefList, Modifier, FullFileName, TargetType = None):
         FromType = GetFinalTypeValue(Type, FieldName, TypedefDict, SUDict)\r
         if FromType == None:\r
             return None\r
-        Type = FromType\r
+        # we want to determine the exact type.\r
+        if TargetType != None:\r
+            Type = FromType.split()[0]\r
+        # we only want to check if it is a pointer\r
+        else:\r
+            Type = FromType\r
+            if Type.find('*') != -1 and Index == len(RefList)-1:\r
+                return Type\r
+            Type = FromType.split()[0]\r
+            \r
         Index += 1\r
 \r
     Type = GetRealType(Type, TypedefDict, TargetType)\r
@@ -1734,7 +1743,7 @@ def CheckBooleanValueComparison(FullFileName):
                     Type = FuncReturnTypeDict.get(PredVarStr)\r
                     if Type != None:\r
                         if Type.find('BOOLEAN') != -1:\r
-                            PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_NO_BOOLEAN_OPERATOR, 'Predicate Expression: %s' % Exp, FileTable, Str[2])\r
+                            PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE, 'Predicate Expression: %s' % Exp, FileTable, Str[2])\r
                         continue\r
                     \r
                     if PredVarStr in FuncReturnTypeDict:\r
@@ -1746,7 +1755,7 @@ def CheckBooleanValueComparison(FullFileName):
                 if Type == None:\r
                     continue\r
                 if Type.find('BOOLEAN') != -1:\r
-                    PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_NO_BOOLEAN_OPERATOR, 'Predicate Expression: %s' % Exp, FileTable, Str[2])\r
+                    PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE, 'Predicate Expression: %s' % Exp, FileTable, Str[2])\r
                 \r
 \r
 def CheckHeaderFileData(FullFileName):\r