Sync BaseTool trunk (version r2397) into EDKII BaseTools. The change mainly includes

1. Fix the issue that root directory of disk can’t be used as WORKSPACE.
2. Update AutoGen code style to pass C++ compiler.

Signed-off-by: lgao4
Reviewed-by: jsu1

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12676 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4 2011-11-09 04:32:08 +00:00
parent 0806815921
commit d40b2ee60e
45 changed files with 386 additions and 342 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -482,7 +482,7 @@ DEFINE CLANG_BIN = /usr/bin/
# *_*_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC # *_*_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
# *_*_EBC_PP_FLAGS = /nologo /E /TC /FI$(DEST_DIR_DEBUG)/AutoGen.h # *_*_EBC_PP_FLAGS = /nologo /E /TC /FI$(DEST_DIR_DEBUG)/AutoGen.h
# *_*_EBC_CC_FLAGS = /nologo /FAcs /c /W3 /WX /FI$(DEST_DIR_DEBUG)/AutoGen.h # *_*_EBC_CC_FLAGS = /nologo /FAcs /c /W3 /WX /FI$(DEST_DIR_DEBUG)/AutoGen.h
# *_*_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /MACHINE:EBC /OPT:REF /NODEFAULTLIB /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER # *_*_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /MACHINE:EBC /OPT:REF /NODEFAULTLIB /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /ALIGN:32 /DRIVER
# #
#################################################################################### ####################################################################################
# #
@ -578,7 +578,7 @@ NOOPT_VS2003_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:RE
*_VS2003_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_VS2003_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_VS2003_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_VS2003_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_VS2003_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_VS2003_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_VS2003_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_VS2003_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -652,7 +652,7 @@ NOOPT_VS2003xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OP
*_VS2003xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_VS2003xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_VS2003xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_VS2003xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_VS2003xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_VS2003xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_VS2003xASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_VS2003xASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -789,7 +789,7 @@ NOOPT_VS2005_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF
*_VS2005_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_VS2005_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_VS2005_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_VS2005_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_VS2005_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_VS2005_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_VS2005_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_VS2005_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -926,7 +926,7 @@ NOOPT_VS2005xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,
*_VS2005xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_VS2005xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_VS2005xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_VS2005xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_VS2005xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_VS2005xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_VS2005xASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_VS2005xASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -1063,7 +1063,7 @@ NOOPT_VS2005x86_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,I
*_VS2005x86_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_VS2005x86_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_VS2005x86_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_VS2005x86_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_VS2005x86_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_VS2005x86_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_VS2005x86_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_VS2005x86_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -1200,7 +1200,7 @@ NOOPT_VS2005x86xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:R
*_VS2005x86xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_VS2005x86xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_VS2005x86xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_VS2005x86xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_VS2005x86xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_VS2005x86xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_VS2005x86xASL_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_VS2005x86xASL_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
@ -1339,7 +1339,7 @@ NOOPT_VS2008_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF
*_VS2008_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_VS2008_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_VS2008_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_VS2008_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_VS2008_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_VS2008_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_VS2008_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_VS2008_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -1476,7 +1476,7 @@ NOOPT_VS2008xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,
*_VS2008xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_VS2008xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_VS2008xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_VS2008xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_VS2008xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_VS2008xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_VS2008xASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_VS2008xASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
@ -1833,7 +1833,7 @@ NOOPT_DDK3790_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF
*_DDK3790_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_DDK3790_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_DDK3790_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_DDK3790_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_DDK3790_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER *_DDK3790_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -1958,7 +1958,7 @@ NOOPT_DDK3790xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF
*_DDK3790xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_DDK3790xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_DDK3790xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_DDK3790xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_DDK3790xASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER *_DDK3790xASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
@ -2330,7 +2330,7 @@ DEFINE GCC45_ASM_FLAGS = DEF(GCC44_ASM_FLAGS)
*_CYGGCC_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_CYGGCC_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_CYGGCC_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_CYGGCC_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_CYGGCC_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER *_CYGGCC_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -2433,7 +2433,7 @@ DEFINE GCC45_ASM_FLAGS = DEF(GCC44_ASM_FLAGS)
*_CYGGCCxASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_CYGGCCxASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_CYGGCCxASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_CYGGCCxASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_CYGGCCxASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER *_CYGGCCxASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -2669,7 +2669,7 @@ NOOPT_ICC_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT
*_ICC_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_ICC_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_ICC_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_ICC_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_ICC_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_ICC_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_ICC_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_ICC_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -2813,7 +2813,7 @@ NOOPT_ICCxASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL
*_ICCxASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_ICCxASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_ICCxASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_ICCxASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_ICCxASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_ICCxASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_ICCxASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_ICCxASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
@ -2958,7 +2958,7 @@ NOOPT_ICCx86_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /
*_ICCx86_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_ICCx86_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_ICCx86_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_ICCx86_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_ICCx86_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_ICCx86_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_ICCx86_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_ICCx86_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
@ -3103,7 +3103,7 @@ NOOPT_ICCx86xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /D
*_ICCx86xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_ICCx86xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_ICCx86xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_ICCx86xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_ICCx86xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_ICCx86xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_ICCx86xASL_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_ICCx86xASL_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
@ -3246,7 +3246,7 @@ NOOPT_ICC11_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /O
*_ICC11_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_ICC11_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_ICC11_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_ICC11_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_ICC11_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_ICC11_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_ICC11_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_ICC11_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
# #
@ -3390,7 +3390,7 @@ NOOPT_ICC11xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DL
*_ICC11xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_ICC11xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_ICC11xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_ICC11xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_ICC11xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_ICC11xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_ICC11xASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_ICC11xASL_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
@ -3532,7 +3532,7 @@ NOOPT_ICC11x86_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL
*_ICC11x86_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_ICC11x86_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_ICC11x86_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_ICC11x86_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_ICC11x86_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_ICC11x86_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_ICC11x86_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_ICC11x86_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
@ -3674,7 +3674,7 @@ NOOPT_ICC11x86xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG
*_ICC11x86xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_ICC11x86xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_ICC11x86xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_ICC11x86xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_ICC11x86xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_ICC11x86xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_ICC11x86xASL_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_ICC11x86xASL_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################
@ -3810,7 +3810,7 @@ NOOPT_MYTOOLS_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT
*_MYTOOLS_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT) *_MYTOOLS_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_MYTOOLS_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h *_MYTOOLS_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_MYTOOLS_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_MYTOOLS_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_MYTOOLS_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_MYTOOLS_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 /DRIVER
#################################################################################### ####################################################################################

View File

@ -1,3 +1,3 @@
//This file is for build version number auto generation //This file is for build version number auto generation
// //
#define __BUILD_VERSION "Build 2386" #define __BUILD_VERSION "Build 2396"

View File

@ -2184,13 +2184,19 @@ class ModuleAutoGen(AutoGen):
def _GetBuildOptionIncPathList(self): def _GetBuildOptionIncPathList(self):
if self._BuildOptionIncPathList == None: if self._BuildOptionIncPathList == None:
# #
# Regular expression for finding Include Directories, the difference between MSFT and INTEL/GCC # Regular expression for finding Include Directories, the difference between MSFT and INTEL/GCC/RVCT
# is the former use /I , the Latter used -I to specify include directories # is the former use /I , the Latter used -I to specify include directories
# #
if self.PlatformInfo.ToolChainFamily in ('MSFT'): if self.PlatformInfo.ToolChainFamily in ('MSFT'):
gBuildOptIncludePattern = re.compile(r"(?:.*?)/I[ \t]*([^ ]*)", re.MULTILINE|re.DOTALL) gBuildOptIncludePattern = re.compile(r"(?:.*?)/I[ \t]*([^ ]*)", re.MULTILINE|re.DOTALL)
elif self.PlatformInfo.ToolChainFamily in ('INTEL', 'GCC'): elif self.PlatformInfo.ToolChainFamily in ('INTEL', 'GCC', 'RVCT'):
gBuildOptIncludePattern = re.compile(r"(?:.*?)-I[ \t]*([^ ]*)", re.MULTILINE|re.DOTALL) gBuildOptIncludePattern = re.compile(r"(?:.*?)-I[ \t]*([^ ]*)", re.MULTILINE|re.DOTALL)
else:
#
# New ToolChainFamily, don't known whether there is option to specify include directories
#
self._BuildOptionIncPathList = []
return self._BuildOptionIncPathList
BuildOptionIncPathList = [] BuildOptionIncPathList = []
for Tool in ('CC', 'PP', 'VFRPP', 'ASLPP', 'ASLCC', 'APP', 'ASM'): for Tool in ('CC', 'PP', 'VFRPP', 'ASLPP', 'ASLCC', 'APP', 'ASM'):
@ -2200,7 +2206,17 @@ class ModuleAutoGen(AutoGen):
except KeyError: except KeyError:
FlagOption = '' FlagOption = ''
IncPathList = [NormPath(Path, self.Macros) for Path in gBuildOptIncludePattern.findall(FlagOption)] if self.PlatformInfo.ToolChainFamily != 'RVCT':
IncPathList = [NormPath(Path, self.Macros) for Path in gBuildOptIncludePattern.findall(FlagOption)]
else:
#
# RVCT may specify a list of directory seperated by commas
#
IncPathList = []
for Path in gBuildOptIncludePattern.findall(FlagOption):
PathList = GetSplitList(Path, TAB_COMMA_SPLIT)
IncPathList += [NormPath(PathEntry, self.Macros) for PathEntry in PathList]
# #
# EDK II modules must not reference header files outside of the packages they depend on or # EDK II modules must not reference header files outside of the packages they depend on or
# within the module's directory tree. Report error if violation. # within the module's directory tree. Report error if violation.

View File

@ -310,9 +310,18 @@ gAutoGenHPrologueString = TemplateString("""
#ifndef _${File}_${Guid} #ifndef _${File}_${Guid}
#define _${File}_${Guid} #define _${File}_${Guid}
#ifdef __cplusplus
extern "C" {
#endif
""") """)
gAutoGenHEpilogueString = """ gAutoGenHEpilogueString = """
#ifdef __cplusplus
}
#endif
#endif #endif
""" """
@ -917,7 +926,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
"No generated token number for %s.%s\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName), "No generated token number for %s.%s\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
ExtraData="[%s]" % str(Info)) ExtraData="[%s]" % str(Info))
TokenNumber = PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] TokenNumber = PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName]
AutoGenH.Append('\n#define %s %d\n' % (PcdTokenName, TokenNumber)) AutoGenH.Append('\n#define %s %dU\n' % (PcdTokenName, TokenNumber))
EdkLogger.debug(EdkLogger.DEBUG_3, "Creating code for " + Pcd.TokenCName + "." + Pcd.TokenSpaceGuidCName) EdkLogger.debug(EdkLogger.DEBUG_3, "Creating code for " + Pcd.TokenCName + "." + Pcd.TokenSpaceGuidCName)
if Pcd.Type not in gItemTypeStringDatabase: if Pcd.Type not in gItemTypeStringDatabase:
@ -960,9 +969,9 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
if Pcd.DatumType == 'BOOLEAN': if Pcd.DatumType == 'BOOLEAN':
BoolValue = Value.upper() BoolValue = Value.upper()
if BoolValue == 'TRUE': if BoolValue == 'TRUE':
Value = 1 Value = '1U'
elif BoolValue == 'FALSE': elif BoolValue == 'FALSE':
Value = 0 Value = '0U'
if Pcd.DatumType in ['UINT64', 'UINT32', 'UINT16', 'UINT8']: if Pcd.DatumType in ['UINT64', 'UINT32', 'UINT16', 'UINT8']:
try: try:
@ -994,6 +1003,8 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
EdkLogger.error("build", AUTOGEN_ERROR, EdkLogger.error("build", AUTOGEN_ERROR,
"Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), "Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
ExtraData="[%s]" % str(Info)) ExtraData="[%s]" % str(Info))
if not Value.endswith('U'):
Value += 'U'
elif Pcd.DatumType == 'UINT16': elif Pcd.DatumType == 'UINT16':
if ValueNumber < 0: if ValueNumber < 0:
EdkLogger.error("build", AUTOGEN_ERROR, EdkLogger.error("build", AUTOGEN_ERROR,
@ -1003,6 +1014,8 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
EdkLogger.error("build", AUTOGEN_ERROR, EdkLogger.error("build", AUTOGEN_ERROR,
"Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), "Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
ExtraData="[%s]" % str(Info)) ExtraData="[%s]" % str(Info))
if not Value.endswith('U'):
Value += 'U'
elif Pcd.DatumType == 'UINT8': elif Pcd.DatumType == 'UINT8':
if ValueNumber < 0: if ValueNumber < 0:
EdkLogger.error("build", AUTOGEN_ERROR, EdkLogger.error("build", AUTOGEN_ERROR,
@ -1012,6 +1025,8 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
EdkLogger.error("build", AUTOGEN_ERROR, EdkLogger.error("build", AUTOGEN_ERROR,
"Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName), "Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
ExtraData="[%s]" % str(Info)) ExtraData="[%s]" % str(Info))
if not Value.endswith('U'):
Value += 'U'
if Pcd.DatumType == 'VOID*': if Pcd.DatumType == 'VOID*':
if Pcd.MaxDatumSize == None or Pcd.MaxDatumSize == '': if Pcd.MaxDatumSize == None or Pcd.MaxDatumSize == '':
EdkLogger.error("build", AUTOGEN_ERROR, EdkLogger.error("build", AUTOGEN_ERROR,
@ -1131,7 +1146,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
Type = '(VOID *)' Type = '(VOID *)'
Array = '[]' Array = '[]'
AutoGenH.Append('#define _PCD_TOKEN_%s %d\n' % (TokenCName, TokenNumber)) AutoGenH.Append('#define _PCD_TOKEN_%s %dU\n' % (TokenCName, TokenNumber))
PcdItemType = Pcd.Type PcdItemType = Pcd.Type
#if PcdItemType in gDynamicPcd: #if PcdItemType in gDynamicPcd:
@ -1405,6 +1420,8 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, Phase):
# #
if Pcd.DatumType == "UINT64": if Pcd.DatumType == "UINT64":
ValueList.append(Sku.DefaultValue + "ULL") ValueList.append(Sku.DefaultValue + "ULL")
elif Pcd.DatumType in ("UINT32", "UINT16", "UINT8"):
ValueList.append(Sku.DefaultValue + "U")
else: else:
ValueList.append(Sku.DefaultValue) ValueList.append(Sku.DefaultValue)

View File

@ -1312,17 +1312,16 @@ ${END}\t@cd $(BUILD_DIR)\n
if PlatformInfo.FdfFile != None and PlatformInfo.FdfFile != "": if PlatformInfo.FdfFile != None and PlatformInfo.FdfFile != "":
FdfFileList = [PlatformInfo.FdfFile] FdfFileList = [PlatformInfo.FdfFile]
# macros passed to GenFds # macros passed to GenFds
# MacroList.append('"%s=%s"' % ("WORKSPACE", GlobalData.gWorkspace)) MacroList.append('"%s=%s"' % ("EFI_SOURCE", GlobalData.gEfiSource.replace('\\', '\\\\')))
MacroList.append('"%s=%s"' % ("EFI_SOURCE", GlobalData.gEfiSource)) MacroList.append('"%s=%s"' % ("EDK_SOURCE", GlobalData.gEdkSource.replace('\\', '\\\\')))
MacroList.append('"%s=%s"' % ("EDK_SOURCE", GlobalData.gEdkSource))
for MacroName in GlobalData.gGlobalDefines: for MacroName in GlobalData.gGlobalDefines:
if GlobalData.gGlobalDefines[MacroName] != "": if GlobalData.gGlobalDefines[MacroName] != "":
MacroList.append('"%s=%s"' % (MacroName, GlobalData.gGlobalDefines[MacroName])) MacroList.append('"%s=%s"' % (MacroName, GlobalData.gGlobalDefines[MacroName].replace('\\', '\\\\')))
else: else:
MacroList.append('"%s"' % MacroName) MacroList.append('"%s"' % MacroName)
for MacroName in GlobalData.gCommandLineDefines: for MacroName in GlobalData.gCommandLineDefines:
if GlobalData.gCommandLineDefines[MacroName] != "": if GlobalData.gCommandLineDefines[MacroName] != "":
MacroList.append('"%s=%s"' % (MacroName, GlobalData.gCommandLineDefines[MacroName])) MacroList.append('"%s=%s"' % (MacroName, GlobalData.gCommandLineDefines[MacroName].replace('\\', '\\\\')))
else: else:
MacroList.append('"%s"' % MacroName) MacroList.append('"%s"' % MacroName)
else: else:

View File

@ -1,3 +1,3 @@
#This file is for build version number auto generation #This file is for build version number auto generation
# #
gBUILD_VERSION = "Build 2386" gBUILD_VERSION = "Build 2396"

View File

@ -82,7 +82,7 @@ class DecObject(object):
# @var KeyList: To store value for KeyList, a list for all Keys used in Dec # @var KeyList: To store value for KeyList, a list for all Keys used in Dec
# #
class Dec(DecObject): class Dec(DecObject):
def __init__(self, Filename = None, IsToDatabase = False, IsToPackage = False, WorkspaceDir = None, Database = None, SupArchList = DataType.ARCH_LIST): def __init__(self, Filename=None, IsToDatabase=False, IsToPackage=False, WorkspaceDir=None, Database=None, SupArchList=DataType.ARCH_LIST):
self.Identification = Identification() self.Identification = Identification()
self.Package = PackageClass() self.Package = PackageClass()
self.UserExtensions = '' self.UserExtensions = ''
@ -163,10 +163,10 @@ class Dec(DecObject):
# Remove comment block # Remove comment block
# #
if Line.find(TAB_COMMENT_EDK_START) > -1: if Line.find(TAB_COMMENT_EDK_START) > -1:
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0] ReservedLine = GetSplitList(Line, TAB_COMMENT_EDK_START, 1)[0]
IsFindBlockComment = True IsFindBlockComment = True
if Line.find(TAB_COMMENT_EDK_END) > -1: if Line.find(TAB_COMMENT_EDK_END) > -1:
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1] Line = ReservedLine + GetSplitList(Line, TAB_COMMENT_EDK_END, 1)[1]
ReservedLine = '' ReservedLine = ''
IsFindBlockComment = False IsFindBlockComment = False
if IsFindBlockComment: if IsFindBlockComment:
@ -206,7 +206,7 @@ class Dec(DecObject):
CurrentSection = ItemList[0] CurrentSection = ItemList[0]
else: else:
if CurrentSection != ItemList[0]: if CurrentSection != ItemList[0]:
EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
if CurrentSection.upper() not in self.KeyList: if CurrentSection.upper() not in self.KeyList:
RaiseParserError(Line, CurrentSection, Filename, '', LineNo) RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
ItemList.append('') ItemList.append('')
@ -215,7 +215,7 @@ class Dec(DecObject):
RaiseParserError(Line, CurrentSection, Filename, '', LineNo) RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
else: else:
if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL: if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL:
EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
ArchList.append(ItemList[1].upper()) ArchList.append(ItemList[1].upper())
ThirdList.append(ItemList[2]) ThirdList.append(ItemList[2])
@ -226,7 +226,7 @@ class Dec(DecObject):
# #
if CurrentSection == TAB_UNKNOWN: if CurrentSection == TAB_UNKNOWN:
ErrorMsg = "%s is not in any defined section" % Line ErrorMsg = "%s is not in any defined section" % Line
EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
# #
# Add a section item # Add a section item

View File

@ -75,7 +75,7 @@ class DecObject(object):
# @var KeyList: To store value for KeyList, a list for all Keys used in Dec # @var KeyList: To store value for KeyList, a list for all Keys used in Dec
# #
class Dec(DecObject): class Dec(DecObject):
def __init__(self, Filename = None, IsToPackage = False, WorkspaceDir = None, AllGuidVersionDict = None, SupArchList = DataType.ARCH_LIST): def __init__(self, Filename=None, IsToPackage=False, WorkspaceDir=None, AllGuidVersionDict=None, SupArchList=DataType.ARCH_LIST):
self.Identification = IdentificationClass() self.Identification = IdentificationClass()
self.Package = PackageClass() self.Package = PackageClass()
self.UserExtensions = '' self.UserExtensions = ''
@ -136,7 +136,7 @@ class Dec(DecObject):
LineNo = LineNo + 1 LineNo = LineNo + 1
# Remove comment block # Remove comment block
if Line.find(TAB_COMMENT_EDK_START) > -1: if Line.find(TAB_COMMENT_EDK_START) > -1:
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0] ReservedLine = GetSplitList(Line, TAB_COMMENT_EDK_START, 1)[0]
if ReservedLine.strip().startswith(TAB_COMMENT_SPLIT): if ReservedLine.strip().startswith(TAB_COMMENT_SPLIT):
Comment = Comment + Line.strip() + '\n' Comment = Comment + Line.strip() + '\n'
ReservedLine = '' ReservedLine = ''
@ -147,7 +147,7 @@ class Dec(DecObject):
continue continue
if Line.find(TAB_COMMENT_EDK_END) > -1: if Line.find(TAB_COMMENT_EDK_END) > -1:
Comment = Comment + Line[:Line.find(TAB_COMMENT_EDK_END) + len(TAB_COMMENT_EDK_END)] + '\n' Comment = Comment + Line[:Line.find(TAB_COMMENT_EDK_END) + len(TAB_COMMENT_EDK_END)] + '\n'
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1] Line = ReservedLine + GetSplitList(Line, TAB_COMMENT_EDK_END, 1)[1]
ReservedLine = '' ReservedLine = ''
IsFindBlockComment = False IsFindBlockComment = False
if IsFindBlockComment: if IsFindBlockComment:
@ -182,7 +182,7 @@ class Dec(DecObject):
CurrentSection = ItemList[0] CurrentSection = ItemList[0]
else: else:
if CurrentSection != ItemList[0]: if CurrentSection != ItemList[0]:
EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
if CurrentSection.upper() not in self.KeyList: if CurrentSection.upper() not in self.KeyList:
RaiseParserError(Line, CurrentSection, Filename, '', LineNo) RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
ItemList.append('') ItemList.append('')
@ -191,7 +191,7 @@ class Dec(DecObject):
RaiseParserError(Line, CurrentSection, Filename, '', LineNo) RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
else: else:
if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL: if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL:
EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
ArchList.append(ItemList[1].upper()) ArchList.append(ItemList[1].upper())
ThirdList.append(ItemList[2]) ThirdList.append(ItemList[2])
@ -205,7 +205,7 @@ class Dec(DecObject):
# Not in any defined section # Not in any defined section
if CurrentSection == TAB_UNKNOWN: if CurrentSection == TAB_UNKNOWN:
ErrorMsg = "%s is not in any defined section" % Line ErrorMsg = "%s is not in any defined section" % Line
EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
# Add a section item # Add a section item
SectionItemList.append([Line, LineNo, Comment]) SectionItemList.append([Line, LineNo, Comment])
@ -243,7 +243,7 @@ class Dec(DecObject):
if Package.UserExtensions != None: if Package.UserExtensions != None:
for Item in Package.UserExtensions.Defines: for Item in Package.UserExtensions.Defines:
TmpList.append(Item) TmpList.append(Item)
DecList['Defines'] =TmpList DecList['Defines'] = TmpList
if PackageHeader.Description != '': if PackageHeader.Description != '':
SectionHeaderCommentDict['Defines'] = PackageHeader.Description SectionHeaderCommentDict['Defines'] = PackageHeader.Description

View File

@ -91,7 +91,7 @@ class DscObject(object):
class Dsc(DscObject): class Dsc(DscObject):
_NullClassIndex = 0 _NullClassIndex = 0
def __init__(self, Filename = None, IsToDatabase = False, IsToPlatform = False, WorkspaceDir = None, Database = None): def __init__(self, Filename=None, IsToDatabase=False, IsToPlatform=False, WorkspaceDir=None, Database=None):
self.Identification = Identification() self.Identification = Identification()
self.Platform = PlatformClass() self.Platform = PlatformClass()
self.UserExtensions = '' self.UserExtensions = ''
@ -460,7 +460,7 @@ class Dsc(DscObject):
# @param Type: The type of Pcd # @param Type: The type of Pcd
# @param ContainerFile: The file which describes the pcd, used for error report # @param ContainerFile: The file which describes the pcd, used for error report
# #
def GenPcds(self, Type = '', ContainerFile = ''): def GenPcds(self, Type='', ContainerFile=''):
Pcds = {} Pcds = {}
if Type == DataType.TAB_PCDS_PATCHABLE_IN_MODULE: if Type == DataType.TAB_PCDS_PATCHABLE_IN_MODULE:
Model = MODEL_PCD_PATCHABLE_IN_MODULE Model = MODEL_PCD_PATCHABLE_IN_MODULE
@ -512,7 +512,7 @@ class Dsc(DscObject):
# @param Type: The type of Pcd # @param Type: The type of Pcd
# @param ContainerFile: The file which describes the pcd, used for error report # @param ContainerFile: The file which describes the pcd, used for error report
# #
def GenFeatureFlagPcds(self, Type = '', ContainerFile = ''): def GenFeatureFlagPcds(self, Type='', ContainerFile=''):
Pcds = {} Pcds = {}
if Type == DataType.TAB_PCDS_FEATURE_FLAG: if Type == DataType.TAB_PCDS_FEATURE_FLAG:
Model = MODEL_PCD_FEATURE_FLAG Model = MODEL_PCD_FEATURE_FLAG
@ -562,7 +562,7 @@ class Dsc(DscObject):
# @param Type: The type of Pcd # @param Type: The type of Pcd
# @param ContainerFile: The file which describes the pcd, used for error report # @param ContainerFile: The file which describes the pcd, used for error report
# #
def GenDynamicDefaultPcds(self, Type = '', ContainerFile = ''): def GenDynamicDefaultPcds(self, Type='', ContainerFile=''):
Pcds = {} Pcds = {}
SkuInfoList = {} SkuInfoList = {}
if Type == DataType.TAB_PCDS_DYNAMIC_DEFAULT: if Type == DataType.TAB_PCDS_DYNAMIC_DEFAULT:
@ -594,20 +594,20 @@ class Dsc(DscObject):
if CleanString(NewItem) == '': if CleanString(NewItem) == '':
continue continue
(K1, K2, K3, K4, K5, K6) = GetDynamicDefaultPcd(NewItem, Type, Filename, -1) (K1, K2, K3, K4, K5, K6) = GetDynamicDefaultPcd(NewItem, Type, Filename, -1)
MergeArches(Pcds, (K1, K2, K3, K4, K5, K6, IncludeFile[4]), Arch) MergeArches(Pcds, (K1, K2, K3, K4, K5, K6, IncludeFile[4]), Arch)
self.PcdToken[Record[3]] = (K2, K1) self.PcdToken[Record[3]] = (K2, K1)
for Record in RecordSet: for Record in RecordSet:
if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON.upper(): if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON.upper():
(K1, K2, K3, K4, K5, K6) = GetDynamicDefaultPcd(Record[0], Type, ContainerFile, Record[2]) (K1, K2, K3, K4, K5, K6) = GetDynamicDefaultPcd(Record[0], Type, ContainerFile, Record[2])
MergeArches(Pcds, (K1, K2, K3, K4, K5, K6, Record[4]), Arch) MergeArches(Pcds, (K1, K2, K3, K4, K5, K6, Record[4]), Arch)
self.PcdToken[Record[3]] = (K2, K1) self.PcdToken[Record[3]] = (K2, K1)
for Key in Pcds: for Key in Pcds:
(Status, SkuInfoList) = self.GenSkuInfoList(Key[6], self.Platform.SkuInfos.SkuInfoList, '', '', '', '', '', Key[2]) (Status, SkuInfoList) = self.GenSkuInfoList(Key[6], self.Platform.SkuInfos.SkuInfoList, '', '', '', '', '', Key[2])
if Status == False: if Status == False:
ErrorMsg = "The SKUID '%s' used in section '%s' is not defined in section [SkuIds]" % (SkuInfoList, Type) ErrorMsg = "The SKUID '%s' used in section '%s' is not defined in section [SkuIds]" % (SkuInfoList, Type)
EdkLogger.error("DSC File Parser", PARSER_ERROR, ErrorMsg, ContainerFile, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("DSC File Parser", PARSER_ERROR, ErrorMsg, ContainerFile, RaiseError=EdkLogger.IsRaiseError)
Pcd = PcdClass(Key[0], '', Key[1], Key[3], Key[4], Key[2], Key[5], [], SkuInfoList, []) Pcd = PcdClass(Key[0], '', Key[1], Key[3], Key[4], Key[2], Key[5], [], SkuInfoList, [])
Pcd.SupArchList = Pcds[Key] Pcd.SupArchList = Pcds[Key]
self.Platform.DynamicPcdBuildDefinitions.append(Pcd) self.Platform.DynamicPcdBuildDefinitions.append(Pcd)
@ -619,7 +619,7 @@ class Dsc(DscObject):
# @param Type: The type of Pcd # @param Type: The type of Pcd
# @param ContainerFile: The file which describes the pcd, used for error report # @param ContainerFile: The file which describes the pcd, used for error report
# #
def GenDynamicHiiPcds(self, Type = '', ContainerFile = ''): def GenDynamicHiiPcds(self, Type='', ContainerFile=''):
Pcds = {} Pcds = {}
SkuInfoList = {} SkuInfoList = {}
if Type == DataType.TAB_PCDS_DYNAMIC_HII: if Type == DataType.TAB_PCDS_DYNAMIC_HII:
@ -651,20 +651,20 @@ class Dsc(DscObject):
if CleanString(NewItem) == '': if CleanString(NewItem) == '':
continue continue
(K1, K2, K3, K4, K5, K6, K7, K8) = GetDynamicHiiPcd(NewItem, Type, Filename, -1) (K1, K2, K3, K4, K5, K6, K7, K8) = GetDynamicHiiPcd(NewItem, Type, Filename, -1)
MergeArches(Pcds, (K1, K2, K3, K4, K5, K6, K7, K8, IncludeFile[4]), Arch) MergeArches(Pcds, (K1, K2, K3, K4, K5, K6, K7, K8, IncludeFile[4]), Arch)
self.PcdToken[Record[3]] = (K2, K1) self.PcdToken[Record[3]] = (K2, K1)
for Record in RecordSet: for Record in RecordSet:
if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON.upper(): if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON.upper():
(K1, K2, K3, K4, K5, K6, K7, K8) = GetDynamicHiiPcd(Record[0], Type, ContainerFile, Record[2]) (K1, K2, K3, K4, K5, K6, K7, K8) = GetDynamicHiiPcd(Record[0], Type, ContainerFile, Record[2])
MergeArches(Pcds, (K1, K2, K3, K4, K5, K6, K7, K8, Record[4]), Arch) MergeArches(Pcds, (K1, K2, K3, K4, K5, K6, K7, K8, Record[4]), Arch)
self.PcdToken[Record[3]] = (K2, K1) self.PcdToken[Record[3]] = (K2, K1)
for Key in Pcds: for Key in Pcds:
(Status, SkuInfoList) = self.GenSkuInfoList(Key[8], self.Platform.SkuInfos.SkuInfoList, Key[2], Key[3], Key[4], Key[5], '', '') (Status, SkuInfoList) = self.GenSkuInfoList(Key[8], self.Platform.SkuInfos.SkuInfoList, Key[2], Key[3], Key[4], Key[5], '', '')
if Status == False: if Status == False:
ErrorMsg = "The SKUID '%s' used in section '%s' is not defined in section [SkuIds]" % (SkuInfoList, Type) ErrorMsg = "The SKUID '%s' used in section '%s' is not defined in section [SkuIds]" % (SkuInfoList, Type)
EdkLogger.error("DSC File Parser", PARSER_ERROR, ErrorMsg, ContainerFile, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("DSC File Parser", PARSER_ERROR, ErrorMsg, ContainerFile, RaiseError=EdkLogger.IsRaiseError)
Pcd = PcdClass(Key[0], '', Key[1], '', Key[6], Key[5], Key[7], [], SkuInfoList, []) Pcd = PcdClass(Key[0], '', Key[1], '', Key[6], Key[5], Key[7], [], SkuInfoList, [])
Pcd.SupArchList = Pcds[Key] Pcd.SupArchList = Pcds[Key]
self.Platform.DynamicPcdBuildDefinitions.append(Pcd) self.Platform.DynamicPcdBuildDefinitions.append(Pcd)
@ -676,7 +676,7 @@ class Dsc(DscObject):
# @param Type: The type of Pcd # @param Type: The type of Pcd
# @param ContainerFile: The file which describes the pcd, used for error report # @param ContainerFile: The file which describes the pcd, used for error report
# #
def GenDynamicVpdPcds(self, Type = '', ContainerFile = ''): def GenDynamicVpdPcds(self, Type='', ContainerFile=''):
Pcds = {} Pcds = {}
SkuInfoList = {} SkuInfoList = {}
if Type == DataType.TAB_PCDS_DYNAMIC_VPD: if Type == DataType.TAB_PCDS_DYNAMIC_VPD:
@ -708,20 +708,20 @@ class Dsc(DscObject):
if CleanString(NewItem) == '': if CleanString(NewItem) == '':
continue continue
(K1, K2, K3, K4, K5) = GetDynamicVpdPcd(NewItem, Type, Filename, -1) (K1, K2, K3, K4, K5) = GetDynamicVpdPcd(NewItem, Type, Filename, -1)
MergeArches(Pcds, (K1, K2, K3, K4, K5, IncludeFile[4]), Arch) MergeArches(Pcds, (K1, K2, K3, K4, K5, IncludeFile[4]), Arch)
self.PcdToken[Record[3]] = (K2, K1) self.PcdToken[Record[3]] = (K2, K1)
for Record in RecordSet: for Record in RecordSet:
if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON.upper(): if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON.upper():
(K1, K2, K3, K4, K5) = GetDynamicVpdPcd(Record[0], Type, ContainerFile, Record[2]) (K1, K2, K3, K4, K5) = GetDynamicVpdPcd(Record[0], Type, ContainerFile, Record[2])
MergeArches(Pcds, (K1, K2, K3, K4, K5, Record[4]), Arch) MergeArches(Pcds, (K1, K2, K3, K4, K5, Record[4]), Arch)
self.PcdToken[Record[3]] = (K2, K1) self.PcdToken[Record[3]] = (K2, K1)
for Key in Pcds: for Key in Pcds:
(Status, SkuInfoList) = self.GenSkuInfoList(Key[5], self.Platform.SkuInfos.SkuInfoList, '', '', '', '', Key[2], '') (Status, SkuInfoList) = self.GenSkuInfoList(Key[5], self.Platform.SkuInfos.SkuInfoList, '', '', '', '', Key[2], '')
if Status == False: if Status == False:
ErrorMsg = "The SKUID '%s' used in section '%s' is not defined in section [SkuIds]" % (SkuInfoList, Type) ErrorMsg = "The SKUID '%s' used in section '%s' is not defined in section [SkuIds]" % (SkuInfoList, Type)
EdkLogger.error("DSC File Parser", PARSER_ERROR, ErrorMsg, ContainerFile, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("DSC File Parser", PARSER_ERROR, ErrorMsg, ContainerFile, RaiseError=EdkLogger.IsRaiseError)
Pcd = PcdClass(Key[0], '', Key[1], '', Key[3], '', Key[4], [], SkuInfoList, []) Pcd = PcdClass(Key[0], '', Key[1], '', Key[3], '', Key[4], [], SkuInfoList, [])
Pcd.SupArchList = Pcds[Key] Pcd.SupArchList = Pcds[Key]
self.Platform.DynamicPcdBuildDefinitions.append(Pcd) self.Platform.DynamicPcdBuildDefinitions.append(Pcd)
@ -769,7 +769,7 @@ class Dsc(DscObject):
SubLibSet = QueryDscItem(self.TblDsc, MODEL_EFI_LIBRARY_CLASS, Record[3], self.FileID) SubLibSet = QueryDscItem(self.TblDsc, MODEL_EFI_LIBRARY_CLASS, Record[3], self.FileID)
for SubLib in SubLibSet: for SubLib in SubLibSet:
Lib.append(TAB_VALUE_SPLIT.join([SubLib[0],SubLib[4]])) Lib.append(TAB_VALUE_SPLIT.join([SubLib[0], SubLib[4]]))
SubBoSet = QueryDscItem(self.TblDsc, MODEL_META_DATA_BUILD_OPTION, Record[3], self.FileID) SubBoSet = QueryDscItem(self.TblDsc, MODEL_META_DATA_BUILD_OPTION, Record[3], self.FileID)
for SubBo in SubBoSet: for SubBo in SubBoSet:
@ -806,7 +806,7 @@ class Dsc(DscObject):
# #
# @retval PlatformModuleClass() A instance for PlatformModuleClass # @retval PlatformModuleClass() A instance for PlatformModuleClass
# #
def GenComponent(self, Item, ContainerFile, LineNo = -1): def GenComponent(self, Item, ContainerFile, LineNo= -1):
(InfFilename, ExecFilename) = GetExec(Item[0]) (InfFilename, ExecFilename) = GetExec(Item[0])
LibraryClasses = Item[1] LibraryClasses = Item[1]
BuildOptions = Item[2] BuildOptions = Item[2]
@ -894,7 +894,7 @@ class Dsc(DscObject):
# @retval (False, SkuName) Not found in section SkuId Dsc file # @retval (False, SkuName) Not found in section SkuId Dsc file
# @retval (True, SkuInfoList) Found in section SkuId of Dsc file # @retval (True, SkuInfoList) Found in section SkuId of Dsc file
# #
def GenSkuInfoList(self, SkuNameList, SkuInfo, VariableName = '', VariableGuid = '', VariableOffset = '', HiiDefaultValue = '', VpdOffset = '', DefaultValue = ''): def GenSkuInfoList(self, SkuNameList, SkuInfo, VariableName='', VariableGuid='', VariableOffset='', HiiDefaultValue='', VpdOffset='', DefaultValue=''):
SkuNameList = GetSplitValueList(SkuNameList) SkuNameList = GetSplitValueList(SkuNameList)
if SkuNameList == None or SkuNameList == [] or SkuNameList == ['']: if SkuNameList == None or SkuNameList == [] or SkuNameList == ['']:
SkuNameList = ['DEFAULT'] SkuNameList = ['DEFAULT']
@ -964,7 +964,7 @@ class Dsc(DscObject):
(Value1, Value2, Value3, Model, StartColumn, EndColumn, Enabled) = ('', '', '', -1, -1, -1, 0) (Value1, Value2, Value3, Model, StartColumn, EndColumn, Enabled) = ('', '', '', -1, -1, -1, 0)
if IfDefList == []: if IfDefList == []:
ErrorMsg = 'Not suited conditional statement in file %s' % Filename ErrorMsg = 'Not suited conditional statement in file %s' % Filename
EdkLogger.error("DSC File Parser", PARSER_ERROR, ErrorMsg, Filename, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("DSC File Parser", PARSER_ERROR, ErrorMsg, Filename, RaiseError=EdkLogger.IsRaiseError)
else: else:
# #
# Get New Dsc item ID # Get New Dsc item ID
@ -1046,10 +1046,10 @@ class Dsc(DscObject):
# Remove comment block # Remove comment block
# #
if Line.find(TAB_COMMENT_EDK_START) > -1: if Line.find(TAB_COMMENT_EDK_START) > -1:
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0] ReservedLine = GetSplitList(Line, TAB_COMMENT_EDK_START, 1)[0]
IsFindBlockComment = True IsFindBlockComment = True
if Line.find(TAB_COMMENT_EDK_END) > -1: if Line.find(TAB_COMMENT_EDK_END) > -1:
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1] Line = ReservedLine + GetSplitList(Line, TAB_COMMENT_EDK_END, 1)[1]
ReservedLine = '' ReservedLine = ''
IsFindBlockComment = False IsFindBlockComment = False
if IsFindBlockComment: if IsFindBlockComment:
@ -1087,7 +1087,7 @@ class Dsc(DscObject):
CurrentSection = ItemList[0] CurrentSection = ItemList[0]
else: else:
if CurrentSection != ItemList[0]: if CurrentSection != ItemList[0]:
EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
if CurrentSection.upper() not in self.KeyList: if CurrentSection.upper() not in self.KeyList:
RaiseParserError(Line, CurrentSection, Filename, '', LineNo) RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
CurrentSection = TAB_UNKNOWN CurrentSection = TAB_UNKNOWN
@ -1098,7 +1098,7 @@ class Dsc(DscObject):
RaiseParserError(Line, CurrentSection, Filename, '', LineNo) RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
else: else:
if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL: if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL:
EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
ArchList.append(ItemList[1].upper()) ArchList.append(ItemList[1].upper())
ThirdList.append(ItemList[2]) ThirdList.append(ItemList[2])
@ -1109,7 +1109,7 @@ class Dsc(DscObject):
# #
if CurrentSection == TAB_UNKNOWN: if CurrentSection == TAB_UNKNOWN:
ErrorMsg = "%s is not in any defined section" % Line ErrorMsg = "%s is not in any defined section" % Line
EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
# #
# Add a section item # Add a section item
@ -1161,7 +1161,7 @@ class Dsc(DscObject):
MODEL_META_DATA_DEFINE) MODEL_META_DATA_DEFINE)
RecordSet = self.TblDsc.Exec(SqlCommand) RecordSet = self.TblDsc.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
SqlCommand = """Update %s set Enabled = -1 where StartLine >= %s and EndLine <= %s""" %(self.TblDsc.Table, Record[0], Record[1]) SqlCommand = """Update %s set Enabled = -1 where StartLine >= %s and EndLine <= %s""" % (self.TblDsc.Table, Record[0], Record[1])
self.TblDsc.Exec(SqlCommand) self.TblDsc.Exec(SqlCommand)
# #
@ -1185,8 +1185,8 @@ class Dsc(DscObject):
MODEL_META_DATA_DEFINE) MODEL_META_DATA_DEFINE)
RecordSet = self.TblDsc.Exec(SqlCommand) RecordSet = self.TblDsc.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
SqlCommand = """Update %s set Enabled = -1 where StartLine >= %s and EndLine <= %s""" %(self.TblDsc.Table, Record[0], Record[1]) SqlCommand = """Update %s set Enabled = -1 where StartLine >= %s and EndLine <= %s""" % (self.TblDsc.Table, Record[0], Record[1])
EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand) EdkLogger.debug(4, "SqlCommand: %s" % SqlCommand)
self.Cur.execute(SqlCommand) self.Cur.execute(SqlCommand)
# #
@ -1210,13 +1210,13 @@ class Dsc(DscObject):
for Record in RecordSet: for Record in RecordSet:
if Record[0] == MODEL_META_DATA_CONDITIONAL_STATEMENT_IF: if Record[0] == MODEL_META_DATA_CONDITIONAL_STATEMENT_IF:
if not self.Compare(Record[6], Record[2], Record[3]): if not self.Compare(Record[6], Record[2], Record[3]):
SqlCommand = """Update %s set Enabled = -1 where StartLine >= %s and EndLine <= %s""" %(self.TblDsc.Table, Record[4], Record[5]) SqlCommand = """Update %s set Enabled = -1 where StartLine >= %s and EndLine <= %s""" % (self.TblDsc.Table, Record[4], Record[5])
self.TblDsc.Exec(SqlCommand) self.TblDsc.Exec(SqlCommand)
else: else:
DisabledList.append(Record[1]) DisabledList.append(Record[1])
continue continue
if Record[0] == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE and Record[1] in DisabledList: if Record[0] == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE and Record[1] in DisabledList:
SqlCommand = """Update %s set Enabled = -1 where StartLine >= %s and EndLine <= %s""" %(self.TblDsc.Table, Record[4], Record[5]) SqlCommand = """Update %s set Enabled = -1 where StartLine >= %s and EndLine <= %s""" % (self.TblDsc.Table, Record[4], Record[5])
self.TblDsc.Exec(SqlCommand) self.TblDsc.Exec(SqlCommand)
## Compare ## Compare
@ -1227,7 +1227,7 @@ class Dsc(DscObject):
# @param Value2: # @param Value2:
# #
def Compare(self, Value1, CompareType, Value2): def Compare(self, Value1, CompareType, Value2):
Command = """Value1 %s Value2""" %CompareType Command = """Value1 %s Value2""" % CompareType
return eval(Command) return eval(Command)
## First time to insert records to database ## First time to insert records to database
@ -1259,7 +1259,7 @@ class Dsc(DscObject):
LineValue, StartLine, EndLine = SectionItem[0], SectionItem[1], SectionItem[1] LineValue, StartLine, EndLine = SectionItem[0], SectionItem[1], SectionItem[1]
EdkLogger.debug(4, "Parsing %s ..." %LineValue) EdkLogger.debug(4, "Parsing %s ..." % LineValue)
# #
# Parse '!ifdef' # Parse '!ifdef'
# #
@ -1337,10 +1337,10 @@ class Dsc(DscObject):
Components = [] Components = []
GetComponent(SectionItemList, Components) GetComponent(SectionItemList, Components)
for Component in Components: for Component in Components:
EdkLogger.debug(4, "Parsing component %s ..." %Component) EdkLogger.debug(4, "Parsing component %s ..." % Component)
DscItmeID = self.TblDsc.Insert(MODEL_META_DATA_COMPONENT, Component[0], '', '', Arch, -1, FileID, StartLine, -1, StartLine, -1, 0) DscItmeID = self.TblDsc.Insert(MODEL_META_DATA_COMPONENT, Component[0], '', '', Arch, -1, FileID, StartLine, -1, StartLine, -1, 0)
for Item in Component[1]: for Item in Component[1]:
List = GetSplitValueList(Item, MaxSplit = 2) List = GetSplitValueList(Item, MaxSplit=2)
LibName, LibIns = '', '' LibName, LibIns = '', ''
if len(List) == 2: if len(List) == 2:
LibName = List[0] LibName = List[0]

View File

@ -163,7 +163,7 @@ class InfObject(object):
# @var KeyList: To store value for KeyList, a list for all Keys used in Inf # @var KeyList: To store value for KeyList, a list for all Keys used in Inf
# #
class Inf(InfObject): class Inf(InfObject):
def __init__(self, Filename = None, IsToDatabase = False, IsToModule = False, WorkspaceDir = None, Database = None, SupArchList = DataType.ARCH_LIST): def __init__(self, Filename=None, IsToDatabase=False, IsToModule=False, WorkspaceDir=None, Database=None, SupArchList=DataType.ARCH_LIST):
self.Identification = Identification() self.Identification = Identification()
self.Module = ModuleClass() self.Module = ModuleClass()
self.UserExtensions = '' self.UserExtensions = ''
@ -353,10 +353,10 @@ class Inf(InfObject):
# Remove comment block # Remove comment block
# #
if Line.find(TAB_COMMENT_EDK_START) > -1: if Line.find(TAB_COMMENT_EDK_START) > -1:
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0] ReservedLine = GetSplitList(Line, TAB_COMMENT_EDK_START, 1)[0]
IsFindBlockComment = True IsFindBlockComment = True
if Line.find(TAB_COMMENT_EDK_END) > -1: if Line.find(TAB_COMMENT_EDK_END) > -1:
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1] Line = ReservedLine + GetSplitList(Line, TAB_COMMENT_EDK_END, 1)[1]
ReservedLine = '' ReservedLine = ''
IsFindBlockComment = False IsFindBlockComment = False
if IsFindBlockComment: if IsFindBlockComment:
@ -397,7 +397,7 @@ class Inf(InfObject):
CurrentSection = ItemList[0] CurrentSection = ItemList[0]
else: else:
if CurrentSection != ItemList[0]: if CurrentSection != ItemList[0]:
EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
if CurrentSection.upper() not in self.KeyList: if CurrentSection.upper() not in self.KeyList:
RaiseParserError(Line, CurrentSection, Filename, '', LineNo) RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
CurrentSection = TAB_UNKNOWN CurrentSection = TAB_UNKNOWN
@ -408,7 +408,7 @@ class Inf(InfObject):
RaiseParserError(Line, CurrentSection, Filename, '', LineNo) RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
else: else:
if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL: if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL:
EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
ArchList.append(ItemList[1].upper()) ArchList.append(ItemList[1].upper())
ThirdList.append(ItemList[2]) ThirdList.append(ItemList[2])
@ -419,7 +419,7 @@ class Inf(InfObject):
# #
if CurrentSection == TAB_UNKNOWN: if CurrentSection == TAB_UNKNOWN:
ErrorMsg = "%s is not in any defined section" % Line ErrorMsg = "%s is not in any defined section" % Line
EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
# #
# Add a section item # Add a section item
@ -497,13 +497,13 @@ class Inf(InfObject):
print Item.Name, Item.Value, Item.SupArchList print Item.Name, Item.Value, Item.SupArchList
print '\nPcds =', M.PcdCodes print '\nPcds =', M.PcdCodes
for Item in M.PcdCodes: for Item in M.PcdCodes:
print '\tCName=',Item.CName, 'TokenSpaceGuidCName=', Item.TokenSpaceGuidCName, 'DefaultValue=', Item.DefaultValue, 'ItemType=', Item.ItemType, Item.SupArchList print '\tCName=', Item.CName, 'TokenSpaceGuidCName=', Item.TokenSpaceGuidCName, 'DefaultValue=', Item.DefaultValue, 'ItemType=', Item.ItemType, Item.SupArchList
print '\nSources =', M.Sources print '\nSources =', M.Sources
for Source in M.Sources: for Source in M.Sources:
print Source.SourceFile, 'Fam=', Source.ToolChainFamily, 'Pcd=', Source.FeatureFlag, 'Tag=', Source.TagName, 'ToolCode=', Source.ToolCode, Source.SupArchList print Source.SourceFile, 'Fam=', Source.ToolChainFamily, 'Pcd=', Source.FeatureFlag, 'Tag=', Source.TagName, 'ToolCode=', Source.ToolCode, Source.SupArchList
print '\nUserExtensions =', M.UserExtensions print '\nUserExtensions =', M.UserExtensions
for UserExtension in M.UserExtensions: for UserExtension in M.UserExtensions:
print UserExtension.UserID, UserExtension.Identifier,UserExtension.Content print UserExtension.UserID, UserExtension.Identifier, UserExtension.Content
print '\nGuids =', M.Guids print '\nGuids =', M.Guids
for Item in M.Guids: for Item in M.Guids:
print Item.CName, Item.SupArchList, Item.FeatureFlag print Item.CName, Item.SupArchList, Item.FeatureFlag
@ -629,7 +629,7 @@ class Inf(InfObject):
if ModuleHeader.ComponentType in gComponentType2ModuleType: if ModuleHeader.ComponentType in gComponentType2ModuleType:
ModuleHeader.ModuleType = gComponentType2ModuleType[ModuleHeader.ComponentType] ModuleHeader.ModuleType = gComponentType2ModuleType[ModuleHeader.ComponentType]
elif ModuleHeader.ComponentType != '': elif ModuleHeader.ComponentType != '':
EdkLogger.error("Parser", PARSER_ERROR, "Unsupported Edk component type [%s]" % ModuleHeader.ComponentType, ExtraData=File, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Unsupported Edk component type [%s]" % ModuleHeader.ComponentType, ExtraData=File, RaiseError=EdkLogger.IsRaiseError)
self.Module.Header[Arch] = ModuleHeader self.Module.Header[Arch] = ModuleHeader

View File

@ -139,7 +139,7 @@ class InfObject(object):
# @var KeyList: To store value for KeyList, a list for all Keys used in Inf # @var KeyList: To store value for KeyList, a list for all Keys used in Inf
# #
class Inf(InfObject): class Inf(InfObject):
def __init__(self, Filename = None, IsToModule = False, WorkspaceDir = None, PackageDir = None, SupArchList = DataType.ARCH_LIST): def __init__(self, Filename=None, IsToModule=False, WorkspaceDir=None, PackageDir=None, SupArchList=DataType.ARCH_LIST):
self.Identification = IdentificationClass() self.Identification = IdentificationClass()
self.Module = ModuleClass() self.Module = ModuleClass()
self.WorkspaceDir = WorkspaceDir self.WorkspaceDir = WorkspaceDir
@ -412,7 +412,7 @@ class Inf(InfObject):
LineNo = LineNo + 1 LineNo = LineNo + 1
# Remove comment block # Remove comment block
if Line.find(TAB_COMMENT_EDK_START) > -1: if Line.find(TAB_COMMENT_EDK_START) > -1:
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0] ReservedLine = GetSplitList(Line, TAB_COMMENT_EDK_START, 1)[0]
if ReservedLine.strip().startswith(TAB_COMMENT_SPLIT): if ReservedLine.strip().startswith(TAB_COMMENT_SPLIT):
Comment = Comment + Line.strip() + '\n' Comment = Comment + Line.strip() + '\n'
ReservedLine = '' ReservedLine = ''
@ -423,7 +423,7 @@ class Inf(InfObject):
continue continue
if Line.find(TAB_COMMENT_EDK_END) > -1: if Line.find(TAB_COMMENT_EDK_END) > -1:
Comment = Comment + Line[:Line.find(TAB_COMMENT_EDK_END) + len(TAB_COMMENT_EDK_END)] + '\n' Comment = Comment + Line[:Line.find(TAB_COMMENT_EDK_END) + len(TAB_COMMENT_EDK_END)] + '\n'
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1] Line = ReservedLine + GetSplitList(Line, TAB_COMMENT_EDK_END, 1)[1]
ReservedLine = '' ReservedLine = ''
IsFindBlockComment = False IsFindBlockComment = False
if IsFindBlockComment: if IsFindBlockComment:
@ -460,7 +460,7 @@ class Inf(InfObject):
CurrentSection = ItemList[0] CurrentSection = ItemList[0]
else: else:
if CurrentSection != ItemList[0]: if CurrentSection != ItemList[0]:
EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
if CurrentSection.upper() not in self.KeyList: if CurrentSection.upper() not in self.KeyList:
RaiseParserError(Line, CurrentSection, Filename, '', LineNo) RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
ItemList.append('') ItemList.append('')
@ -469,7 +469,7 @@ class Inf(InfObject):
RaiseParserError(Line, CurrentSection, Filename, '', LineNo) RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
else: else:
if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL: if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL:
EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
ArchList.append(ItemList[1].upper()) ArchList.append(ItemList[1].upper())
ThirdList.append(ItemList[2]) ThirdList.append(ItemList[2])
@ -483,7 +483,7 @@ class Inf(InfObject):
# Not in any defined section # Not in any defined section
if CurrentSection == TAB_UNKNOWN: if CurrentSection == TAB_UNKNOWN:
ErrorMsg = "%s is not in any defined section" % Line ErrorMsg = "%s is not in any defined section" % Line
EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
# Add a section item # Add a section item
SectionItemList.append([Line, LineNo, Comment]) SectionItemList.append([Line, LineNo, Comment])
@ -526,7 +526,7 @@ class Inf(InfObject):
print Item.FilePath, Item.SupArchList, Item.FeatureFlag print Item.FilePath, Item.SupArchList, Item.FeatureFlag
print '\nPcds =' print '\nPcds ='
for Item in M.PcdCodes: for Item in M.PcdCodes:
print '\tCName=',Item.CName, 'TokenSpaceGuidCName=', Item.TokenSpaceGuidCName, 'DefaultValue=', Item.DefaultValue, 'ItemType=', Item.ItemType, Item.SupArchList print '\tCName=', Item.CName, 'TokenSpaceGuidCName=', Item.TokenSpaceGuidCName, 'DefaultValue=', Item.DefaultValue, 'ItemType=', Item.ItemType, Item.SupArchList
print '\nSources =' print '\nSources ='
for Source in M.Sources: for Source in M.Sources:
print Source.SourceFile, 'Fam=', Source.ToolChainFamily, 'Pcd=', Source.FeatureFlag, 'Tag=', Source.TagName, 'ToolCode=', Source.ToolCode, Source.SupArchList print Source.SourceFile, 'Fam=', Source.ToolChainFamily, 'Pcd=', Source.FeatureFlag, 'Tag=', Source.TagName, 'ToolCode=', Source.ToolCode, Source.SupArchList

View File

@ -24,7 +24,7 @@ import GlobalData
from BuildToolError import * from BuildToolError import *
from CommonDataClass.Exceptions import * from CommonDataClass.Exceptions import *
gHexVerPatt = re.compile('0x[a-f0-9]{4}[a-f0-9]{4}$',re.IGNORECASE) gHexVerPatt = re.compile('0x[a-f0-9]{4}[a-f0-9]{4}$', re.IGNORECASE)
gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$') gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$')
## GetSplitValueList ## GetSplitValueList
@ -39,7 +39,7 @@ gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$')
# #
# @retval list() A list for splitted string # @retval list() A list for splitted string
# #
def GetSplitValueList(String, SplitTag = DataType.TAB_VALUE_SPLIT, MaxSplit = -1): def GetSplitValueList(String, SplitTag=DataType.TAB_VALUE_SPLIT, MaxSplit= -1):
ValueList = [] ValueList = []
Last = 0 Last = 0
Escaped = False Escaped = False
@ -51,7 +51,7 @@ def GetSplitValueList(String, SplitTag = DataType.TAB_VALUE_SPLIT, MaxSplit = -1
# Found a splitter not in a string, split it # Found a splitter not in a string, split it
if not InString and Char == SplitTag: if not InString and Char == SplitTag:
ValueList.append(String[Last:Index].strip()) ValueList.append(String[Last:Index].strip())
Last = Index+1 Last = Index + 1
if MaxSplit > 0 and len(ValueList) >= MaxSplit: if MaxSplit > 0 and len(ValueList) >= MaxSplit:
break break
@ -84,7 +84,7 @@ def GetSplitValueList(String, SplitTag = DataType.TAB_VALUE_SPLIT, MaxSplit = -1
# #
# @retval list() A list for splitted string # @retval list() A list for splitted string
# #
def GetSplitList(String, SplitStr = DataType.TAB_VALUE_SPLIT, MaxSplit = -1): def GetSplitList(String, SplitStr=DataType.TAB_VALUE_SPLIT, MaxSplit= -1):
return map(lambda l: l.strip(), String.split(SplitStr, MaxSplit)) return map(lambda l: l.strip(), String.split(SplitStr, MaxSplit))
## MergeArches ## MergeArches
@ -235,7 +235,7 @@ def SplitModuleType(Key):
# #
# @retval NewList A new string list whose macros are replaced # @retval NewList A new string list whose macros are replaced
# #
def ReplaceMacros(StringList, MacroDefinitions={}, SelfReplacement = False): def ReplaceMacros(StringList, MacroDefinitions={}, SelfReplacement=False):
NewList = [] NewList = []
for String in StringList: for String in StringList:
if type(String) == type(''): if type(String) == type(''):
@ -289,7 +289,7 @@ def ReplaceMacro(String, MacroDefinitions={}, SelfReplacement=False, RaiseError=
# #
# @retval Path Formatted path # @retval Path Formatted path
# #
def NormPath(Path, Defines = {}): def NormPath(Path, Defines={}):
IsRelativePath = False IsRelativePath = False
if Path: if Path:
if Path[0] == '.': if Path[0] == '.':
@ -319,7 +319,7 @@ def NormPath(Path, Defines = {}):
# #
# @retval Path Formatted path # @retval Path Formatted path
# #
def CleanString(Line, CommentCharacter = DataType.TAB_COMMENT_SPLIT, AllowCppStyleComment=False): def CleanString(Line, CommentCharacter=DataType.TAB_COMMENT_SPLIT, AllowCppStyleComment=False):
# #
# remove whitespace # remove whitespace
# #
@ -348,13 +348,13 @@ def CleanString(Line, CommentCharacter = DataType.TAB_COMMENT_SPLIT, AllowCppSty
ChIndex = Line.find('#') ChIndex = Line.find('#')
while ChIndex >= 0: while ChIndex >= 0:
if GlobalData.gIsWindows: if GlobalData.gIsWindows:
if ChIndex == 0 or Line[ChIndex-1] != '^': if ChIndex == 0 or Line[ChIndex - 1] != '^':
Line = Line[0:ChIndex] + '^' + Line[ChIndex:] Line = Line[0:ChIndex] + '^' + Line[ChIndex:]
ChIndex = Line.find('#', ChIndex + 2) ChIndex = Line.find('#', ChIndex + 2)
else: else:
ChIndex = Line.find('#', ChIndex + 1) ChIndex = Line.find('#', ChIndex + 1)
else: else:
if ChIndex == 0 or Line[ChIndex-1] != '\\': if ChIndex == 0 or Line[ChIndex - 1] != '\\':
Line = Line[0:ChIndex] + '\\' + Line[ChIndex:] Line = Line[0:ChIndex] + '\\' + Line[ChIndex:]
ChIndex = Line.find('#', ChIndex + 2) ChIndex = Line.find('#', ChIndex + 2)
else: else:
@ -376,7 +376,7 @@ def CleanString(Line, CommentCharacter = DataType.TAB_COMMENT_SPLIT, AllowCppSty
# #
# @retval Path Formatted path # @retval Path Formatted path
# #
def CleanString2(Line, CommentCharacter = DataType.TAB_COMMENT_SPLIT, AllowCppStyleComment=False): def CleanString2(Line, CommentCharacter=DataType.TAB_COMMENT_SPLIT, AllowCppStyleComment=False):
# #
# remove whitespace # remove whitespace
# #
@ -468,7 +468,7 @@ def GetHexVerValue(VerString):
if len(Minor) == 1: if len(Minor) == 1:
Minor += '0' Minor += '0'
DeciValue = (int(Major) << 16) + int(Minor); DeciValue = (int(Major) << 16) + int(Minor);
return "0x%08x"%DeciValue return "0x%08x" % DeciValue
elif gHexVerPatt.match(VerString): elif gHexVerPatt.match(VerString):
return VerString return VerString
else: else:
@ -578,7 +578,7 @@ def PreCheck(FileName, FileContent, SupSectionTag):
# #
if Line.find('$') > -1: if Line.find('$') > -1:
if Line.find('$(') < 0 or Line.find(')') < 0: if Line.find('$(') < 0 or Line.find(')') < 0:
EdkLogger.error("Parser", FORMAT_INVALID, Line=LineNo, File=FileName, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", FORMAT_INVALID, Line=LineNo, File=FileName, RaiseError=EdkLogger.IsRaiseError)
# #
# Check [] # Check []
@ -588,7 +588,7 @@ def PreCheck(FileName, FileContent, SupSectionTag):
# Only get one '[' or one ']' # Only get one '[' or one ']'
# #
if not (Line.find('[') > -1 and Line.find(']') > -1): if not (Line.find('[') > -1 and Line.find(']') > -1):
EdkLogger.error("Parser", FORMAT_INVALID, Line=LineNo, File=FileName, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", FORMAT_INVALID, Line=LineNo, File=FileName, RaiseError=EdkLogger.IsRaiseError)
# #
# Regenerate FileContent # Regenerate FileContent
@ -596,7 +596,7 @@ def PreCheck(FileName, FileContent, SupSectionTag):
NewFileContent = NewFileContent + Line + '\r\n' NewFileContent = NewFileContent + Line + '\r\n'
if IsFailed: if IsFailed:
EdkLogger.error("Parser", FORMAT_INVALID, Line=LineNo, File=FileName, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", FORMAT_INVALID, Line=LineNo, File=FileName, RaiseError=EdkLogger.IsRaiseError)
return NewFileContent return NewFileContent
@ -614,7 +614,7 @@ def PreCheck(FileName, FileContent, SupSectionTag):
# #
# @retval True The file type is correct # @retval True The file type is correct
# #
def CheckFileType(CheckFilename, ExtName, ContainerFilename, SectionName, Line, LineNo = -1): def CheckFileType(CheckFilename, ExtName, ContainerFilename, SectionName, Line, LineNo= -1):
if CheckFilename != '' and CheckFilename != None: if CheckFilename != '' and CheckFilename != None:
(Root, Ext) = os.path.splitext(CheckFilename) (Root, Ext) = os.path.splitext(CheckFilename)
if Ext.upper() != ExtName.upper(): if Ext.upper() != ExtName.upper():
@ -623,7 +623,7 @@ def CheckFileType(CheckFilename, ExtName, ContainerFilename, SectionName, Line,
LineNo = GetLineNo(ContainerFile, Line) LineNo = GetLineNo(ContainerFile, Line)
ErrorMsg = "Invalid %s. '%s' is found, but '%s' file is needed" % (SectionName, CheckFilename, ExtName) ErrorMsg = "Invalid %s. '%s' is found, but '%s' file is needed" % (SectionName, CheckFilename, ExtName)
EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, Line=LineNo, EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, Line=LineNo,
File=ContainerFilename, RaiseError = EdkLogger.IsRaiseError) File=ContainerFilename, RaiseError=EdkLogger.IsRaiseError)
return True return True
@ -641,7 +641,7 @@ def CheckFileType(CheckFilename, ExtName, ContainerFilename, SectionName, Line,
# #
# @retval The file full path if the file exists # @retval The file full path if the file exists
# #
def CheckFileExist(WorkspaceDir, CheckFilename, ContainerFilename, SectionName, Line, LineNo = -1): def CheckFileExist(WorkspaceDir, CheckFilename, ContainerFilename, SectionName, Line, LineNo= -1):
CheckFile = '' CheckFile = ''
if CheckFilename != '' and CheckFilename != None: if CheckFilename != '' and CheckFilename != None:
CheckFile = WorkspaceFile(WorkspaceDir, CheckFilename) CheckFile = WorkspaceFile(WorkspaceDir, CheckFilename)
@ -651,7 +651,7 @@ def CheckFileExist(WorkspaceDir, CheckFilename, ContainerFilename, SectionName,
LineNo = GetLineNo(ContainerFile, Line) LineNo = GetLineNo(ContainerFile, Line)
ErrorMsg = "Can't find file '%s' defined in section '%s'" % (CheckFile, SectionName) ErrorMsg = "Can't find file '%s' defined in section '%s'" % (CheckFile, SectionName)
EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg,
File=ContainerFilename, Line = LineNo, RaiseError = EdkLogger.IsRaiseError) File=ContainerFilename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
return CheckFile return CheckFile
@ -665,7 +665,7 @@ def CheckFileExist(WorkspaceDir, CheckFilename, ContainerFilename, SectionName,
# @retval int Index of the line # @retval int Index of the line
# @retval -1 The line is not found # @retval -1 The line is not found
# #
def GetLineNo(FileContent, Line, IsIgnoreComment = True): def GetLineNo(FileContent, Line, IsIgnoreComment=True):
LineList = FileContent.splitlines() LineList = FileContent.splitlines()
for Index in range(len(LineList)): for Index in range(len(LineList)):
if LineList[Index].find(Line) > -1: if LineList[Index].find(Line) > -1:
@ -688,13 +688,13 @@ def GetLineNo(FileContent, Line, IsIgnoreComment = True):
# @param File: File which has the string # @param File: File which has the string
# @param Format: Correct format # @param Format: Correct format
# #
def RaiseParserError(Line, Section, File, Format = '', LineNo = -1): def RaiseParserError(Line, Section, File, Format='', LineNo= -1):
if LineNo == -1: if LineNo == -1:
LineNo = GetLineNo(open(os.path.normpath(File), 'r').read(), Line) LineNo = GetLineNo(open(os.path.normpath(File), 'r').read(), Line)
ErrorMsg = "Invalid statement '%s' is found in section '%s'" % (Line, Section) ErrorMsg = "Invalid statement '%s' is found in section '%s'" % (Line, Section)
if Format != '': if Format != '':
Format = "Correct format is " + Format Format = "Correct format is " + Format
EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=File, Line=LineNo, ExtraData=Format, RaiseError = EdkLogger.IsRaiseError) EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=File, Line=LineNo, ExtraData=Format, RaiseError=EdkLogger.IsRaiseError)
## WorkspaceFile ## WorkspaceFile
# #
@ -757,10 +757,10 @@ def RemoveBlockComment(Lines):
# Remove comment block # Remove comment block
# #
if Line.find(DataType.TAB_COMMENT_EDK_START) > -1: if Line.find(DataType.TAB_COMMENT_EDK_START) > -1:
ReservedLine = GetSplitValueList(Line, DataType.TAB_COMMENT_EDK_START, 1)[0] ReservedLine = GetSplitList(Line, DataType.TAB_COMMENT_EDK_START, 1)[0]
IsFindBlockComment = True IsFindBlockComment = True
if Line.find(DataType.TAB_COMMENT_EDK_END) > -1: if Line.find(DataType.TAB_COMMENT_EDK_END) > -1:
Line = ReservedLine + GetSplitValueList(Line, DataType.TAB_COMMENT_EDK_END, 1)[1] Line = ReservedLine + GetSplitList(Line, DataType.TAB_COMMENT_EDK_END, 1)[1]
ReservedLine = '' ReservedLine = ''
IsFindBlockComment = False IsFindBlockComment = False
if IsFindBlockComment: if IsFindBlockComment:
@ -773,7 +773,7 @@ def RemoveBlockComment(Lines):
# #
# Get String of a List # Get String of a List
# #
def GetStringOfList(List, Split = ' '): def GetStringOfList(List, Split=' '):
if type(List) != type([]): if type(List) != type([]):
return List return List
Str = '' Str = ''
@ -797,7 +797,7 @@ def GetHelpTextList(HelpTextClassList):
def StringToArray(String): def StringToArray(String):
if isinstance(String, unicode): if isinstance(String, unicode):
if len(unicode) ==0: if len(unicode) == 0:
return "{0x00, 0x00}" return "{0x00, 0x00}"
return "{%s, 0x00, 0x00}" % ", ".join(["0x%02x, 0x00" % ord(C) for C in String]) return "{%s, 0x00, 0x00}" % ", ".join(["0x%02x, 0x00" % ord(C) for C in String])
elif String.startswith('L"'): elif String.startswith('L"'):

View File

@ -59,8 +59,8 @@ class Check(object):
for Char in Line: for Char in Line:
IndexOfChar += 1 IndexOfChar += 1
if ord(Char) > 126: if ord(Char) > 126:
OtherMsg = "File %s has Non-ASCII char at line %s column %s" %(Record[1], IndexOfLine, IndexOfChar) OtherMsg = "File %s has Non-ASCII char at line %s column %s" % (Record[1], IndexOfLine, IndexOfChar)
EccGlobalData.gDb.TblReport.Insert(ERROR_GENERAL_CHECK_NON_ACSII, OtherMsg = OtherMsg, BelongsToTable = 'File', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_GENERAL_CHECK_NON_ACSII, OtherMsg=OtherMsg, BelongsToTable='File', BelongsToItem=Record[0])
# C Function Layout Checking # C Function Layout Checking
def FunctionLayoutCheck(self): def FunctionLayoutCheck(self):
@ -251,7 +251,7 @@ class Check(object):
EdkLogger.quiet("Checking same struct ...") EdkLogger.quiet("Checking same struct ...")
AllStructure = {} AllStructure = {}
for IdentifierTable in EccGlobalData.gIdentifierTableList: for IdentifierTable in EccGlobalData.gIdentifierTableList:
SqlCommand = """select ID, Name, BelongsToFile from %s where Model = %s""" %(IdentifierTable, MODEL_IDENTIFIER_STRUCTURE) SqlCommand = """select ID, Name, BelongsToFile from %s where Model = %s""" % (IdentifierTable, MODEL_IDENTIFIER_STRUCTURE)
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
if Record[1] != '': if Record[1] != '':
@ -265,7 +265,7 @@ class Check(object):
if NewRecordSet != []: if NewRecordSet != []:
OtherMsg = "The structure name [%s] is duplicate with the one defined in %s, maybe struct NOT typedefed or the typedef new type NOT used to qualify variables" % (Record[1], NewRecordSet[0][0]) OtherMsg = "The structure name [%s] is duplicate with the one defined in %s, maybe struct NOT typedefed or the typedef new type NOT used to qualify variables" % (Record[1], NewRecordSet[0][0])
if not EccGlobalData.gException.IsException(ERROR_DECLARATION_DATA_TYPE_CHECK_SAME_STRUCTURE, Record[1]): if not EccGlobalData.gException.IsException(ERROR_DECLARATION_DATA_TYPE_CHECK_SAME_STRUCTURE, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_DECLARATION_DATA_TYPE_CHECK_SAME_STRUCTURE, OtherMsg = OtherMsg, BelongsToTable = IdentifierTable, BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_DECLARATION_DATA_TYPE_CHECK_SAME_STRUCTURE, OtherMsg=OtherMsg, BelongsToTable=IdentifierTable, BelongsToItem=Record[0])
# Check whether Union Type has a 'typedef' and the name is capital # Check whether Union Type has a 'typedef' and the name is capital
def DeclCheckUnionType(self): def DeclCheckUnionType(self):
@ -365,7 +365,7 @@ class Check(object):
if Path.startswith('\\') or Path.startswith('/'): if Path.startswith('\\') or Path.startswith('/'):
Path = Path[1:] Path = Path[1:]
if not EccGlobalData.gException.IsException(ERROR_INCLUDE_FILE_CHECK_NAME, Path): if not EccGlobalData.gException.IsException(ERROR_INCLUDE_FILE_CHECK_NAME, Path):
EccGlobalData.gDb.TblReport.Insert(ERROR_INCLUDE_FILE_CHECK_NAME, OtherMsg = "The file name for [%s] is duplicate" % Path, BelongsToTable = 'File', BelongsToItem = Item[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_INCLUDE_FILE_CHECK_NAME, OtherMsg="The file name for [%s] is duplicate" % Path, BelongsToTable='File', BelongsToItem=Item[0])
# Check whether all include file contents is guarded by a #ifndef statement. # Check whether all include file contents is guarded by a #ifndef statement.
def IncludeFileCheckIfndef(self): def IncludeFileCheckIfndef(self):
@ -526,7 +526,7 @@ class Check(object):
LibraryClasses[List[0]].append(Item) LibraryClasses[List[0]].append(Item)
if Record[2] != 'BASE' and Record[2] not in SupModType: if Record[2] != 'BASE' and Record[2] not in SupModType:
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_2, OtherMsg = "The Library Class '%s' does not specify its supported module types" % (List[0]), BelongsToTable = 'Inf', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_2, OtherMsg="The Library Class '%s' does not specify its supported module types" % (List[0]), BelongsToTable='Inf', BelongsToItem=Record[0])
SqlCommand = """select A.ID, A.Value1, B.Value2 from Inf as A left join Inf as B SqlCommand = """select A.ID, A.Value1, B.Value2 from Inf as A left join Inf as B
where A.Model = %s and B.Value1 = '%s' and B.Model = %s where A.Model = %s and B.Value1 = '%s' and B.Model = %s
@ -546,10 +546,10 @@ class Check(object):
if Record[1] in LibraryClasses: if Record[1] in LibraryClasses:
if Record[2] not in LibraryClasses[Record[1]] and 'BASE' not in RecordDict[Record[1]]: if Record[2] not in LibraryClasses[Record[1]] and 'BASE' not in RecordDict[Record[1]]:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, Record[1]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, OtherMsg = "The type of Library Class [%s] defined in Inf file does not match the type of the module" % (Record[1]), BelongsToTable = 'Inf', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, OtherMsg="The type of Library Class [%s] defined in Inf file does not match the type of the module" % (Record[1]), BelongsToTable='Inf', BelongsToItem=Record[0])
else: else:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, Record[1]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, OtherMsg = "The type of Library Class [%s] defined in Inf file does not match the type of the module" % (Record[1]), BelongsToTable = 'Inf', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, OtherMsg="The type of Library Class [%s] defined in Inf file does not match the type of the module" % (Record[1]), BelongsToTable='Inf', BelongsToItem=Record[0])
# Check whether a Library Instance has been defined for all dependent library classes # Check whether a Library Instance has been defined for all dependent library classes
def MetaDataFileCheckLibraryInstanceDependent(self): def MetaDataFileCheckLibraryInstanceDependent(self):
@ -571,7 +571,7 @@ class Check(object):
IsFound = True IsFound = True
if not IsFound: if not IsFound:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_DEPENDENT, LibraryClass[1]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_DEPENDENT, LibraryClass[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_DEPENDENT, OtherMsg = "The Library Class [%s] is not specified in '%s'" % (LibraryClass[1], LibraryClass[2]), BelongsToTable = 'Dsc', BelongsToItem = LibraryClass[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_DEPENDENT, OtherMsg="The Library Class [%s] is not specified in '%s'" % (LibraryClass[1], LibraryClass[2]), BelongsToTable='Dsc', BelongsToItem=LibraryClass[0])
# Check whether the Library Instances specified by the LibraryClasses sections are listed in order of dependencies # Check whether the Library Instances specified by the LibraryClasses sections are listed in order of dependencies
def MetaDataFileCheckLibraryInstanceOrder(self): def MetaDataFileCheckLibraryInstanceOrder(self):
@ -587,7 +587,7 @@ class Check(object):
RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_NO_USE, Record[1]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_NO_USE, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_NO_USE, OtherMsg = "The Library Class [%s] is not used in any platform" % (Record[1]), BelongsToTable = 'Inf', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_NO_USE, OtherMsg="The Library Class [%s] is not used in any platform" % (Record[1]), BelongsToTable='Inf', BelongsToItem=Record[0])
# Check whether an Inf file is specified in the FDF file, but not in the Dsc file, then the Inf file must be for a Binary module only # Check whether an Inf file is specified in the FDF file, but not in the Dsc file, then the Inf file must be for a Binary module only
def MetaDataFileCheckBinaryInfInFdf(self): def MetaDataFileCheckBinaryInfInFdf(self):
@ -608,9 +608,9 @@ class Check(object):
SqlCommand = """select ID from Inf where Model = %s and BelongsToFile = (select ID from File where FullPath like '%s') SqlCommand = """select ID from Inf where Model = %s and BelongsToFile = (select ID from File where FullPath like '%s')
""" % (MODEL_EFI_SOURCE_FILE, FilePath) """ % (MODEL_EFI_SOURCE_FILE, FilePath)
NewRecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) NewRecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
if NewRecordSet!= []: if NewRecordSet != []:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_BINARY_INF_IN_FDF, FilePath): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_BINARY_INF_IN_FDF, FilePath):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_BINARY_INF_IN_FDF, OtherMsg = "File [%s] defined in FDF file and not in DSC file must be a binary module" % (FilePath), BelongsToTable = 'Fdf', BelongsToItem = FdfID) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_BINARY_INF_IN_FDF, OtherMsg="File [%s] defined in FDF file and not in DSC file must be a binary module" % (FilePath), BelongsToTable='Fdf', BelongsToItem=FdfID)
# Check whether a PCD is set in a Dsc file or the FDF file, but not in both. # Check whether a PCD is set in a Dsc file or the FDF file, but not in both.
def MetaDataFileCheckPcdDuplicate(self): def MetaDataFileCheckPcdDuplicate(self):
@ -624,19 +624,19 @@ class Check(object):
and A.Enabled > -1 and A.Enabled > -1
and B.Enabled > -1 and B.Enabled > -1
group by A.ID group by A.ID
"""% (MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER) """ % (MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER)
RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
SqlCommand1 = """select Name from File where ID = %s""" %Record[2] SqlCommand1 = """select Name from File where ID = %s""" % Record[2]
SqlCommand2 = """select Name from File where ID = %s""" %Record[5] SqlCommand2 = """select Name from File where ID = %s""" % Record[5]
DscFileName = os.path.splitext(EccGlobalData.gDb.TblDsc.Exec(SqlCommand1)[0][0])[0] DscFileName = os.path.splitext(EccGlobalData.gDb.TblDsc.Exec(SqlCommand1)[0][0])[0]
FdfFileName = os.path.splitext(EccGlobalData.gDb.TblDsc.Exec(SqlCommand2)[0][0])[0] FdfFileName = os.path.splitext(EccGlobalData.gDb.TblDsc.Exec(SqlCommand2)[0][0])[0]
if DscFileName != FdfFileName: if DscFileName != FdfFileName:
continue continue
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[1]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg = "The PCD [%s] is defined in both FDF file and DSC file" % (Record[1]), BelongsToTable = 'Dsc', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg="The PCD [%s] is defined in both FDF file and DSC file" % (Record[1]), BelongsToTable='Dsc', BelongsToItem=Record[0])
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[3]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[3]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg = "The PCD [%s] is defined in both FDF file and DSC file" % (Record[4]), BelongsToTable = 'Fdf', BelongsToItem = Record[3]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg="The PCD [%s] is defined in both FDF file and DSC file" % (Record[4]), BelongsToTable='Fdf', BelongsToItem=Record[3])
EdkLogger.quiet("Checking for duplicate PCDs defined in DEC files ...") EdkLogger.quiet("Checking for duplicate PCDs defined in DEC files ...")
SqlCommand = """ SqlCommand = """
@ -650,11 +650,11 @@ class Check(object):
and B.Enabled > -1 and B.Enabled > -1
and A.BelongsToFile = B.BelongsToFile and A.BelongsToFile = B.BelongsToFile
group by A.ID group by A.ID
"""% (MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER) """ % (MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER)
RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[1]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg = "The PCD [%s] is defined duplicated in DEC file" % (Record[1]), BelongsToTable = 'Dec', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg="The PCD [%s] is defined duplicated in DEC file" % (Record[1]), BelongsToTable='Dec', BelongsToItem=Record[0])
# Check whether PCD settings in the FDF file can only be related to flash. # Check whether PCD settings in the FDF file can only be related to flash.
def MetaDataFileCheckPcdFlash(self): def MetaDataFileCheckPcdFlash(self):
@ -665,11 +665,11 @@ class Check(object):
where A.Model >= %s and Model < %s where A.Model >= %s and Model < %s
and A.Enabled > -1 and A.Enabled > -1
and A.Value2 not like '%%Flash%%' and A.Value2 not like '%%Flash%%'
"""% (MODEL_PCD, MODEL_META_DATA_HEADER) """ % (MODEL_PCD, MODEL_META_DATA_HEADER)
RecordSet = EccGlobalData.gDb.TblFdf.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblFdf.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_FLASH, Record[1]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_FLASH, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_FLASH, OtherMsg = "The PCD [%s] defined in FDF file is not related to Flash" % (Record[1]), BelongsToTable = 'Fdf', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_FLASH, OtherMsg="The PCD [%s] defined in FDF file is not related to Flash" % (Record[1]), BelongsToTable='Fdf', BelongsToItem=Record[0])
# Check whether PCDs used in Inf files but not specified in Dsc or FDF files # Check whether PCDs used in Inf files but not specified in Dsc or FDF files
def MetaDataFileCheckPcdNoUse(self): def MetaDataFileCheckPcdNoUse(self):
@ -687,11 +687,11 @@ class Check(object):
(select Value2 from Fdf as C (select Value2 from Fdf as C
where C.Model >= %s and C.Model < %s where C.Model >= %s and C.Model < %s
and C.Enabled > -1) and C.Enabled > -1)
"""% (MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER) """ % (MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER)
RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_NO_USE, Record[1]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_NO_USE, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_NO_USE, OtherMsg = "The PCD [%s] defined in INF file is not specified in either DSC or FDF files" % (Record[1]), BelongsToTable = 'Inf', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_NO_USE, OtherMsg="The PCD [%s] defined in INF file is not specified in either DSC or FDF files" % (Record[1]), BelongsToTable='Inf', BelongsToItem=Record[0])
# Check whether having duplicate guids defined for Guid/Protocol/Ppi # Check whether having duplicate guids defined for Guid/Protocol/Ppi
def MetaDataFileCheckGuidDuplicate(self): def MetaDataFileCheckGuidDuplicate(self):
@ -735,7 +735,7 @@ class Check(object):
Path = Path.upper().replace('\X64', '').replace('\IA32', '').replace('\EBC', '').replace('\IPF', '').replace('\ARM', '') Path = Path.upper().replace('\X64', '').replace('\IA32', '').replace('\EBC', '').replace('\IPF', '').replace('\ARM', '')
if Path in InfPathList: if Path in InfPathList:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, Record[2]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, Record[2]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, OtherMsg = "The source file [%s] is existing in module directory but it is not described in INF file." % (Record[2]), BelongsToTable = 'File', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, OtherMsg="The source file [%s] is existing in module directory but it is not described in INF file." % (Record[2]), BelongsToTable='File', BelongsToItem=Record[0])
# Check whether the PCD is correctly used in C function via its type # Check whether the PCD is correctly used in C function via its type
def MetaDataFileCheckPcdType(self): def MetaDataFileCheckPcdType(self):
@ -755,7 +755,7 @@ class Check(object):
select ID from File where FullPath in select ID from File where FullPath in
(select B.Path || '\\' || A.Value1 from INF as A, File as B where A.Model = %s and A.BelongsToFile = %s (select B.Path || '\\' || A.Value1 from INF as A, File as B where A.Model = %s and A.BelongsToFile = %s
and B.ID = %s and (B.Model = %s or B.Model = %s)) and B.ID = %s and (B.Model = %s or B.Model = %s))
""" %(MODEL_EFI_SOURCE_FILE, BelongsToFile, BelongsToFile, MODEL_FILE_C, MODEL_FILE_H) """ % (MODEL_EFI_SOURCE_FILE, BelongsToFile, BelongsToFile, MODEL_FILE_C, MODEL_FILE_H)
TableSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) TableSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Tbl in TableSet: for Tbl in TableSet:
TblName = 'Identifier' + str(Tbl[0]) TblName = 'Identifier' + str(Tbl[0])
@ -768,11 +768,11 @@ class Check(object):
FunName = Record[0] FunName = Record[0]
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_TYPE, FunName): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_TYPE, FunName):
if Model in [MODEL_PCD_FIXED_AT_BUILD] and not FunName.startswith('FixedPcdGet'): if Model in [MODEL_PCD_FIXED_AT_BUILD] and not FunName.startswith('FixedPcdGet'):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_TYPE, OtherMsg = "The pcd '%s' is defined as a FixPcd but now it is called by c function [%s]" % (PcdName, FunName), BelongsToTable = TblName, BelongsToItem = Record[1]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_TYPE, OtherMsg="The pcd '%s' is defined as a FixPcd but now it is called by c function [%s]" % (PcdName, FunName), BelongsToTable=TblName, BelongsToItem=Record[1])
if Model in [MODEL_PCD_FEATURE_FLAG] and (not FunName.startswith('FeaturePcdGet') and not FunName.startswith('FeaturePcdSet')): if Model in [MODEL_PCD_FEATURE_FLAG] and (not FunName.startswith('FeaturePcdGet') and not FunName.startswith('FeaturePcdSet')):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_TYPE, OtherMsg = "The pcd '%s' is defined as a FeaturePcd but now it is called by c function [%s]" % (PcdName, FunName), BelongsToTable = TblName, BelongsToItem = Record[1]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_TYPE, OtherMsg="The pcd '%s' is defined as a FeaturePcd but now it is called by c function [%s]" % (PcdName, FunName), BelongsToTable=TblName, BelongsToItem=Record[1])
if Model in [MODEL_PCD_PATCHABLE_IN_MODULE] and (not FunName.startswith('PatchablePcdGet') and not FunName.startswith('PatchablePcdSet')): if Model in [MODEL_PCD_PATCHABLE_IN_MODULE] and (not FunName.startswith('PatchablePcdGet') and not FunName.startswith('PatchablePcdSet')):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_TYPE, OtherMsg = "The pcd '%s' is defined as a PatchablePcd but now it is called by c function [%s]" % (PcdName, FunName), BelongsToTable = TblName, BelongsToItem = Record[1]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_TYPE, OtherMsg="The pcd '%s' is defined as a PatchablePcd but now it is called by c function [%s]" % (PcdName, FunName), BelongsToTable=TblName, BelongsToItem=Record[1])
#ERROR_META_DATA_FILE_CHECK_PCD_TYPE #ERROR_META_DATA_FILE_CHECK_PCD_TYPE
pass pass
@ -806,7 +806,7 @@ class Check(object):
if InfPath1 and InfPath2: if InfPath1 and InfPath2:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION, InfPath1): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION, InfPath1):
Msg = "The FILE_GUID of INF file [%s] is duplicated with that of %s" % (InfPath1, InfPath2) Msg = "The FILE_GUID of INF file [%s] is duplicated with that of %s" % (InfPath1, InfPath2)
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION, OtherMsg = Msg, BelongsToTable = Table.Table, BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
# Check whether these is duplicate Guid/Ppi/Protocol name # Check whether these is duplicate Guid/Ppi/Protocol name
@ -822,6 +822,7 @@ class Check(object):
select A.ID, A.Value1 from %s as A, %s as B select A.ID, A.Value1 from %s as A, %s as B
where A.Model = %s and B.Model = %s where A.Model = %s and B.Model = %s
and A.Value1 = B.Value1 and A.ID <> B.ID and A.Value1 = B.Value1 and A.ID <> B.ID
and A.Arch = B.Arch
and A.Enabled > -1 and A.Enabled > -1
and B.Enabled > -1 and B.Enabled > -1
group by A.ID group by A.ID
@ -829,7 +830,7 @@ class Check(object):
RecordSet = Table.Exec(SqlCommand) RecordSet = Table.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
if not EccGlobalData.gException.IsException(ErrorID, Record[1]): if not EccGlobalData.gException.IsException(ErrorID, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ErrorID, OtherMsg = "The %s name [%s] is defined more than one time" % (Name.upper(), Record[1]), BelongsToTable = Table.Table, BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ErrorID, OtherMsg="The %s name [%s] is defined more than one time" % (Name.upper(), Record[1]), BelongsToTable=Table.Table, BelongsToItem=Record[0])
# Check whether these is duplicate Guid/Ppi/Protocol value # Check whether these is duplicate Guid/Ppi/Protocol value
def CheckGuidProtocolPpiValue(self, ErrorID, Model): def CheckGuidProtocolPpiValue(self, ErrorID, Model):
@ -845,12 +846,13 @@ class Check(object):
select A.ID, A.Value2 from %s as A, %s as B select A.ID, A.Value2 from %s as A, %s as B
where A.Model = %s and B.Model = %s where A.Model = %s and B.Model = %s
and A.Value2 = B.Value2 and A.ID <> B.ID and A.Value2 = B.Value2 and A.ID <> B.ID
and A.Arch = B.Arch
group by A.ID group by A.ID
""" % (Table.Table, Table.Table, Model, Model) """ % (Table.Table, Table.Table, Model, Model)
RecordSet = Table.Exec(SqlCommand) RecordSet = Table.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
if not EccGlobalData.gException.IsException(ErrorID, Record[1]): if not EccGlobalData.gException.IsException(ErrorID, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ErrorID, OtherMsg = "The %s value [%s] is used more than one time" % (Name.upper(), Record[1]), BelongsToTable = Table.Table, BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ErrorID, OtherMsg="The %s value [%s] is used more than one time" % (Name.upper(), Record[1]), BelongsToTable=Table.Table, BelongsToItem=Record[0])
# Naming Convention Check # Naming Convention Check
def NamingConventionCheck(self): def NamingConventionCheck(self):
@ -883,7 +885,7 @@ class Check(object):
if EccGlobalData.gConfig.NamingConventionCheckDefineStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1': if EccGlobalData.gConfig.NamingConventionCheckDefineStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking naming covention of #define statement ...") EdkLogger.quiet("Checking naming covention of #define statement ...")
SqlCommand = """select ID, Value from %s where Model = %s""" %(FileTable, MODEL_IDENTIFIER_MACRO_DEFINE) SqlCommand = """select ID, Value from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_MACRO_DEFINE)
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
Name = Record[1].strip().split()[1] Name = Record[1].strip().split()[1]
@ -891,14 +893,14 @@ class Check(object):
Name = Name[0:Name.find('(')] Name = Name[0:Name.find('(')]
if Name.upper() != Name: if Name.upper() != Name:
if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_DEFINE_STATEMENT, Name): if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_DEFINE_STATEMENT, Name):
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_DEFINE_STATEMENT, OtherMsg = "The #define name [%s] does not follow the rules" % (Name), BelongsToTable = FileTable, BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_DEFINE_STATEMENT, OtherMsg="The #define name [%s] does not follow the rules" % (Name), BelongsToTable=FileTable, BelongsToItem=Record[0])
# Check whether only capital letters are used for typedef declarations # Check whether only capital letters are used for typedef declarations
def NamingConventionCheckTypedefStatement(self, FileTable): def NamingConventionCheckTypedefStatement(self, FileTable):
if EccGlobalData.gConfig.NamingConventionCheckTypedefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1': if EccGlobalData.gConfig.NamingConventionCheckTypedefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking naming covention of #typedef statement ...") EdkLogger.quiet("Checking naming covention of #typedef statement ...")
SqlCommand = """select ID, Name from %s where Model = %s""" %(FileTable, MODEL_IDENTIFIER_TYPEDEF) SqlCommand = """select ID, Name from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_TYPEDEF)
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
Name = Record[1].strip() Name = Record[1].strip()
@ -911,20 +913,20 @@ class Check(object):
Name = Name.replace('*', '').strip() Name = Name.replace('*', '').strip()
if Name.upper() != Name: if Name.upper() != Name:
if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT, Name): if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT, Name):
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT, OtherMsg = "The #typedef name [%s] does not follow the rules" % (Name), BelongsToTable = FileTable, BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT, OtherMsg="The #typedef name [%s] does not follow the rules" % (Name), BelongsToTable=FileTable, BelongsToItem=Record[0])
# Check whether the #ifndef at the start of an include file uses both prefix and postfix underscore characters, '_'. # Check whether the #ifndef at the start of an include file uses both prefix and postfix underscore characters, '_'.
def NamingConventionCheckIfndefStatement(self, FileTable): def NamingConventionCheckIfndefStatement(self, FileTable):
if EccGlobalData.gConfig.NamingConventionCheckTypedefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1': if EccGlobalData.gConfig.NamingConventionCheckTypedefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking naming covention of #ifndef statement ...") EdkLogger.quiet("Checking naming covention of #ifndef statement ...")
SqlCommand = """select ID, Value from %s where Model = %s""" %(FileTable, MODEL_IDENTIFIER_MACRO_IFNDEF) SqlCommand = """select ID, Value from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_MACRO_IFNDEF)
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
Name = Record[1].replace('#ifndef', '').strip() Name = Record[1].replace('#ifndef', '').strip()
if Name[0] != '_' or Name[-1] != '_': if Name[0] != '_' or Name[-1] != '_':
if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT, Name): if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT, Name):
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT, OtherMsg = "The #ifndef name [%s] does not follow the rules" % (Name), BelongsToTable = FileTable, BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT, OtherMsg="The #ifndef name [%s] does not follow the rules" % (Name), BelongsToTable=FileTable, BelongsToItem=Record[0])
# Rule for path name, variable name and function name # Rule for path name, variable name and function name
# 1. First character should be upper case # 1. First character should be upper case
@ -940,7 +942,7 @@ class Check(object):
for Record in RecordSet: for Record in RecordSet:
if not Pattern.match(Record[1]): if not Pattern.match(Record[1]):
if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_PATH_NAME, Record[1]): if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_PATH_NAME, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_PATH_NAME, OtherMsg = "The file path [%s] does not follow the rules" % (Record[1]), BelongsToTable = 'File', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_PATH_NAME, OtherMsg="The file path [%s] does not follow the rules" % (Record[1]), BelongsToTable='File', BelongsToItem=Record[0])
# Rule for path name, variable name and function name # Rule for path name, variable name and function name
# 1. First character should be upper case # 1. First character should be upper case
@ -953,12 +955,12 @@ class Check(object):
EdkLogger.quiet("Checking naming covention of variable name ...") EdkLogger.quiet("Checking naming covention of variable name ...")
Pattern = re.compile(r'^[A-Zgm]+\S*[a-z]\S*$') Pattern = re.compile(r'^[A-Zgm]+\S*[a-z]\S*$')
SqlCommand = """select ID, Name from %s where Model = %s""" %(FileTable, MODEL_IDENTIFIER_VARIABLE) SqlCommand = """select ID, Name from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_VARIABLE)
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
if not Pattern.match(Record[1]): if not Pattern.match(Record[1]):
if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, Record[1]): if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, OtherMsg = "The variable name [%s] does not follow the rules" % (Record[1]), BelongsToTable = FileTable, BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, OtherMsg="The variable name [%s] does not follow the rules" % (Record[1]), BelongsToTable=FileTable, BelongsToItem=Record[0])
# Rule for path name, variable name and function name # Rule for path name, variable name and function name
# 1. First character should be upper case # 1. First character should be upper case
@ -974,20 +976,20 @@ class Check(object):
for Record in RecordSet: for Record in RecordSet:
if not Pattern.match(Record[1]): if not Pattern.match(Record[1]):
if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_FUNCTION_NAME, Record[1]): if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_FUNCTION_NAME, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_FUNCTION_NAME, OtherMsg = "The function name [%s] does not follow the rules" % (Record[1]), BelongsToTable = 'Function', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_FUNCTION_NAME, OtherMsg="The function name [%s] does not follow the rules" % (Record[1]), BelongsToTable='Function', BelongsToItem=Record[0])
# Check whether NO use short variable name with single character # Check whether NO use short variable name with single character
def NamingConventionCheckSingleCharacterVariable(self, FileTable): def NamingConventionCheckSingleCharacterVariable(self, FileTable):
if EccGlobalData.gConfig.NamingConventionCheckSingleCharacterVariable == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1': if EccGlobalData.gConfig.NamingConventionCheckSingleCharacterVariable == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking naming covention of single character variable name ...") EdkLogger.quiet("Checking naming covention of single character variable name ...")
SqlCommand = """select ID, Name from %s where Model = %s""" %(FileTable, MODEL_IDENTIFIER_VARIABLE) SqlCommand = """select ID, Name from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_VARIABLE)
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
Variable = Record[1].replace('*', '') Variable = Record[1].replace('*', '')
if len(Variable) == 1: if len(Variable) == 1:
if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_SINGLE_CHARACTER_VARIABLE, Record[1]): if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_SINGLE_CHARACTER_VARIABLE, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_SINGLE_CHARACTER_VARIABLE, OtherMsg = "The variable name [%s] does not follow the rules" % (Record[1]), BelongsToTable = FileTable, BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_SINGLE_CHARACTER_VARIABLE, OtherMsg="The variable name [%s] does not follow the rules" % (Record[1]), BelongsToTable=FileTable, BelongsToItem=Record[0])
## ##
# #

View File

@ -50,10 +50,10 @@ def PreProcess(Filename, MergeMultipleLines = True, LineNo = -1):
Line = Line.strip() Line = Line.strip()
# Remove comment block # Remove comment block
if Line.find(TAB_COMMENT_EDK_START) > -1: if Line.find(TAB_COMMENT_EDK_START) > -1:
ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0] ReservedLine = GetSplitList(Line, TAB_COMMENT_EDK_START, 1)[0]
IsFindBlockComment = True IsFindBlockComment = True
if Line.find(TAB_COMMENT_EDK_END) > -1: if Line.find(TAB_COMMENT_EDK_END) > -1:
Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1] Line = ReservedLine + GetSplitList(Line, TAB_COMMENT_EDK_END, 1)[1]
ReservedLine = '' ReservedLine = ''
IsFindBlockComment = False IsFindBlockComment = False
if IsFindBlockComment: if IsFindBlockComment:

View File

@ -1118,6 +1118,34 @@ class FdfParser:
def SetFileBufferPos(self, Pos): def SetFileBufferPos(self, Pos):
(self.CurrentLineNumber, self.CurrentOffsetWithinLine) = Pos (self.CurrentLineNumber, self.CurrentOffsetWithinLine) = Pos
## Preprocess() method
#
# Preprocess comment, conditional directive, include directive, replace macro.
# Exception will be raised if syntax error found
#
# @param self The object pointer
#
def Preprocess(self):
self.__StringToList()
self.PreprocessFile()
self.PreprocessIncludeFile()
self.__StringToList()
self.PreprocessFile()
self.PreprocessConditionalStatement()
self.__StringToList()
for Pos in self.__WipeOffArea:
self.__ReplaceFragment(Pos[0], Pos[1])
self.Profile.FileLinesList = ["".join(list) for list in self.Profile.FileLinesList]
while self.__GetDefines():
pass
Index = 0
while Index < len(self.Profile.FileLinesList):
FileLineTuple = GetRealFileLine(self.FileName, Index + 1)
self.Profile.FileLinesList[Index] = self.__ReplaceMacros(self.Profile.FileLinesList[Index], FileLineTuple[0], FileLineTuple[1])
Index += 1
## ParseFile() method ## ParseFile() method
# #
# Parse the file profile buffer to extract fd, fv ... information # Parse the file profile buffer to extract fd, fv ... information
@ -1128,26 +1156,7 @@ class FdfParser:
def ParseFile(self): def ParseFile(self):
try: try:
self.__StringToList() self.Preprocess()
self.PreprocessFile()
self.PreprocessIncludeFile()
self.__StringToList()
self.PreprocessFile()
self.PreprocessConditionalStatement()
self.__StringToList()
for Pos in self.__WipeOffArea:
self.__ReplaceFragment(Pos[0], Pos[1])
self.Profile.FileLinesList = ["".join(list) for list in self.Profile.FileLinesList]
while self.__GetDefines():
pass
Index = 0
while Index < len(self.Profile.FileLinesList):
FileLineTuple = GetRealFileLine(self.FileName, Index + 1)
self.Profile.FileLinesList[Index] = self.__ReplaceMacros(self.Profile.FileLinesList[Index], FileLineTuple[0], FileLineTuple[1])
Index += 1
while self.__GetFd(): while self.__GetFd():
pass pass

View File

@ -660,10 +660,10 @@ def RemoveBlockComment(Lines):
# Remove comment block # Remove comment block
# #
if Line.find(DataType.TAB_COMMENT_EDK1_START) > -1: if Line.find(DataType.TAB_COMMENT_EDK1_START) > -1:
ReservedLine = GetSplitValueList(Line, DataType.TAB_COMMENT_EDK1_START, 1)[0] ReservedLine = GetSplitList(Line, DataType.TAB_COMMENT_EDK1_START, 1)[0]
IsFindBlockComment = True IsFindBlockComment = True
if Line.find(DataType.TAB_COMMENT_EDK1_END) > -1: if Line.find(DataType.TAB_COMMENT_EDK1_END) > -1:
Line = ReservedLine + GetSplitValueList(Line, DataType.TAB_COMMENT_EDK1_END, 1)[1] Line = ReservedLine + GetSplitList(Line, DataType.TAB_COMMENT_EDK1_END, 1)[1]
ReservedLine = '' ReservedLine = ''
IsFindBlockComment = False IsFindBlockComment = False
if IsFindBlockComment: if IsFindBlockComment:

View File

@ -450,6 +450,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
if len(ValueList) == 2: if len(ValueList) == 2:
Type = ValueList[1] Type = ValueList[1]
TypeList = GetSplitValueList(Type, ' ') TypeList = GetSplitValueList(Type, ' ')
TypeList = [Type for Type in TypeList if Type != '']
for Item in TypeList: for Item in TypeList:
if Item not in DT.MODULE_LIST: if Item not in DT.MODULE_LIST:
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(Item), ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(Item),