Message ID | 1458851413-26577-5-git-send-email-leo.duran@amd.com |
---|---|
State | New |
Headers | show |
(+ Yonghong, Liming) On 24 March 2016 at 21:30, Leo Duran <leo.duran@amd.com> wrote: > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Leo Duran <leo.duran@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
On 03/24/16 22:16, Ard Biesheuvel wrote: > (+ Yonghong, Liming) > > On 24 March 2016 at 21:30, Leo Duran <leo.duran@amd.com> wrote: >> Contributed-under: TianoCore Contribution Agreement 1.0 >> Signed-off-by: Leo Duran <leo.duran@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)); The type of the result of the sizeof operator is size_t. All the C standard says about it is that it is an unsigned integer. The NumWords() function-like macro evaluates to an "unsigned int". Therefore in order to determine the type of the above product, we have to investigate unsigned * size_t Here's a table where the "input parameter" is the "actual" type of size_t, and the "output parameter" is the type of the product. This is all derived from the /integer promotions/ and the /usual arithmetic conversions/: size_t is actually a typedef to the product has type ------------------------------- -------------------- unsigned char unsigned int unsigned short unsigned int unsigned int unsigned int unsigned long unsigned long unsigned long long unsigned long long In other words, the above solution is not portable enough. I cannot determine the range of the product (I don't know how large TokenNum can be). If the product won't exceed 32767, then casting the product to (int) is safe. (In the "real world", INT_MAX is actually 2G-1, so casting to (int) should be definitely safe.) Another possibility is to cast the result of NumWords() to size_t, and change the conversion specification to "%zu". (Although I'm unsure if C95 knows about "%zu". C99 does, C89 doesn't.) Personally, I would change %d into %u, and cast the product to (unsigned). It's the same argument really as above with %d plus (int), except I only ever use signed types if they are unavoidable. (They are much more messy than unsigned types.) Thanks Laszlo >> } >> 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
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++) {
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Leo Duran <leo.duran@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(-) -- 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel