From 855e14261cc3145358d49aa98ec5254b844c4ba4 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Fri, 29 Sep 2017 10:35:29 -0700 Subject: Use -Werror in external/protobuf * Use -Wno-error= to keep existing warnings, to fix later. * Not for windows yet because some gcc warnings cannot be suppressed. Bug: 66996870 Test: build with WITH_TIDY=1 Change-Id: I4330ef7cd10a15259e1b8f1f9bb22bcb4fe413a5 --- Android.bp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Android.bp b/Android.bp index ad588f826..ab16b92b6 100644 --- a/Android.bp +++ b/Android.bp @@ -21,8 +21,34 @@ IGNORED_WARNINGS = [ "-Wno-error=return-type", ] +cc_defaults { + name: "protobuf-cflags-defaults", + clang_cflags: [ + "-Wno-error=unused-const-variable", + "-Wno-error=user-defined-warnings", + ], + cflags: [ + "-Wall", + "-Wno-error=format", + "-Wno-error=format-extra-args", + "-Wno-error=ignored-qualifiers", + "-Wno-error=sign-promo", + "-Wno-unused-function", + ], + target: { + android: { + cflags: ["-Werror"], + }, + // cannot suppress gcc warning on redefined macros + not_windows: { + cflags: ["-Werror"], + }, + }, +} + cc_defaults { name: "libprotobuf-cpp-lite-defaults", + defaults: ["protobuf-cflags-defaults"], srcs: [ "src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc", "src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc", @@ -266,6 +292,7 @@ cc_library_host_shared { // ======================================================= cc_binary_host { name: "aprotoc", + defaults: ["protobuf-cflags-defaults"], target: { windows: { -- cgit v1.2.3