In before, FixedPcdGetxx macro was defined as global variable, it is wrong. It should...
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 22 Jun 2006 14:08:17 +0000 (14:08 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 22 Jun 2006 14:08:17 +0000 (14:08 +0000)
1) Change macro FixedPcdGetxx to value macro.
2) Change some wrong macro usage in library.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@599 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java

index 3bebc45..20f0b9b 100644 (file)
@@ -225,38 +225,41 @@ public class UsageInstance {
 \r
         switch (modulePcdType) {\r
         case FEATURE_FLAG:\r
-            if (isBuildUsedLibrary) {\r
-                hAutogenStr += String.format("extern const BOOLEAN _gPcd_FixedAtBuild_%s;\r\n", \r
-                                             parentToken.cName);\r
-                hAutogenStr += String.format("#define _PCD_MODE_%s_%s  _gPcd_FixedAtBuild_%s\r\n",\r
-                                             parentToken.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
-                                             parentToken.cName,\r
-                                             parentToken.cName);\r
-            } else {\r
+            hAutogenStr += String.format("extern const BOOLEAN _gPcd_FixedAtBuild_%s;\r\n", \r
+                                         parentToken.cName);\r
+            hAutogenStr += String.format("#define _PCD_MODE_%s_%s  _gPcd_FixedAtBuild_%s\r\n",\r
+                                         parentToken.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
+                                         parentToken.cName,\r
+                                         parentToken.cName);\r
+\r
+            if (!isBuildUsedLibrary) {\r
                 hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n", \r
                                              parentToken.cName, \r
                                              printDatum);\r
-                hAutogenStr += String.format("extern const BOOLEAN _gPcd_FixedAtBuild_%s;\r\n", \r
-                                             parentToken.cName);\r
                 cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const BOOLEAN _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",\r
                                              parentToken.cName,\r
                                              parentToken.cName);\r
-                hAutogenStr += String.format("#define _PCD_MODE_%s_%s  _PCD_VALUE_%s\r\n",\r
-                                             Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
-                                             parentToken.cName,\r
-                                             parentToken.cName);\r
             }\r
             break;\r
         case FIXED_AT_BUILD:\r
-            if (isBuildUsedLibrary) {\r
+            if (isByteArray) {\r
+                hAutogenStr += String.format("extern const UINT8 _gPcd_FixedAtBuild_%s[];\r\n",\r
+                                             parentToken.cName);\r
+                hAutogenStr += String.format("#define _PCD_MODE_%s_%s  &_gPcd_FixedAtBuild_%s\r\n", \r
+                                             Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
+                                             parentToken.cName,\r
+                                             parentToken.cName);\r
+            } else {\r
                 hAutogenStr += String.format("extern const %s _gPcd_FixedAtBuild_%s;\r\n",\r
                                              Token.getAutogendatumTypeString(parentToken.datumType),\r
                                              parentToken.cName);\r
-                hAutogenStr += String.format("#define _PCD_MODE_%s_%s  _gPcd_FixedAtBuild_%s\r\n",\r
+                hAutogenStr += String.format("#define _PCD_MODE_%s_%s  _gPcd_FixedAtBuild_%s\r\n", \r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                                              parentToken.cName);\r
-            } else {\r
+            }\r
+\r
+            if (!isBuildUsedLibrary) {\r
                 hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n", \r
                                              parentToken.cName, \r
                                              printDatum);\r
@@ -264,37 +267,33 @@ public class UsageInstance {
                     cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gPcd_FixedAtBuild_%s[] = _PCD_VALUE_%s;\r\n",\r
                                                  parentToken.cName,\r
                                                  parentToken.cName);\r
-                    hAutogenStr += String.format("extern const UINT8 _gPcd_FixedAtBuild_%s[];\r\n",\r
-                                                 parentToken.cName);\r
-                    hAutogenStr += String.format("#define _PCD_MODE_%s_%s  &_gPcd_FixedAtBuild_%s\r\n",\r
-                                                 Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
-                                                 parentToken.cName,\r
-                                                 parentToken.cName);\r
                 } else {\r
                     cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",\r
                                                  Token.getAutogendatumTypeString(parentToken.datumType),\r
                                                  parentToken.cName,\r
                                                  parentToken.cName);\r
-                    hAutogenStr += String.format("extern const %s _gPcd_FixedAtBuild_%s;\r\n",\r
-                                                 Token.getAutogendatumTypeString(parentToken.datumType),\r
-                                                 parentToken.cName);\r
-                    hAutogenStr += String.format("#define _PCD_MODE_%s_%s  _PCD_VALUE_%s\r\n",\r
-                                                 Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
-                                                 parentToken.cName,\r
-                                                 parentToken.cName);\r
                 }\r
             }\r
             break;\r
         case PATCHABLE_IN_MODULE:\r
-            if (isBuildUsedLibrary) {\r
+            if (isByteArray) {\r
+                hAutogenStr += String.format("extern UINT8 _gPcd_BinaryPatch_%s[];\r\n",\r
+                                             parentToken.cName);\r
+                hAutogenStr += String.format("#define _PCD_MODE_%s_%s  &_gPcd_BinaryPatch_%s\r\n",\r
+                                             Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
+                                             parentToken.cName,\r
+                                             parentToken.cName);  \r
+            } else {\r
                 hAutogenStr += String.format("extern %s _gPcd_BinaryPatch_%s;\r\n",\r
                                              Token.getAutogendatumTypeString(parentToken.datumType),\r
                                              parentToken.cName);\r
                 hAutogenStr += String.format("#define _PCD_MODE_%s_%s  _gPcd_BinaryPatch_%s\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
-                                             parentToken.cName);\r
-            } else {\r
+                                             parentToken.cName);                \r
+            }\r
+\r
+            if (!isBuildUsedLibrary) {\r
                 hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n", \r
                                              parentToken.cName, \r
                                              printDatum);\r
@@ -302,24 +301,11 @@ public class UsageInstance {
                     cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED UINT8 _gPcd_BinaryPatch_%s[] = _PCD_VALUE_%s;\r\n",\r
                                                  parentToken.cName,\r
                                                  parentToken.cName);\r
-                    hAutogenStr += String.format("extern UINT8 _gPcd_BinaryPatch_%s[];\r\n",\r
-                                                 parentToken.cName);\r
-                    hAutogenStr += String.format("#define _PCD_MODE_%s_%s  &_gPcd_BinaryPatch_%s\r\n",\r
-                                                 Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
-                                                 parentToken.cName,\r
-                                                 parentToken.cName);  \r
                 } else {\r
                     cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED %s _gPcd_BinaryPatch_%s = _PCD_VALUE_%s;\r\n",\r
                                                  Token.getAutogendatumTypeString(parentToken.datumType),\r
                                                  parentToken.cName,\r
                                                  parentToken.cName);\r
-                    hAutogenStr += String.format("extern %s _gPcd_BinaryPatch_%s;\r\n",\r
-                                                 Token.getAutogendatumTypeString(parentToken.datumType),\r
-                                                 parentToken.cName);\r
-                    hAutogenStr += String.format("#define _PCD_MODE_%s_%s  _gPcd_BinaryPatch_%s\r\n",\r
-                                                 Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
-                                                 parentToken.cName,\r
-                                                 parentToken.cName);                \r
                 }\r
             }\r
 \r