summaryrefslogtreecommitdiff
path: root/osi
diff options
context:
space:
mode:
authorPavlin Radoslavov <pavlin@google.com>2016-02-11 19:44:47 -0800
committerAndre Eisenbach <eisenbach@google.com>2016-02-18 10:39:27 -0800
commit0b60bb04b966030fd1dfdffe68099da8f280ade0 (patch)
tree65c0d5f9d1901d6bf7ff3461f4f61680b4c26d1d /osi
parent0ec558b58d55eb05f2b42bc29a6c1c93786ac090 (diff)
downloadandroid-system-bt-0b60bb04b966030fd1dfdffe68099da8f280ade0.tar.gz
android-system-bt-0b60bb04b966030fd1dfdffe68099da8f280ade0.tar.xz
Cleanup C and C++ compiler flags
Cleanup the setting of C and C++ compiler flags: * (Almost) all compiler flags are set uniformly in the system/bt/Android.mk file. * Enable by default breaking the compilation if there is a compilation warning: -Werror * Enable most compilation warnings: -Wall -Wextra * Renamed Android.mk related flags: - bdroid_C_INCLUDES -> bluetooth_C_INCLUDES - bdroid_CFLAGS -> bluetooth_CFLAGS * Introduce variables for C-only and C++ only compiler: - bluetooth_CFLAGS: common C and C++ compiler flags - bluetooth_CONLYFLAGS: C only compiler flags - bluetooth_CPPFLAGS: C++ only compiler flags * Disable warnings for existing issues - to be removed as issues are resolved * Add a workaround for libchrome and -DNDEBUG usage. Bug: 26879229 Change-Id: Ie7595965ca0c8ead0e95e983e76c327e7891b2c3
Diffstat (limited to 'osi')
-rw-r--r--osi/Android.mk58
1 files changed, 40 insertions, 18 deletions
diff --git a/osi/Android.mk b/osi/Android.mk
index 05037a1..d2ee7ab 100644
--- a/osi/Android.mk
+++ b/osi/Android.mk
@@ -75,11 +75,10 @@ btosiCommonTestSrc := \
btosiCommonIncludes := \
$(LOCAL_PATH)/.. \
$(LOCAL_PATH)/../utils/include \
- $(LOCAL_PATH)/../stack/include $(bdroid_C_INCLUDES)
+ $(LOCAL_PATH)/../stack/include \
+ $(bluetooth_C_INCLUDES)
-btosiCommonCFlags := -Wall -Werror -UNDEBUG -fvisibility=hidden $(bdroid_CFLAGS)
-
-# protobuf library for bluetooth
+# Bluetooth Protobuf static library for target
# ========================================================
include $(CLEAR_VARS)
LOCAL_MODULE := libbt-protos
@@ -88,8 +87,15 @@ generated_sources_dir := $(call local-generated-sources-dir)
LOCAL_EXPORT_C_INCLUDE_DIRS += \
$(generated_sources_dir)/proto/system/bt
LOCAL_SRC_FILES := $(call all-proto-files-under,src/protos/)
+
+LOCAL_CFLAGS += $(bluetooth_CFLAGS)
+LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
+LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
+
include $(BUILD_STATIC_LIBRARY)
+# Bluetooth Protobuf static library for host
+# ========================================================
include $(CLEAR_VARS)
LOCAL_MODULE := libbt-protos
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
@@ -97,6 +103,11 @@ generated_sources_dir := $(call local-generated-sources-dir)
LOCAL_EXPORT_C_INCLUDE_DIRS += \
$(generated_sources_dir)/proto/system/bt
LOCAL_SRC_FILES := $(call all-proto-files-under,src/protos/)
+
+LOCAL_CFLAGS += $(bluetooth_CFLAGS)
+LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
+LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
+
include $(BUILD_HOST_STATIC_LIBRARY)
# libosi static library for target
@@ -104,14 +115,16 @@ include $(BUILD_HOST_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(btosiCommonIncludes)
LOCAL_SRC_FILES := $(btosiCommonSrc)
-LOCAL_CFLAGS := $(btosiCommonCFlags)
-# Many .h files have redefined typedefs
-LOCAL_CLANG_CFLAGS += -Wno-error=typedef-redefinition
LOCAL_MODULE := libosi
LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES := libc liblog
LOCAL_STATIC_LIBRARIES := libbt-protos
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+
+LOCAL_CFLAGS += $(bluetooth_CFLAGS)
+LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
+LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
+
include $(BUILD_STATIC_LIBRARY)
# libosi static library for host
@@ -120,35 +133,40 @@ ifeq ($(HOST_OS),linux)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(btosiCommonIncludes)
LOCAL_SRC_FILES := $(btosiCommonSrc)
-# TODO(armansito): Setting _GNU_SOURCE isn't very platform-independent but
-# should be compatible for a Linux host OS. We should figure out what to do for
-# a non-Linux host OS.
-LOCAL_CFLAGS := \
- $(btosiCommonCFlags) \
- -D_GNU_SOURCE
-# Many .h files have redefined typedefs
-LOCAL_CLANG_CFLAGS += -Wno-error=typedef-redefinition
LOCAL_MODULE := libosi-host
LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_STATIC_LIBRARIES := libbt-protos
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+
+# TODO(armansito): Setting _GNU_SOURCE isn't very platform-independent but
+# should be compatible for a Linux host OS. We should figure out what to do for
+# a non-Linux host OS.
+LOCAL_CFLAGS += $(bluetooth_CFLAGS) -D_GNU_SOURCE
+LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
+LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
+
include $(BUILD_HOST_STATIC_LIBRARY)
endif
+#
# Note: It's good to get the tests compiled both for the host and the target so
# we get to test with both Bionic libc and glibc
-
+#
# libosi unit tests for target
# ========================================================
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(btosiCommonIncludes)
LOCAL_SRC_FILES := $(btosiCommonTestSrc)
-LOCAL_CFLAGS := -Wall -UNDEBUG
LOCAL_MODULE := net_test_osi
LOCAL_MODULE_TAGS := tests
LOCAL_SHARED_LIBRARIES := liblog libprotobuf-cpp-full
LOCAL_STATIC_LIBRARIES := libosi libbt-protos
+
+LOCAL_CFLAGS += $(bluetooth_CFLAGS)
+LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
+LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
+
include $(BUILD_NATIVE_TEST)
# libosi unit tests for host
@@ -157,11 +175,15 @@ ifeq ($(HOST_OS),linux)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(btosiCommonIncludes)
LOCAL_SRC_FILES := $(btosiCommonTestSrc)
-LOCAL_CFLAGS := -Wall -UNDEBUG
LOCAL_LDLIBS := -lrt -lpthread
LOCAL_MODULE := net_test_osi
LOCAL_MODULE_TAGS := tests
LOCAL_SHARED_LIBRARIES := liblog libprotobuf-cpp-full
LOCAL_STATIC_LIBRARIES := libosi-host libbt-protos
+
+LOCAL_CFLAGS += $(bluetooth_CFLAGS)
+LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
+LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
+
include $(BUILD_HOST_NATIVE_TEST)
endif