]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/AutoGen/GenC.py
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / Python / AutoGen / GenC.py
index 5c3552a773c02fb4d082eb3e301b741a1f26a4e2..eac41ed9bf81a7b8910b9a95ea679efc0ec818b8 100644 (file)
@@ -784,7 +784,7 @@ gModuleTypeHeaderFile = {
     SUP_MODULE_USER_DEFINED      :   [gBasicHeaderFile]\r
 }\r
 \r
-## Autogen internal worker macro to define DynamicEx PCD name includes both the TokenSpaceGuidName \r
+## Autogen internal worker macro to define DynamicEx PCD name includes both the TokenSpaceGuidName\r
 #  the TokenName and Guid comparison to avoid define name collisions.\r
 #\r
 #   @param      Info        The ModuleAutoGen object\r
@@ -804,7 +804,7 @@ def DynExPcdTokenNumberMapping(Info, AutoGenH):
         return\r
     AutoGenH.Append('\n#define COMPAREGUID(Guid1, Guid2) (BOOLEAN)(*(CONST UINT64*)Guid1 == *(CONST UINT64*)Guid2 && *((CONST UINT64*)Guid1 + 1) == *((CONST UINT64*)Guid2 + 1))\n')\r
     # AutoGen for each PCD listed in a [PcdEx] section of a Module/Lib INF file.\r
-    # Auto generate a macro for each TokenName that takes a Guid pointer as a parameter.  \r
+    # Auto generate a macro for each TokenName that takes a Guid pointer as a parameter.\r
     # Use the Guid pointer to see if it matches any of the token space GUIDs.\r
     TokenCNameList = set()\r
     for TokenCName in ExTokenCNameList:\r
@@ -822,15 +822,15 @@ def DynExPcdTokenNumberMapping(Info, AutoGenH):
                 Index = Index + 1\r
                 if Index == 1:\r
                     AutoGenH.Append('\n#define __PCD_%s_ADDR_CMP(GuidPtr)  (' % (RealTokenCName))\r
-                    AutoGenH.Append('\\\n  (GuidPtr == &%s) ? _PCD_TOKEN_%s_%s:' \r
+                    AutoGenH.Append('\\\n  (GuidPtr == &%s) ? _PCD_TOKEN_%s_%s:'\r
                                     % (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, RealTokenCName))\r
                 else:\r
-                    AutoGenH.Append('\\\n  (GuidPtr == &%s) ? _PCD_TOKEN_%s_%s:' \r
+                    AutoGenH.Append('\\\n  (GuidPtr == &%s) ? _PCD_TOKEN_%s_%s:'\r
                                     % (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, RealTokenCName))\r
                 if Index == Count:\r
                     AutoGenH.Append('0 \\\n  )\n')\r
                 TokenCNameList.add(TokenCName)\r
-    \r
+\r
     TokenCNameList = set()\r
     for TokenCName in ExTokenCNameList:\r
         if TokenCName in TokenCNameList:\r
@@ -848,14 +848,14 @@ def DynExPcdTokenNumberMapping(Info, AutoGenH):
                 if Index == 1:\r
                     AutoGenH.Append('\n#define __PCD_%s_VAL_CMP(GuidPtr)  (' % (RealTokenCName))\r
                     AutoGenH.Append('\\\n  (GuidPtr == NULL) ? 0:')\r
-                    AutoGenH.Append('\\\n  COMPAREGUID (GuidPtr, &%s) ? _PCD_TOKEN_%s_%s:' \r
+                    AutoGenH.Append('\\\n  COMPAREGUID (GuidPtr, &%s) ? _PCD_TOKEN_%s_%s:'\r
                                     % (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, RealTokenCName))\r
                 else:\r
-                    AutoGenH.Append('\\\n  COMPAREGUID (GuidPtr, &%s) ? _PCD_TOKEN_%s_%s:' \r
+                    AutoGenH.Append('\\\n  COMPAREGUID (GuidPtr, &%s) ? _PCD_TOKEN_%s_%s:'\r
                                     % (Pcd.TokenSpaceGuidCName, Pcd.TokenSpaceGuidCName, RealTokenCName))\r
                 if Index == Count:\r
                     AutoGenH.Append('0 \\\n  )\n')\r
-                    # Autogen internal worker macro to compare GUIDs.  Guid1 is a pointer to a GUID.  \r
+                    # Autogen internal worker macro to compare GUIDs.  Guid1 is a pointer to a GUID.\r
                     # Guid2 is a C name for a GUID. Compare pointers first because optimizing compiler\r
                     # can do this at build time on CONST GUID pointers and optimize away call to COMPAREGUID().\r
                     #  COMPAREGUID() will only be used if the Guid passed in is local to the module.\r
@@ -890,22 +890,22 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
 \r
     if Pcd.PcdValueFromComm:\r
         Pcd.DefaultValue = Pcd.PcdValueFromComm\r
-    \r
+\r
     if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:\r
         TokenNumber = int(Pcd.TokenValue, 0)\r
-        # Add TokenSpaceGuidValue value to PcdTokenName to discriminate the DynamicEx PCDs with \r
+        # Add TokenSpaceGuidValue value to PcdTokenName to discriminate the DynamicEx PCDs with\r
         # different Guids but same TokenCName\r
         PcdExTokenName = '_PCD_TOKEN_' + Pcd.TokenSpaceGuidCName + '_' + TokenCName\r
         AutoGenH.Append('\n#define %s  %dU\n' % (PcdExTokenName, TokenNumber))\r
     else:\r
         if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) not in PcdTokenNumber:\r
-            # If one of the Source built modules listed in the DSC is not listed in FDF modules, \r
-            # and the INF lists a PCD can only use the PcdsDynamic access method (it is only \r
-            # listed in the DEC file that declares the PCD as PcdsDynamic), then build tool will \r
-            # report warning message notify the PI that they are attempting to build a module \r
-            # that must be included in a flash image in order to be functional. These Dynamic PCD \r
-            # will not be added into the Database unless it is used by other modules that are \r
-            # included in the FDF file. \r
+            # If one of the Source built modules listed in the DSC is not listed in FDF modules,\r
+            # and the INF lists a PCD can only use the PcdsDynamic access method (it is only\r
+            # listed in the DEC file that declares the PCD as PcdsDynamic), then build tool will\r
+            # report warning message notify the PI that they are attempting to build a module\r
+            # that must be included in a flash image in order to be functional. These Dynamic PCD\r
+            # will not be added into the Database unless it is used by other modules that are\r
+            # included in the FDF file.\r
             # In this case, just assign an invalid token number to make it pass build.\r
             if Pcd.Type in PCD_DYNAMIC_TYPE_SET:\r
                 TokenNumber = 0\r
@@ -929,7 +929,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
     SetModeName = '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[TAB_VOID] + '_' + TokenCName\r
     SetModeStatusName = '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_S_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[TAB_VOID] + '_S_' + TokenCName\r
     GetModeSizeName = '_PCD_GET_MODE_SIZE' + '_' + TokenCName\r
-    \r
+\r
     if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:\r
         if Info.IsLibrary:\r
             PcdList = Info.LibraryPcdList\r
@@ -1044,7 +1044,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
                                     "Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName),\r
                                     ExtraData="[%s]" % str(Info))\r
                 if not Value.endswith('U'):\r
-                    Value += 'U'                    \r
+                    Value += 'U'\r
             elif Pcd.DatumType == TAB_UINT8:\r
                 if ValueNumber < 0:\r
                     EdkLogger.error("build", AUTOGEN_ERROR,\r
@@ -1102,7 +1102,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
             PcdValueName = '_PCD_PATCHABLE_VALUE_' + TokenCName\r
         else:\r
             PcdValueName = '_PCD_VALUE_' + TokenCName\r
-            \r
+\r
         if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:\r
             #\r
             # For unicode, UINT16 array will be generated, so the alignment of unicode is guaranteed.\r
@@ -1115,7 +1115,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
                 AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s UINT8 %s%s = %s;\n' % (Const, PcdVariableName, Array, Value))\r
                 AutoGenH.Append('extern %s UINT8 %s%s;\n' %(Const, PcdVariableName, Array))\r
             AutoGenH.Append('#define %s  %s%s\n' %(GetModeName, Type, PcdVariableName))\r
-                \r
+\r
             PcdDataSize = Pcd.GetPcdSize()\r
             if Pcd.Type == TAB_PCDS_FIXED_AT_BUILD:\r
                 AutoGenH.Append('#define %s %s\n' % (FixPcdSizeTokenName, PcdDataSize))\r
@@ -1132,10 +1132,10 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
             AutoGenC.Append('volatile %s %s %s = %s;\n' %(Const, Pcd.DatumType, PcdVariableName, PcdValueName))\r
             AutoGenH.Append('extern volatile %s  %s  %s%s;\n' % (Const, Pcd.DatumType, PcdVariableName, Array))\r
             AutoGenH.Append('#define %s  %s%s\n' % (GetModeName, Type, PcdVariableName))\r
-            \r
+\r
             PcdDataSize = Pcd.GetPcdSize()\r
             AutoGenH.Append('#define %s %s\n' % (PatchPcdSizeTokenName, PcdDataSize))\r
-            \r
+\r
             AutoGenH.Append('#define %s  %s \n' % (GetModeSizeName, PatchPcdSizeVariableName))\r
             AutoGenH.Append('extern UINTN %s; \n' % PatchPcdSizeVariableName)\r
             AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED UINTN %s = %s;\n' % (PatchPcdSizeVariableName, PcdDataSize))\r
@@ -1143,7 +1143,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
             PcdDataSize = Pcd.GetPcdSize()\r
             AutoGenH.Append('#define %s %s\n' % (FixPcdSizeTokenName, PcdDataSize))\r
             AutoGenH.Append('#define %s  %s \n' % (GetModeSizeName, FixPcdSizeTokenName))\r
-            \r
+\r
             AutoGenH.Append('#define %s  %s\n' %(PcdValueName, Value))\r
             AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s %s = %s;\n' %(Const, Pcd.DatumType, PcdVariableName, PcdValueName))\r
             AutoGenH.Append('extern %s  %s  %s%s;\n' % (Const, Pcd.DatumType, PcdVariableName, Array))\r
@@ -1190,13 +1190,13 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
         TokenNumber = int(Pcd.TokenValue, 0)\r
     else:\r
         if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) not in PcdTokenNumber:\r
-            # If one of the Source built modules listed in the DSC is not listed in FDF modules, \r
-            # and the INF lists a PCD can only use the PcdsDynamic access method (it is only \r
-            # listed in the DEC file that declares the PCD as PcdsDynamic), then build tool will \r
-            # report warning message notify the PI that they are attempting to build a module \r
-            # that must be included in a flash image in order to be functional. These Dynamic PCD \r
-            # will not be added into the Database unless it is used by other modules that are \r
-            # included in the FDF file. \r
+            # If one of the Source built modules listed in the DSC is not listed in FDF modules,\r
+            # and the INF lists a PCD can only use the PcdsDynamic access method (it is only\r
+            # listed in the DEC file that declares the PCD as PcdsDynamic), then build tool will\r
+            # report warning message notify the PI that they are attempting to build a module\r
+            # that must be included in a flash image in order to be functional. These Dynamic PCD\r
+            # will not be added into the Database unless it is used by other modules that are\r
+            # included in the FDF file.\r
             # In this case, just assign an invalid token number to make it pass build.\r
             if Pcd.Type in PCD_DYNAMIC_TYPE_SET:\r
                 TokenNumber = 0\r
@@ -1230,7 +1230,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
     if PcdItemType in PCD_DYNAMIC_EX_TYPE_SET:\r
         PcdExTokenName = '_PCD_TOKEN_' + TokenSpaceGuidCName + '_' + TokenCName\r
         AutoGenH.Append('\n#define %s  %dU\n' % (PcdExTokenName, TokenNumber))\r
-        \r
+\r
         if Info.IsLibrary:\r
             PcdList = Info.LibraryPcdList\r
         else:\r
@@ -1312,7 +1312,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
 \r
         AutoGenH.Append('#define %s %s\n' % (GetModeSizeName, PatchPcdSizeVariableName))\r
         AutoGenH.Append('extern UINTN %s; \n' % PatchPcdSizeVariableName)\r
-        \r
+\r
     if PcdItemType == TAB_PCDS_FIXED_AT_BUILD or PcdItemType == TAB_PCDS_FEATURE_FLAG:\r
         key = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))\r
         PcdVariableName = '_gPcd_' + gItemTypeStringDatabase[Pcd.Type] + '_' + TokenCName\r
@@ -1323,7 +1323,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
         AutoGenH.Append('extern const %s _gPcd_FixedAtBuild_%s%s;\n' %(DatumType, TokenCName, Array))\r
         AutoGenH.Append('#define %s  %s_gPcd_FixedAtBuild_%s\n' %(GetModeName, Type, TokenCName))\r
         AutoGenH.Append('//#define %s  ASSERT(FALSE)  // It is not allowed to set value for a FIXED_AT_BUILD PCD\n' % SetModeName)\r
-        \r
+\r
         ConstFixedPcd = False\r
         if PcdItemType == TAB_PCDS_FIXED_AT_BUILD and (key in Info.ConstPcd or (Info.IsLibrary and not Info._ReferenceModules)):\r
             ConstFixedPcd = True\r
@@ -1656,7 +1656,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
     for Pcd in Info.ModulePcdList:\r
         if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenSpaceGuidCName not in TokenSpaceList:\r
             TokenSpaceList.append(Pcd.TokenSpaceGuidCName)\r
-            \r
+\r
     SkuMgr = Info.Workspace.Platform.SkuIdMgr\r
     AutoGenH.Append("\n// Definition of SkuId Array\n")\r
     AutoGenH.Append("extern UINT64 _gPcd_SkuId_Array[];\n")\r
@@ -1666,7 +1666,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
         if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:\r
             GuidType = TAB_GUID\r
         else:\r
-            GuidType = "EFI_GUID"              \r
+            GuidType = "EFI_GUID"\r
         for Item in TokenSpaceList:\r
             AutoGenH.Append('extern %s %s;\n' % (GuidType, Item))\r
 \r
@@ -2016,7 +2016,7 @@ def CreateHeaderCode(Info, AutoGenC, AutoGenH):
         if Info.ModuleType in gModuleTypeHeaderFile:\r
             AutoGenH.Append("#include <%s>\n" % gModuleTypeHeaderFile[Info.ModuleType][0])\r
         #\r
-        # if either PcdLib in [LibraryClasses] sections or there exist Pcd section, add PcdLib.h \r
+        # if either PcdLib in [LibraryClasses] sections or there exist Pcd section, add PcdLib.h\r
         # As if modules only uses FixedPcd, then PcdLib is not needed in [LibraryClasses] section.\r
         #\r
         if 'PcdLib' in Info.Module.LibraryClasses or Info.Module.Pcds:\r