public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Heyi Guo <heyi.guo@linaro.org>
To: edk2-devel@lists.01.org
Cc: Heyi Guo <heyi.guo@linaro.org>,
	Yonghong Zhu <yonghong.zhu@intel.com>,
	Liming Gao <liming.gao@intel.com>
Subject: [PATCH 2/4] BaseTools: fix format type build warnings
Date: Thu, 15 Dec 2016 14:49:46 +0800	[thread overview]
Message-ID: <1481784588-35336-3-git-send-email-heyi.guo@linaro.org> (raw)
In-Reply-To: <1481784588-35336-1-git-send-email-heyi.guo@linaro.org>

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



  parent reply	other threads:[~2016-12-15  6:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1481784588-35336-3-git-send-email-heyi.guo@linaro.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox