public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/4] Fix GCC build warnings for BaseTools
@ 2016-12-15  6:49 Heyi Guo
  2016-12-15  6:49 ` [PATCH 1/4] BaseTools: fix format-security build warnings Heyi Guo
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Heyi Guo @ 2016-12-15  6:49 UTC (permalink / raw)
  To: edk2-devel; +Cc: Heyi Guo

There are 28 warnings when I build BaseTools using gcc (version 4.8.4
(Ubuntu 4.8.4-2ubuntu1~14.04.3)). Below patches are to fix these build
warnings. I don't have a visual studio environment to test the build;
sorry for not testing the patches entirely.

There are still 10 warnings which I'm not very clear how to fix; could
anyone please help to fix them:

  ../support/set/set.c:557:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat=]
  VfrSyntax.g, line 1830: warning: predicate: LT(i) missing, bad, or with i=0; assuming i=1
  VfrSyntax.g, line 1835: warning: predicate: LT(i) missing, bad, or with i=0; assuming i=1
  VfrSyntax.g, line 3266: warning: alts 1 and 2 of {..} ambiguous upon ( ";" RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf Default GrayOutIf )
  VfrSyntax.g, line 3275: warning: alts 1 and 2 of {..} ambiguous upon ( ";" RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf Default GrayOutIf )
  VfrSyntax.g, line 3284: warning: alts 1 and 2 of {..} ambiguous upon ( ";" RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf Default GrayOutIf )
  VfrSyntax.g, line 3294: warning: alts 1 and 2 of {..} ambiguous upon ( ";" RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf Default GrayOutIf )
  VfrSyntax.g, line 3324: warning: alts 1 and 2 of {..} ambiguous upon ( ";" RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf Default GrayOutIf )
  VfrSyntax.g, line 3333: warning: alts 1 and 2 of {..} ambiguous upon ( ";" RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf Default GrayOutIf )
  ../support/set/set.c:557:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat=]

Heyi Guo (4):
  BaseTools: fix format-security build warnings
  BaseTools: fix format type build warnings
  BaseTools: fix write-strings build warnings
  BaseTools: fix unused-result build warnings

 BaseTools/Source/C/VfrCompile/Pccts/antlr/bits.c  | 16 ++++++++--------
 BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c |  2 +-
 BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c   |  6 +++---
 BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c   |  8 ++++----
 BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp      |  2 +-
 BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp   |  4 +++-
 6 files changed, 20 insertions(+), 18 deletions(-)

-- 
1.9.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/4] BaseTools: fix format-security build warnings
  2016-12-15  6:49 [PATCH 0/4] Fix GCC build warnings for BaseTools Heyi Guo
@ 2016-12-15  6:49 ` Heyi Guo
  2016-12-15  6:49 ` [PATCH 2/4] BaseTools: fix format type " Heyi Guo
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Heyi Guo @ 2016-12-15  6:49 UTC (permalink / raw)
  To: edk2-devel; +Cc: Heyi Guo, Yonghong Zhu, Liming Gao

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>
---
 BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c | 2 +-
 BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c   | 2 +-
 BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c   | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c
index 7f686a5..fe1b4d6 100644
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c
+++ b/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c
@@ -2210,7 +2210,7 @@ void MR_backTraceReport()
       if (p->ntype != nToken) continue;
       tn=(TokNode *)p;
       if (depth != 0) fprintf(stdout," ");
-      fprintf(stdout,TerminalString(tn->token));
+      fprintf(stdout, "%s", TerminalString(tn->token));
       depth++;
       if (! MR_AmbAidMultiple) {
         if (set_nil(tn->tset)) {
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c
index 368a96b..b990545 100644
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c
+++ b/BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c
@@ -3866,7 +3866,7 @@ int file;
 /* MR10 */    _gen(" *  ");
 /* MR10 */    for (i=0 ; i < Save_argc ; i++) {
 /* MR10 */      _gen(" ");
-/* MR10 */      _gen(Save_argv[i]);
+/* MR10 */      _gen1("%s", Save_argv[i]);
 /* MR10 */    };
 	_gen("\n");
 	_gen(" *\n");
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c
index 8c524fe..a4e7f69 100644
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c
+++ b/BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c
@@ -706,7 +706,7 @@ FILE *output;
 /* MR26 */			if (! (isalpha(*t) || isdigit(*t) || *t == '_' || *t == '$')) break;
 /* MR26 */		}
 /* MR26 */	}
-/* MR26 */	fprintf(output,strBetween(pSymbol, t, pSeparator));
+/* MR26 */	fprintf(output, "%s", strBetween(pSymbol, t, pSeparator));
 
     *q = p;
     return (*pSeparator  == 0);
@@ -771,7 +771,7 @@ FILE *f;
 				  &pValue,
 				  &pSeparator,
 				  &nest);
-	fprintf(f,strBetween(pDataType, pSymbol, pSeparator));
+	fprintf(f, "%s", strBetween(pDataType, pSymbol, pSeparator));
 }
 
 /* check to see if string e is a word in string s */
@@ -852,9 +852,9 @@ int i;
 					  &pSeparator,
 					  &nest);
 		fprintf(f,"\t");
-		fprintf(f,strBetween(pDataType, pSymbol, pSeparator));
+		fprintf(f, "%s", strBetween(pDataType, pSymbol, pSeparator));
 		fprintf(f," ");
-		fprintf(f,strBetween(pSymbol, pEqualSign, pSeparator));
+		fprintf(f, "%s", strBetween(pSymbol, pEqualSign, pSeparator));
 		fprintf(f,";\n");
     }
 	fprintf(f,"};\n");
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/4] BaseTools: fix format type build warnings
  2016-12-15  6:49 [PATCH 0/4] Fix GCC build warnings for BaseTools Heyi Guo
  2016-12-15  6:49 ` [PATCH 1/4] BaseTools: fix format-security build warnings Heyi Guo
@ 2016-12-15  6:49 ` Heyi Guo
  2016-12-15  6:49 ` [PATCH 3/4] BaseTools: fix write-strings " Heyi Guo
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Heyi Guo @ 2016-12-15  6:49 UTC (permalink / raw)
  To: edk2-devel; +Cc: Heyi Guo, Yonghong Zhu, Liming Gao

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>
---
 BaseTools/Source/C/VfrCompile/Pccts/antlr/bits.c | 16 ++++++++--------
 BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c  |  4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/bits.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/bits.c
index ddd9bd6..5cb657b 100644
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/bits.c
+++ b/BaseTools/Source/C/VfrCompile/Pccts/antlr/bits.c
@@ -573,13 +573,13 @@ const char *suffix;
 	else
 		fprintf(DefFile, "extern SetWordType zzerr%d[];\n", esetnum);
 	if ( name!=NULL ) {
-		fprintf(ErrFile, "SetWordType %s%s[%d] = {",
+		fprintf(ErrFile, "SetWordType %s%s[%lu] = {",
 				name,
                 suffix,
 				NumWords(TokenNum-1)*sizeof(unsigned));
 	}
 	else {
-		fprintf(ErrFile, "SetWordType zzerr%d[%d] = {",
+		fprintf(ErrFile, "SetWordType zzerr%d[%lu] = {",
 				esetnum,
 				NumWords(TokenNum-1)*sizeof(unsigned));
 	}
@@ -641,20 +641,20 @@ const char *suffix;
 	esetnum++;
 
 	if ( name!=NULL ) {
-		fprintf(Parser_h, "\tstatic SetWordType %s%s[%d];\n", name, suffix,
+		fprintf(Parser_h, "\tstatic SetWordType %s%s[%lu];\n", name, suffix,
 				NumWords(TokenNum-1)*sizeof(unsigned));
-		fprintf(Parser_c, "SetWordType %s::%s%s[%d] = {",
+		fprintf(Parser_c, "SetWordType %s::%s%s[%lu] = {",
 				CurrentClassName,
 				name,
 				suffix,
 				NumWords(TokenNum-1)*sizeof(unsigned));
 	}
 	else {
-		fprintf(Parser_c, "SetWordType %s::err%d[%d] = {",
+		fprintf(Parser_c, "SetWordType %s::err%d[%lu] = {",
 				CurrentClassName,
 				esetnum,
 				NumWords(TokenNum-1)*sizeof(unsigned));
-		fprintf(Parser_h, "\tstatic SetWordType err%d[%d];\n", esetnum,
+		fprintf(Parser_h, "\tstatic SetWordType err%d[%lu];\n", esetnum,
 				NumWords(TokenNum-1)*sizeof(unsigned));
 	}
 
@@ -787,7 +787,7 @@ GenParser_c_Hdr()
 
 	/* Build constructors */
 	fprintf(Parser_c, "\n%s::", CurrentClassName);
-	fprintf(Parser_c,	"%s(ANTLRTokenBuffer *input) : %s(input,%d,%d,%d,%d)\n",
+	fprintf(Parser_c,	"%s(ANTLRTokenBuffer *input) : %s(input,%d,%d,%d,%lu)\n",
 						CurrentClassName,
 						(BaseClassName == NULL ? "ANTLRParser" : BaseClassName),
 						OutputLL_k,
@@ -912,7 +912,7 @@ GenErrHdr( )
 #ifdef DUM
 	if ( LexGen ) fprintf(ErrFile, "#define zzEOF_TOKEN %d\n", (TokenInd!=NULL?TokenInd[EofToken]:EofToken));
 #endif
-	fprintf(ErrFile, "#define zzSET_SIZE %d\n", NumWords(TokenNum-1)*sizeof(unsigned));
+	fprintf(ErrFile, "#define zzSET_SIZE %lu\n", NumWords(TokenNum-1)*sizeof(unsigned));
 	if ( DemandLookahead ) fprintf(ErrFile, "#define DEMAND_LOOK\n");
 	fprintf(ErrFile, "#include \"antlr.h\"\n");
 	if ( GenAST ) fprintf(ErrFile, "#include \"ast.h\"\n");
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c
index b990545..d0a448d 100644
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c
+++ b/BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c
@@ -3911,7 +3911,7 @@ int file;
 	}
 #endif
 	/* ###WARNING: This will have to change when SetWordSize changes */
-	if ( !GenCC ) _gen1("#define zzSET_SIZE %d\n", NumWords(TokenNum-1)*sizeof(unsigned));
+	if ( !GenCC ) _gen1("#define zzSET_SIZE %lu\n", NumWords(TokenNum-1)*sizeof(unsigned));
     if (TraceGen) {
       _gen("#ifndef zzTRACE_RULES\n");  /* MR20 */
       _gen("#define zzTRACE_RULES\n");  /* MR20 */
@@ -4125,7 +4125,7 @@ char * gate;                                    /* MR10 */
 	if ( LexGen ) fprintf(f, "#define zzEOF_TOKEN %d\n", (TokenInd!=NULL?TokenInd[EofToken]:EofToken));
 #endif
 	/* ###WARNING: This will have to change when SetWordSize changes */
-	fprintf(f, "#define zzSET_SIZE %d\n", NumWords(TokenNum-1)*sizeof(unsigned));
+	fprintf(f, "#define zzSET_SIZE %lu\n", NumWords(TokenNum-1)*sizeof(unsigned));
     if (TraceGen) {
       fprintf(f,"#ifndef zzTRACE_RULES\n");  /* MR20 */
       fprintf(f,"#define zzTRACE_RULES\n");  /* MR20 */
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/4] BaseTools: fix write-strings build warnings
  2016-12-15  6:49 [PATCH 0/4] Fix GCC build warnings for BaseTools Heyi Guo
  2016-12-15  6:49 ` [PATCH 1/4] BaseTools: fix format-security build warnings Heyi Guo
  2016-12-15  6:49 ` [PATCH 2/4] BaseTools: fix format type " Heyi Guo
@ 2016-12-15  6:49 ` Heyi Guo
  2016-12-15  6:49 ` [PATCH 4/4] BaseTools: fix unused-result " Heyi Guo
  2016-12-16  4:53 ` [PATCH 0/4] Fix GCC build warnings for BaseTools Gao, Liming
  4 siblings, 0 replies; 7+ messages in thread
From: Heyi Guo @ 2016-12-15  6:49 UTC (permalink / raw)
  To: edk2-devel; +Cc: Heyi Guo, Yonghong Zhu, Liming Gao

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>
---
 BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
index ec73529..2be0c38 100644
--- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
@@ -1365,7 +1365,7 @@ CIfrRecordInfoDB::IfrUpdateRecordInfoForDynamicOpcode (
   // Base on the original offset info to update the record list.
   //
   if (!IfrAdjustDynamicOpcodeInRecords(CreateOpcodeAfterParsingVfr)) {
-    gCVfrErrorHandle.PrintMsg (0, "Error", "Can not find the adjust offset in the record.");
+    gCVfrErrorHandle.PrintMsg (0, (CHAR8 *)"Error", (CHAR8 *)"Can not find the adjust offset in the record.");
   }
 
   //
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] BaseTools: fix unused-result build warnings
  2016-12-15  6:49 [PATCH 0/4] Fix GCC build warnings for BaseTools Heyi Guo
                   ` (2 preceding siblings ...)
  2016-12-15  6:49 ` [PATCH 3/4] BaseTools: fix write-strings " Heyi Guo
@ 2016-12-15  6:49 ` Heyi Guo
  2016-12-16  4:53 ` [PATCH 0/4] Fix GCC build warnings for BaseTools Gao, Liming
  4 siblings, 0 replies; 7+ messages in thread
From: Heyi Guo @ 2016-12-15  6:49 UTC (permalink / raw)
  To: edk2-devel; +Cc: Heyi Guo, Yonghong Zhu, Liming Gao

Fix build warnings of "ignoring return value of ‘size_t fread(void*,
size_t, size_t, FILE*)’, declared with attribute warn_unused_result
[-Wunused-result]" 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>
---
 BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
index 3ca57ed..0ba7102 100644
--- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
@@ -3395,7 +3395,9 @@ CVfrStringDB::GetVarStoreNameFormStringId (
     fclose (pInFile);
     return NULL;
   }
-  fread ((char *)StringPtr, sizeof (UINT8), Length, pInFile);
+  // Fix GCC build warning for ignoring return value
+  unsigned long TempResult = fread ((char *)StringPtr, sizeof (UINT8), Length, pInFile);
+  (void)TempResult;
   fclose (pInFile);
 
   PkgHeader = (EFI_HII_STRING_PACKAGE_HDR *) StringPtr;
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] Fix GCC build warnings for BaseTools
  2016-12-15  6:49 [PATCH 0/4] Fix GCC build warnings for BaseTools Heyi Guo
                   ` (3 preceding siblings ...)
  2016-12-15  6:49 ` [PATCH 4/4] BaseTools: fix unused-result " Heyi Guo
@ 2016-12-16  4:53 ` Gao, Liming
  2016-12-16  6:47   ` Heyi Guo
  4 siblings, 1 reply; 7+ messages in thread
From: Gao, Liming @ 2016-12-16  4:53 UTC (permalink / raw)
  To: Heyi Guo, edk2-devel@lists.01.org

Heyi:
  Thanks for your fix. The patch 1~3 are good to me. The patch 4 is not necessary. We can disable this warning like other C tools. I will provide the patch for it. For the remaining C tool issue, we will look it. 

  ../support/set/set.c:557:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat=]

Thanks
Liming
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Heyi Guo
> Sent: Thursday, December 15, 2016 2:50 PM
> To: edk2-devel@lists.01.org
> Cc: Heyi Guo <heyi.guo@linaro.org>
> Subject: [edk2] [PATCH 0/4] Fix GCC build warnings for BaseTools
> 
> There are 28 warnings when I build BaseTools using gcc (version 4.8.4
> (Ubuntu 4.8.4-2ubuntu1~14.04.3)). Below patches are to fix these build
> warnings. I don't have a visual studio environment to test the build;
> sorry for not testing the patches entirely.
> 
> There are still 10 warnings which I'm not very clear how to fix; could
> anyone please help to fix them:
> 
>   ../support/set/set.c:557:2: warning: format ‘%d’ expects argument of type
> ‘int’, but argument 3 has type ‘size_t’ [-Wformat=]
>   VfrSyntax.g, line 1830: warning: predicate: LT(i) missing, bad, or with i=0;
> assuming i=1
>   VfrSyntax.g, line 1835: warning: predicate: LT(i) missing, bad, or with i=0;
> assuming i=1
>   VfrSyntax.g, line 3266: warning: alts 1 and 2 of {..} ambiguous upon ( ";"
> RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf
> Default GrayOutIf )
>   VfrSyntax.g, line 3275: warning: alts 1 and 2 of {..} ambiguous upon ( ";"
> RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf
> Default GrayOutIf )
>   VfrSyntax.g, line 3284: warning: alts 1 and 2 of {..} ambiguous upon ( ";"
> RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf
> Default GrayOutIf )
>   VfrSyntax.g, line 3294: warning: alts 1 and 2 of {..} ambiguous upon ( ";"
> RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf
> Default GrayOutIf )
>   VfrSyntax.g, line 3324: warning: alts 1 and 2 of {..} ambiguous upon ( ";"
> RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf
> Default GrayOutIf )
>   VfrSyntax.g, line 3333: warning: alts 1 and 2 of {..} ambiguous upon ( ";"
> RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf
> Default GrayOutIf )
>   ../support/set/set.c:557:2: warning: format ‘%d’ expects argument of type
> ‘int’, but argument 3 has type ‘size_t’ [-Wformat=]
> 
> Heyi Guo (4):
>   BaseTools: fix format-security build warnings
>   BaseTools: fix format type build warnings
>   BaseTools: fix write-strings build warnings
>   BaseTools: fix unused-result build warnings
> 
>  BaseTools/Source/C/VfrCompile/Pccts/antlr/bits.c  | 16 ++++++++--------
>  BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c |  2 +-
>  BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c   |  6 +++---
>  BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c   |  8 ++++----
>  BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp      |  2 +-
>  BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp   |  4 +++-
>  6 files changed, 20 insertions(+), 18 deletions(-)
> 
> --
> 1.9.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] Fix GCC build warnings for BaseTools
  2016-12-16  4:53 ` [PATCH 0/4] Fix GCC build warnings for BaseTools Gao, Liming
@ 2016-12-16  6:47   ` Heyi Guo
  0 siblings, 0 replies; 7+ messages in thread
From: Heyi Guo @ 2016-12-16  6:47 UTC (permalink / raw)
  To: Gao, Liming, edk2-devel@lists.01.org

That's great; many thanks, Liming!

Heyi

在 12/16/2016 12:53 PM, Gao, Liming 写道:
> Heyi:
>    Thanks for your fix. The patch 1~3 are good to me. The patch 4 is not necessary. We can disable this warning like other C tools. I will provide the patch for it. For the remaining C tool issue, we will look it.
>
>    ../support/set/set.c:557:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat=]
>
> Thanks
> Liming
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>> Heyi Guo
>> Sent: Thursday, December 15, 2016 2:50 PM
>> To: edk2-devel@lists.01.org
>> Cc: Heyi Guo <heyi.guo@linaro.org>
>> Subject: [edk2] [PATCH 0/4] Fix GCC build warnings for BaseTools
>>
>> There are 28 warnings when I build BaseTools using gcc (version 4.8.4
>> (Ubuntu 4.8.4-2ubuntu1~14.04.3)). Below patches are to fix these build
>> warnings. I don't have a visual studio environment to test the build;
>> sorry for not testing the patches entirely.
>>
>> There are still 10 warnings which I'm not very clear how to fix; could
>> anyone please help to fix them:
>>
>>    ../support/set/set.c:557:2: warning: format ‘%d’ expects argument of type
>> ‘int’, but argument 3 has type ‘size_t’ [-Wformat=]
>>    VfrSyntax.g, line 1830: warning: predicate: LT(i) missing, bad, or with i=0;
>> assuming i=1
>>    VfrSyntax.g, line 1835: warning: predicate: LT(i) missing, bad, or with i=0;
>> assuming i=1
>>    VfrSyntax.g, line 3266: warning: alts 1 and 2 of {..} ambiguous upon ( ";"
>> RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf
>> Default GrayOutIf )
>>    VfrSyntax.g, line 3275: warning: alts 1 and 2 of {..} ambiguous upon ( ";"
>> RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf
>> Default GrayOutIf )
>>    VfrSyntax.g, line 3284: warning: alts 1 and 2 of {..} ambiguous upon ( ";"
>> RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf
>> Default GrayOutIf )
>>    VfrSyntax.g, line 3294: warning: alts 1 and 2 of {..} ambiguous upon ( ";"
>> RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf
>> Default GrayOutIf )
>>    VfrSyntax.g, line 3324: warning: alts 1 and 2 of {..} ambiguous upon ( ";"
>> RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf
>> Default GrayOutIf )
>>    VfrSyntax.g, line 3333: warning: alts 1 and 2 of {..} ambiguous upon ( ";"
>> RefreshGuid GuidOp Locked Image EndIf InconsistentIf DisableIf SuppressIf
>> Default GrayOutIf )
>>    ../support/set/set.c:557:2: warning: format ‘%d’ expects argument of type
>> ‘int’, but argument 3 has type ‘size_t’ [-Wformat=]
>>
>> Heyi Guo (4):
>>    BaseTools: fix format-security build warnings
>>    BaseTools: fix format type build warnings
>>    BaseTools: fix write-strings build warnings
>>    BaseTools: fix unused-result build warnings
>>
>>   BaseTools/Source/C/VfrCompile/Pccts/antlr/bits.c  | 16 ++++++++--------
>>   BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c |  2 +-
>>   BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c   |  6 +++---
>>   BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c   |  8 ++++----
>>   BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp      |  2 +-
>>   BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp   |  4 +++-
>>   6 files changed, 20 insertions(+), 18 deletions(-)
>>
>> --
>> 1.9.1
>>
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-12-16  6:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-15  6:49 [PATCH 0/4] Fix GCC build warnings for BaseTools Heyi Guo
2016-12-15  6:49 ` [PATCH 1/4] BaseTools: fix format-security build warnings Heyi Guo
2016-12-15  6:49 ` [PATCH 2/4] BaseTools: fix format type " Heyi Guo
2016-12-15  6:49 ` [PATCH 3/4] BaseTools: fix write-strings " Heyi Guo
2016-12-15  6:49 ` [PATCH 4/4] BaseTools: fix unused-result " Heyi Guo
2016-12-16  4:53 ` [PATCH 0/4] Fix GCC build warnings for BaseTools Gao, Liming
2016-12-16  6:47   ` Heyi Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox