Leo: Could you let me know how to produce those compiler warning? I am curious, like the warning message in VfrError.cpp for Error().
Pccts is from http://www.polhode.com/pccts133mr.zip. We make minimal change to them. Thanks Liming > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Leo Duran > Sent: Friday, March 25, 2016 4:30 AM > To: edk2-devel@lists.01.org > Cc: Leo Duran; leif.lindh...@linaro.org; ard.biesheu...@linaro.org > Subject: [edk2] [PATCH] BaseTools: fixups to get rid of compiler warnings > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Leo Duran <leo.du...@amd.com> > --- > BaseTools/Source/C/VfrCompile/Pccts/antlr/bits.c | 18 +++++++++-------- > - > 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/Pccts/support/set/set.c | 2 +- > BaseTools/Source/C/VfrCompile/VfrError.cpp | 2 +- > 6 files changed, 19 insertions(+), 19 deletions(-) > > diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/bits.c > b/BaseTools/Source/C/VfrCompile/Pccts/antlr/bits.c > index ddd9bd6..19be3bc 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, > + 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/fset2.c > b/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c > index 7f686a5..d428b3b 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..d0a448d 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"); > @@ -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 */ > 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"); > diff --git a/BaseTools/Source/C/VfrCompile/Pccts/support/set/set.c > b/BaseTools/Source/C/VfrCompile/Pccts/support/set/set.c > index eb6fba7..508cf6d 100644 > --- a/BaseTools/Source/C/VfrCompile/Pccts/support/set/set.c > +++ b/BaseTools/Source/C/VfrCompile/Pccts/support/set/set.c > @@ -554,7 +554,7 @@ register char *s; > static set a; > register unsigned *p, *endp; > > - set_new(a, strlen(s)); > + set_new(a, (int)strlen(s)); > p = a.setword; > endp = &(a.setword[a.n]); > do { > diff --git a/BaseTools/Source/C/VfrCompile/VfrError.cpp > b/BaseTools/Source/C/VfrCompile/VfrError.cpp > index 3c506ec..a5d3a11 100644 > --- a/BaseTools/Source/C/VfrCompile/VfrError.cpp > +++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp > @@ -280,7 +280,7 @@ CVfrErrorHandle::HandleWarning ( > GetFileNameLineNum (LineNum, &FileName, &FileLine); > > if (mWarningAsError) { > - Error (FileName, FileLine, 0x2220, (CHAR8 *) "warning treated as error", > NULL); > + Error (FileName, FileLine, 0x2220, (CHAR8 *) "warning treated as error", > (CHAR8 *) NULL); > } > > for (Index = 0; mVfrWarningHandleTable[Index].mWarningCode != > VFR_WARNING_CODEUNDEFINED; Index++) { > -- > 1.9.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel