From patchwork Thu Dec 15 06:49:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 88116 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp630876qgi; Wed, 14 Dec 2016 22:51:39 -0800 (PST) X-Received: by 10.99.238.17 with SMTP id e17mr1550322pgi.58.1481784699577; Wed, 14 Dec 2016 22:51:39 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id l9si903429pli.292.2016.12.14.22.51.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Dec 2016 22:51:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4EF3881EAB; Wed, 14 Dec 2016 22:51:39 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-pf0-x232.google.com (mail-pf0-x232.google.com [IPv6:2607:f8b0:400e:c00::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id AB2E981E0C for ; Wed, 14 Dec 2016 22:51:37 -0800 (PST) Received: by mail-pf0-x232.google.com with SMTP id 189so7679508pfz.3 for ; Wed, 14 Dec 2016 22:51:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=X6hvhgx0As/np3Ok0epsLEHYJ0rgMQNEJkA1IF/GfpA=; b=do1HMBRJIlJvzPoyUaWNVo6wA8Hcg73Ez0K0MF9Xt3MbFYmPM5Sow7PtMPvDwXjLoC zsigcjxhpYWL9ka+LRFBPviKJgP7jJQPQ4qH+JEwkRc1rbOrbCtVIgRnpkWyuBh9wKOG Be98HLFDsFefJYpwv51KoF/BPhbTcqvWoQt5A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=X6hvhgx0As/np3Ok0epsLEHYJ0rgMQNEJkA1IF/GfpA=; b=VbiHI4S6A5aTSNmAtOek2P828Y36BN5RFXU43gmXKpb0R3xsFl+yyaEyCT7SATyXo+ 3jXIReYxFYq0TCIPJ8NQ2DETwvjqzKHgFFDibs9BZ/w9evrZXokrUo9unPBf+lMZxZZK zSg3vSj7eQTPiIhSi+ZMzrvpaTOjuFuyq/SZZoGIF0rbuQtNqS7f/taT809WBDFlBATV UYCfXnapXBqKbLFbthkz8Qn4GwFSWWB80DDZyhU3lQbd1wdtfQQB+0rAhDfQnvvO/bGl VRR9f9i+av+U/9iT6RwU4mc9ljX+qZEk+DjLDRarZHNUP2OnY3MUCakzXwhoOidZyAOq MNZw== X-Gm-Message-State: AKaTC02H/aj8TZLMh25MbKJCFW7SK0wVL1bRrxXmTrIPv0J1Ls/KVPXuNIDiDu/H1Of4yql2 X-Received: by 10.98.61.152 with SMTP id x24mr797494pfj.88.1481784697224; Wed, 14 Dec 2016 22:51:37 -0800 (PST) Received: from localhost.localdomain ([119.145.15.121]) by smtp.gmail.com with ESMTPSA id y89sm1377007pfk.83.2016.12.14.22.51.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Dec 2016 22:51:36 -0800 (PST) From: Heyi Guo To: edk2-devel@lists.01.org Date: Thu, 15 Dec 2016 14:49:46 +0800 Message-Id: <1481784588-35336-3-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1481784588-35336-1-git-send-email-heyi.guo@linaro.org> References: <1481784588-35336-1-git-send-email-heyi.guo@linaro.org> MIME-Version: 1.0 Subject: [edk2] [PATCH 2/4] BaseTools: fix format type build warnings X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heyi Guo , Liming Gao Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 Cc: Yonghong Zhu Cc: Liming Gao --- 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 */