]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools:added extern protocol/PPI/GUID definition in AutoGen for Library
authorYonghong Zhu <yonghong.zhu@intel.com>
Mon, 26 Oct 2015 03:26:55 +0000 (03:26 +0000)
committeryzhu52 <yzhu52@Edk2>
Mon, 26 Oct 2015 03:26:55 +0000 (03:26 +0000)
We already added the extern declaration for protocols/PPI/GUID in AutoGen.h
file for driver, but missing this feature for the Library. so this patch
add it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18661 6f19259b-4bc3-4df7-8a09-765794883524

BaseTools/Source/Python/AutoGen/GenC.py

index 77de1657f0bb38945e421986b365adee6b38a5cf..45fb9899f2c2d15a7ec8d7058f332c692b5f8608 100644 (file)
@@ -1384,22 +1384,21 @@ def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
 #   @param      AutoGenH    The TemplateString object for header file\r
 #\r
 def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):\r
-    if Info.IsLibrary:\r
-        return\r
-\r
     if Info.ModuleType in ["USER_DEFINED", "BASE"]:\r
         GuidType = "GUID"\r
     else:\r
         GuidType = "EFI_GUID"\r
 \r
     if Info.GuidList:\r
-        AutoGenC.Append("\n// Guids\n")\r
+        if not Info.IsLibrary:\r
+            AutoGenC.Append("\n// Guids\n")\r
         AutoGenH.Append("\n// Guids\n")\r
     #\r
     # GUIDs\r
     #\r
     for Key in Info.GuidList:\r
-        AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.GuidList[Key]))\r
+        if not Info.IsLibrary:\r
+            AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.GuidList[Key]))\r
         AutoGenH.Append('extern %s %s;\n' % (GuidType, Key))\r
 \r
 ## Create code for protocol\r
@@ -1409,22 +1408,21 @@ def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
 #   @param      AutoGenH    The TemplateString object for header file\r
 #\r
 def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):\r
-    if Info.IsLibrary:\r
-        return\r
-\r
     if Info.ModuleType in ["USER_DEFINED", "BASE"]:\r
         GuidType = "GUID"\r
     else:\r
         GuidType = "EFI_GUID"\r
 \r
     if Info.ProtocolList:\r
-        AutoGenC.Append("\n// Protocols\n")\r
+        if not Info.IsLibrary:\r
+            AutoGenC.Append("\n// Protocols\n")\r
         AutoGenH.Append("\n// Protocols\n")\r
     #\r
     # Protocol GUIDs\r
     #\r
     for Key in Info.ProtocolList:\r
-        AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.ProtocolList[Key]))\r
+        if not Info.IsLibrary:\r
+            AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.ProtocolList[Key]))\r
         AutoGenH.Append('extern %s %s;\n' % (GuidType, Key))\r
 \r
 ## Create code for PPI\r
@@ -1434,22 +1432,21 @@ def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
 #   @param      AutoGenH    The TemplateString object for header file\r
 #\r
 def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH):\r
-    if Info.IsLibrary:\r
-        return\r
-\r
     if Info.ModuleType in ["USER_DEFINED", "BASE"]:\r
         GuidType = "GUID"\r
     else:\r
         GuidType = "EFI_GUID"\r
 \r
     if Info.PpiList:\r
-        AutoGenC.Append("\n// PPIs\n")\r
+        if not Info.IsLibrary:\r
+            AutoGenC.Append("\n// PPIs\n")\r
         AutoGenH.Append("\n// PPIs\n")\r
     #\r
     # PPI GUIDs\r
     #\r
     for Key in Info.PpiList:\r
-        AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.PpiList[Key]))\r
+        if not Info.IsLibrary:\r
+            AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.PpiList[Key]))\r
         AutoGenH.Append('extern %s %s;\n' % (GuidType, Key))\r
 \r
 ## Create code for PCD\r