From 2a5bc9dfbf7c6a80e5f7cb4dd05b4036741478bc Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Tue, 3 Oct 2017 13:45:03 -0700 Subject: [PATCH] Use -Werror in build/make * Remove unused local variables. Bug: 66996870 Test: build with WITH_TIDY=1 Change-Id: Iced5bb903902f49d7cd5cf5f572906a512c75e18 --- tools/acp/Android.bp | 1 + tools/acp/acp.c | 3 +-- tools/atree/Android.bp | 1 + tools/atree/files.cpp | 2 -- tools/fs_get_stats/Android.bp | 1 + tools/zipalign/Android.bp | 2 ++ tools/zipalign/ZipFile.cpp | 2 -- tools/ziptime/Android.bp | 1 + tools/ziptime/ZipEntry.cpp | 2 -- 9 files changed, 7 insertions(+), 8 deletions(-) diff --git a/tools/acp/Android.bp b/tools/acp/Android.bp index faf2034e3..64f5a1013 100644 --- a/tools/acp/Android.bp +++ b/tools/acp/Android.bp @@ -5,6 +5,7 @@ cc_binary_host { srcs: ["acp.c"], + cflags: ["-Wall", "-Werror"], static_libs: ["libhost"], name: "acp", diff --git a/tools/acp/acp.c b/tools/acp/acp.c index eb1de1f96..d4a9fbcf4 100644 --- a/tools/acp/acp.c +++ b/tools/acp/acp.c @@ -41,10 +41,9 @@ int process(int argc, char* const argv[], unsigned int options) { int retVal = 0; - int i, cc; + int i; char* stripDest = NULL; int stripDestLen; - struct stat destStat; bool destMustBeDir = false; struct stat sb; diff --git a/tools/atree/Android.bp b/tools/atree/Android.bp index 3c3a8ef3a..5fbe042ea 100644 --- a/tools/atree/Android.bp +++ b/tools/atree/Android.bp @@ -9,5 +9,6 @@ cc_binary_host { "files.cpp", "fs.cpp", ], + cflags: ["-Wall", "-Werror"], static_libs: ["libhost"], } diff --git a/tools/atree/files.cpp b/tools/atree/files.cpp index d945f589c..d5c8a977d 100644 --- a/tools/atree/files.cpp +++ b/tools/atree/files.cpp @@ -425,8 +425,6 @@ list_dir(const string& path, const FileRecord& rec, const vector& excludes, vector* more) { - int err; - string full = path_append(rec.sourceBase, rec.sourceName); full = path_append(full, path); diff --git a/tools/fs_get_stats/Android.bp b/tools/fs_get_stats/Android.bp index 668431991..67742b836 100644 --- a/tools/fs_get_stats/Android.bp +++ b/tools/fs_get_stats/Android.bp @@ -1,6 +1,7 @@ cc_binary_host { name: "fs_get_stats", srcs: ["fs_get_stats.c"], + cflags: ["-Wall", "-Werror"], shared_libs: [ "libcutils", "liblog", diff --git a/tools/zipalign/Android.bp b/tools/zipalign/Android.bp index cfc6aecdf..2aa64504e 100644 --- a/tools/zipalign/Android.bp +++ b/tools/zipalign/Android.bp @@ -13,6 +13,8 @@ cc_binary_host { "ZipFile.cpp", ], + cflags: ["-Wall", "-Werror"], + static_libs: [ "libandroidfw", "libutils", diff --git a/tools/zipalign/ZipFile.cpp b/tools/zipalign/ZipFile.cpp index 1b3990227..719c6b9bf 100644 --- a/tools/zipalign/ZipFile.cpp +++ b/tools/zipalign/ZipFile.cpp @@ -785,8 +785,6 @@ status_t ZipFile::copyFpToFp(FILE* dstFp, FILE* srcFp, uint32_t* pCRC32) status_t ZipFile::copyDataToFp(FILE* dstFp, const void* data, size_t size, uint32_t* pCRC32) { - size_t count; - *pCRC32 = crc32(0L, Z_NULL, 0); if (size > 0) { *pCRC32 = crc32(*pCRC32, (const unsigned char*)data, size); diff --git a/tools/ziptime/Android.bp b/tools/ziptime/Android.bp index 874d34685..5ef45ed40 100644 --- a/tools/ziptime/Android.bp +++ b/tools/ziptime/Android.bp @@ -27,6 +27,7 @@ cc_binary_host { ], name: "ziptime", + cflags: ["-Wall", "-Werror"], target: { windows: { enabled: true, diff --git a/tools/ziptime/ZipEntry.cpp b/tools/ziptime/ZipEntry.cpp index 51ce09f1f..e7b52ed0a 100644 --- a/tools/ziptime/ZipEntry.cpp +++ b/tools/ziptime/ZipEntry.cpp @@ -86,7 +86,6 @@ status_t ZipEntry::initAndRewriteFromCDE(FILE* fp) */ status_t ZipEntry::LocalFileHeader::rewrite(FILE* fp) { - status_t result = 0; uint8_t buf[kLFHLen]; if (fread(buf, 1, kLFHLen, fp) != kLFHLen) @@ -124,7 +123,6 @@ status_t ZipEntry::LocalFileHeader::rewrite(FILE* fp) */ status_t ZipEntry::CentralDirEntry::rewrite(FILE* fp) { - status_t result = 0; uint8_t buf[kCDELen]; uint16_t fileNameLength, extraFieldLength, fileCommentLength;