summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/C/VfrCompile
Commit message (Collapse)AuthorAgeFilesLines
* BaseTools: Update antlr makefile to use cc by defaultRebecca Cran2023-04-061-5/+0
| | | | | | | | | | | Update the antlr makefile to remove the explicit setting of CC to either clang or gcc. This causes it to use /usr/bin/cc or whatever the user has set $(CC) to. This removes the last dependency on gcc for BaseTools. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools: Allow users to build with clang using CC=clang CXX=clang++Rebecca Cran2023-04-053-8/+10
| | | | | | | | | | | | | | | | | | | | In https://bugzilla.tianocore.org/show_bug.cgi?id=2842 clang support was added by having users specify "make CXX=llvm" when building BaseTools. The Makefile then sees that and sets CC=$(CLANG_BIN)clang and CXX=$(CLANG_BIN)clang++. That requires that the executables 'clang' and 'clang++' exist and for example aren't named 'clang-17' and 'clang++-17'. Also, it's an unusual way of specifying the compiler, since many users will expect to be able to override CC and CXX on the make command line. Rework the BaseTools Makefiles removing the 'BUILD_' prefix (BUILD_CC and BUILD_CXX) and using the standard name 'LDFLAGS' instead of 'LFLAGS'. This allows clang to be used by running 'make -C BaseTools CC=clang CXX=clang++'. Signed-off-by: Rebecca Cran <rebecca@quicinc.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools: Allow users to specify compiler to use with make CC= CXX=Rebecca Cran2023-04-053-26/+26
| | | | | | | | | | | | | | | | | | | | In https://bugzilla.tianocore.org/show_bug.cgi?id=2842 clang support was added by having users specify "make CXX=llvm" when building BaseTools. The Makefile then sees that and sets CC=$(CLANG_BIN)clang and CXX=$(CLANG_BIN)clang++. That requires that the executables 'clang' and 'clang++' exist and for example aren't named 'clang-17' and 'clang++-17'. Also, it's an unusual way of specifying the compiler, since many users will expect to be able to override CC and CXX on the make command line. Rework the BaseTools Makefiles removing the 'BUILD_' prefix (BUILD_CC and BUILD_CXX) and using the standard name 'LDFLAGS' instead of 'LFLAGS'. This allows clang to be used by running 'make -C BaseTools CC=clang CXX=clang++'. Signed-off-by: Rebecca Cran <rebecca@quicinc.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools/VfrCompile: Fix potential buffer overwritesMichael Kubacki2023-04-032-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While more portable methods exist to handle these cases, this change does not attempt to do more than fix the immediate problem and follow the conventions already established in this code. `snprintf()` is introduced as the minimum improvement apart from making the buffers larger. Fixes the following CodeQL alerts: 1. Failure on line 2339 in BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c - Type: Potentially overrunning write - Severity: Critical - Problem: This 'call to sprintf' operation requires 17 bytes but the destination is only 16 bytes. 2. Failure on line 2341 in BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c - Type: Potentially overrunning write - Severity: Critical - Problem: This 'call to sprintf' operation requires 17 bytes but the destination is only 16 bytes. 3. Failure on line 1309 in BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c - Type: Potentially overrunning write - Severity: Critical - Problem: This 'call to sprintf' operation requires 25 bytes but the destination is only 20 bytes. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Oliver Smith-Denny <osd@smith-denny.com>
* BaseTools/Source/C: Use /Z7 instead of /Zi for host toolsMichael D Kinney2022-11-084-11/+10
| | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4139 Update ms.common and *.mak files to use /Z7 instead of /Zi to embed symbol information in obj files for host tools built with VS compilers. This prevents vcxxx.pdb files from being generated in the root of the local edk2 repository or in BaseTools directories. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools: Remove duplicated words in C toolsPierre Gondois2022-10-161-2/+2
| | | | | | | | | | In an effort to clean the documentation of the above package, remove duplicated words. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
* BaseTools/VfrCompile: Correct Bit Field Flags for numeric/one ofHuang, Long12021-12-092-1/+4
| | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3752 Add Bit mask to numeric/one of opcode to set correctly Flags for Bit Field. VfrSyntax.g: Set "LFlags &= EDKII_IFR_DISPLAY_BIT" before "LFlags |= (EDKII_IFR_NUMERIC_SIZE_BIT & (_GET_CURRQEST_VARSIZE()));" VfrFormPkg.h: update "if (LFlags & EFI_IFR_DISPLAY)" with "if (LFlags & EDKII_IFR_DISPLAY_BIT)" in SetFlagsForBitField() Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Long1 Huang <long1.huang@intel.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
* BaseTools/VrfCompile: Fix uninitialized field from unnamed fieldMichael D Kinney2021-11-031-2/+2
| | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3687 If a C structure parsed by the VFR compiler contains an unnamed field, then mFieldName is left uninitialized, which generates random data in the VFR compiler output file. If the FieldName is NULL, then initialize pNewField->mFieldName to a Null-terminated empty string. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/VfrCompile: VFR compiler supports REST_STYLE in HII optionAbner Chang2020-11-111-3/+22
| | | | | | | | | | | | | | | | | | Add REST_STYLE support on VFR language BZ: 2916 https://bugzilla.tianocore.org/show_bug.cgi?id=2916 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Signed-off-by: Ye Ting <ting.ye@intel.com> Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Signed-off-by: Wang Fan <fan.wang@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Nickle Wang <nickle.wang@hpe.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* Using LLVM compiler set to build BaseTools in LinuxLiu, Zhiguang2020-07-213-2/+12
| | | | | | | | | | | | | | | Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2842 To use LLVM to build BaseTools, first set the CLANG_BIN environment value, and add "CXX=llvm" to choose LLVM compiler set when using make command. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Yuwei Chen<yuwei.chen@intel.com>
* BaseTools: strip trailing whitespaceLeif Lindholm2019-10-041-3/+3
| | | | | | | Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* BaseTools: Fix various typosAntoine Cœur2019-07-082-2/+2
| | | | | | | Fix various typos in BaseTools. Signed-off-by: Cœur <coeur@gmx.fr> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/VfrCompile: clean Framework Vfr supportDandan Bi2019-05-131-217/+55
| | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1464 This commit is to do the cleanup which are missing in previous commit 1b72fd5121b5b31918be0a9a0868a39070d4c8d4 BaseTools/VfrCompile: Remove framework VFR support Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/VfrCompile: Remove framework VFR supportDandan Bi2019-05-097-211/+15
| | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1464 Currently there is no usage of framework VFR, remove the support from VfrCompile. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: Replace BSD License with BSD+Patent LicenseMichael D Kinney2019-04-0912-84/+12
| | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=1373 Replace BSD 2-Clause License with BSD+Patent License. This change is based on the following emails: https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html RFCs with detailed process for the license change: V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Various typoAntoine Coeur2019-02-1428-102/+97
| | | | | | | | Various typo in BaseTools. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Coeur <coeur@gmx.fr> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/VfrCompile: report error for Integer overflowDandan Bi2019-01-083-7/+7
| | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1415 When an integer constant specified in the .vfr file is too large for the varstore field it is being used with, the VFR compiler reports an overflow warning like this: Test.vfr(693): WARNING: Overflow: Value 1024 is too large to store in a UINT8 : String to UINT* Overflow Since Warning does not break the build process, and it is easy to miss it. This patch is to update the code to report error and break the build if meet this kind of issue. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/VfrCompile: honor EXTRA_LDFLAGSLaszlo Ersek2018-08-221-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 81502cee20ac ("BaseTools/Source/C: take EXTRA_LDFLAGS from the caller", 2018-08-16), I missed that "VfrCompile/GNUmakefile" does not use BUILD_LFLAGS in the APPLICATION linking rule, unlike "app.makefile" does. Instead, "VfrCompile/GNUmakefile" uses the (undefined) LFLAGS macro. Therefore commit 81502cee20ac did not cover the linking step of VfrCompile. Thankfully, the structure of the linking rules is the same, between "app.makefile" and "VfrCompile/GNUmakefile". Rename the undefined LFLAGS macro in "VfrCompile/GNUmakefile" to VFR_LFLAGS (for consistency with VFR_CXXFLAGS), and set it to EXTRA_LDFLAGS. As a result, we have: | compilation | linking -----------+--------------------------------+---------------------- VfrCompile | VFR_CXXFLAGS = | VFR_LFLAGS = | BUILD_OPTFLAGS = | EXTRA_LDFLAGS | '-O2' + EXTRA_OPTFLAGS | -----------+--------------------------------+---------------------- other apps | BUILD_CFLAGS/BUILD_CXXFLAGS = | BUILD_LFLAGS = | [...] + BUILD_OPTFLAGS = | [...] + EXTRA_LDFLAGS | [...] + '-O2' + EXTRA_OPTFLAGS | This table shows - that the VfrCompile compilation and linking flags are always a subset of the corresponding flags used by the other apps, - and that the EXTRA flags are always at the end. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1540244 Fixes: 81502cee20ac4046f08bb4aec754c7091c8808dc Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/Source/C: split "-O2" to BUILD_OPTFLAGSLaszlo Ersek2018-08-161-4/+7
| | | | | | | | | | | | | | | | | | | | The option "-O2" is not a preprocessor flag, but a code generation (compilation) flag. Move it from BUILD_CPPFLAGS to BUILD_CFLAGS and BUILD_CXXFLAGS. Because "VfrCompile/GNUmakefile" uses "-O2" through BUILD_CPPFLAGS, and because it doesn't use BUILD_CXXFLAGS, we have to introduce BUILD_OPTFLAGS separately, so that "VfrCompile/GNUmakefile" can continue using just this flag. This patch doesn't change behavior. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1540244 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: Clean up source filesLiming Gao2018-07-099-226/+226
| | | | | | | | | | | 1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
* BaseTools/VfrCompile: Avoid using uninitialized pointerBi, Dandan2018-05-091-3/+20
| | | | | | | | | | | | | | | | | | | | | | V2: Add function _INIT_OPHDR_COND () for variable initialization. Make code logic more clean. Previously _CLEAR_SAVED_OPHDR () is used for variable initialization, and we updated it to clean memory. But _CLEAR_SAVED_OPHDR () is still called for variable initialization. This will cause uninitialized pointer will be checked to free and cause unexpected issue. This patch is to add new function for variable initialization and keep _CLEAR_SAVED_OPHDR () to clean memory which is aligned with its function name. Cc: Liming Gao <liming.gao@intel.com> Cc: Gary Lin <glin@suse.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
* BaseTool/VfrCompile: make delete[] match with new[]Dandan Bi2018-04-171-4/+8
| | | | | | | | Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
* BaseTools/VfrCompile:Fix memory leak issuesDandan Bi2018-04-171-1/+31
| | | | | | | | Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
* BaseTool/VfrCompile: Fix potential memory leak issueBi, Dandan2018-03-231-0/+4
| | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=771 Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTool/VfrCompile: make delete[] match with new[]Bi, Dandan2018-03-235-22/+22
| | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=764 Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools GNUmakefile: Remove HOST_ARCH in every tool MakefileLiming Gao2018-02-061-2/+1
| | | | | | | HOST_ARCH has been moved into the common header.makefile Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com>
* BaseTools: resolve initialization order errors in VfrFormPkg.hzenith4322018-01-023-414/+257
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | clang generates many warnings warning: field 'XXX' is uninitialized when used here [-Wuninitialized] for VfrFormPkg.h. VfrFormPkg.h defines many classes derived from CIfrObj (along with other base classes.) Each of these derived classes defines a non-static member field that serves as a duplicate pointer to an original pointer defined in the CIfrObj base class, but cast to a different pointer type. The derived class constructor passes the duplicate pointer to base class constructors: 1) Once passes the address of the duplicate pointer to the CIfrObj constructor to have it initialized. 2) Then passes the duplicate pointer to one or more subsequent base class constructors to be used. Both 1) and 2) constitute undefined behavior in C++. C++ prescribes that base classes are initialized before non-static members when initializing a derived class. So when base class constructors are executing, it is not permitted to assume any non-static members of the derived class exist (even to the stage of having their storage allocated.) clang does not issue warnings for 1), but issues warnings -Wuninitialized for 2). This coding methodology is resolved as follows: a) The CIfrObj object accessor method for retrieving the original pointer is revised to a template member function that returns the original pointer cast to a desired target type. b) The call to CIfrObj constructor is no longer used to initialize the duplicate pointer in the derived class. c) Any subsequent calls to a base class constructor that need to use the pointer, retrieve it from the CIfrObj base class using the template accessor method. d) If the derived class makes no further use of the pointer, then the duplicate pointer defined in it is eliminated. e) If the derived class needs the duplicate pointer for other use, the duplicate pointer remains in the derived class and is initialized in proper order from the original pointer in CIfrObj. f) Existing source code that previously used the CIfrObj pointer accessor method is revised to use the template method. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zenith432 <zenith432@users.sourceforge.net> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: silence parentheses-equality warningzenith4322018-01-024-1/+7
| | | | | | | | | | | | Some code generated by antlr causes clang to emit warning warning: equality comparison with extraneous parentheses [-Wparentheses-equality] The warning is suppressed specifically for clang without affecting other compilers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zenith432 <zenith432@users.sourceforge.net> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: eliminate unused expression resultzenith4322018-01-022-3/+3
| | | | | | | | | Remove some code generated by antlr that causes clang to emit warning warning: expression result unused [-Wunused-value] Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zenith432 <zenith432@users.sourceforge.net> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: correct mal-typed CVfrDLGLexer::errstdzenith4322018-01-021-1/+1
| | | | | | | | | | The member function CVfrDLGLexer::errstd is intended as an override virtual function of DLGLexerBase::errstd, but due to mismatched prototype, it didn't override, and never got called. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zenith432 <zenith432@users.sourceforge.net> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/VfrCompile: Resolve uninit class variables in constructorHao Wu2017-12-253-0/+10
| | | | | | | | | | The commit initializes those possibly uninitialized class variables in class constructors. Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/VfrCompile: Add/refine boundary checks for strcpy/strcatHao Wu2017-12-251-4/+10
| | | | | | | | | | | Add checks to ensure when the destination string buffer is of fixed size, the strcpy/strcat functions calls will not access beyond the boundary. Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/VfrCompile: Assign 'NULL' for closed file handleHao Wu2017-12-251-1/+2
| | | | | | | | | | Assign 'NULL' value to the already-closed file handle to avoid closing the handle multiple times. Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: Replace ARCH with HOST_ARCH in C Makefile to avoid conflictLiming Gao2017-11-301-1/+1
| | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=793 ARCH is too generic. It may cause confuse of target arch or host arch. To be clarified, replace it with HOST_ARCH in BaseTools C Makefile. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
* BaseTools/VfrCompile: Add check to avoid using NULL pointerDandan Bi2017-11-031-2/+6
| | | | | | | | | | | | | | | | | | | | Question value are stored in one specified storage, but the Data type of the storage is not specified or there is no sub fields in the Data type sometimes, so we need to add check before using related pointers. Here list some NULL cases: (1)For an efivastore which doesn't specify a data structure or a data type(UINT8,UINT16...)as the storage, just has VarName and VarSize instead, we can not get its data type before parsing its VarSize. (2)For efivastore which just specifies the data type(UINT8,UINT16...) not a structure as the storage,this data type doesn't have sub-fields. Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTool/VfrCompiler: Support Bit fields in EFI/Buffer VarStoreDandan Bi2017-09-217-489/+1177
| | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=545 Enhance VfrCompiler to parse following case: 1. EFI/Buffer VarStore can contain bit fields in their structure. 2. For question Oneof/Checkbox/numeric, their storage can be bit fields of an EFI VarStore/Buffer VarStore. Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTool/VfrCompile: Support Union type in VFRDandan Bi2017-09-213-37/+65
| | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=603 Update VfrCompiler to parse the UNION type in vfr file Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/VfrCompile: Remove the MAX_PATH limitationDandan Bi2017-08-042-26/+1
| | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=579 Since we have already used LongFilePath() to convert file path, so we can remove the MAX_PATH limitation. Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Daniel Díaz <daniel.diaz@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
* BaseTools/VfrCompile: Fix segmentation fault issuesDandan Bi2017-08-041-7/+7
| | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=532 (1) Add NULL check before using a pointer. (2) Use "%s" format string in DebugError function to avoid crash caused by incorrect input. Cc: Bo Chen <chenbo@pdx.edu> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
* VfrCompile: fix invalid comparison between pointer and integerPaolo Bonzini2017-02-221-1/+1
| | | | | | | | This would be valid C but is not valid C++, so change the comparison to do what it has always been doing. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
* BaseTools: Convert incomplete expression with dangling while()Nikolai SAOUKH2017-01-231-3/+3
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Nikolai SAOUKH <nms@otdel-1.org> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/Pccts: Resolve GCC sting format mismatch build warningHao Wu2016-12-231-1/+1
| | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=282 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: fix write-strings build warningsHeyi Guo2016-12-201-1/+1
| | | | | | | | | | | | Fix build warnings of "deprecated conversion from string constant to ?CHAR8* {aka char*}? [-Wwrite-strings]" for BaseTools, while using "gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)". Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Heyi Guo <heyi.guo@linaro.org> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: fix format type build warningsHeyi Guo2016-12-202-10/+10
| | | | | | | | | | | | Fix build warnings of "format ?%d? expects argument of type ?int?, but argument 5 has type ?long unsigned int? [-Wformat=]" for BaseTools, while using "gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)". Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Heyi Guo <heyi.guo@linaro.org> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: fix format-security build warningsHeyi Guo2016-12-203-6/+6
| | | | | | | | | | | | Fix build warnings of "format not a string literal and no format arguments [-Wformat-security]" for BaseTools, while using "gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)". Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Heyi Guo <heyi.guo@linaro.org> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/VfrCompile/Pccts: Make assignment operator not returning voidHao Wu2016-11-082-4/+6
| | | | | | | | | | | | | | | | The assignment operators for class ANTLRTokenPtr return void in current code. This commit makes them return the reference to the object just like primitive types do. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/VfrCompile/Pccts: Add virtual destructor for class DLGInputStreamHao Wu2016-11-081-0/+1
| | | | | | | | | | | | | | | | | Class DLGInputStream defined in DLexerBase.h has a virtual method but no virtual destructor. This commit add an empty virtual destructor to avoid potential memory/resource leak when an object of a class derived from class DLGInputStream is deleted through a pointer to the DLGInputStream class. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/VfrCompile: Explicitly state format string for DebugMsg()Hao Wu2016-11-081-2/+2
| | | | | | | | | | | | | For calls to API DebugMsg(), explicitly state format string as "%s" when the given variable list is a sting. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/VfrCompile: Fix potential memory leakHao Wu2016-11-081-0/+1
| | | | | | | | | | Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/VfrCompile: Remove unused local variablesHao Wu2016-11-081-2/+0
| | | | | | | | | | Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>