From 9e86f8e0365d3798cead67d229f1afe6c6bb2130 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Tue, 17 Nov 2015 14:17:38 -0800 Subject: [PATCH 1/2] libcutils: add prefix to local variables in Android.mk. Change-Id: I0561affbcc306c20f8aa87beb2d9728a9bb79f5e --- libcutils/Android.mk | 54 ++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/libcutils/Android.mk b/libcutils/Android.mk index 3ca544f04..6b0ed88e9 100644 --- a/libcutils/Android.mk +++ b/libcutils/Android.mk @@ -16,28 +16,28 @@ LOCAL_PATH := $(my-dir) include $(CLEAR_VARS) -commonSources := \ - hashmap.c \ - atomic.c.arm \ - native_handle.c \ - config_utils.c \ - load_file.c \ - strlcpy.c \ - open_memstream.c \ - strdup16to8.c \ - strdup8to16.c \ - record_stream.c \ - process_name.c \ - threads.c \ - sched_policy.c \ - iosched_policy.c \ - str_parms.c \ - fs_config.c +libcutils_common_sources := \ + hashmap.c \ + atomic.c.arm \ + native_handle.c \ + config_utils.c \ + load_file.c \ + strlcpy.c \ + open_memstream.c \ + strdup16to8.c \ + strdup8to16.c \ + record_stream.c \ + process_name.c \ + threads.c \ + sched_policy.c \ + iosched_policy.c \ + str_parms.c \ + fs_config.c # some files must not be compiled when building against Mingw # they correspond to features not used by our host development tools # which are also hard or even impossible to port to native Win32 -nonWindowsSources := \ +libcutils_nonwindows_sources := \ fs.c \ multiuser.c \ socket_inaddr_any_server.c \ @@ -48,7 +48,7 @@ nonWindowsSources := \ socket_network_client.c \ sockets.c \ -nonWindowsHostSources := \ +libcutils_nonwindows_host_sources := \ ashmem-host.c \ trace-host.c @@ -56,9 +56,9 @@ nonWindowsHostSources := \ # Shared and static library for host # ======================================================== LOCAL_MODULE := libcutils -LOCAL_SRC_FILES := $(commonSources) dlmalloc_stubs.c -LOCAL_SRC_FILES_darwin := $(nonWindowsSources) $(nonWindowsHostSources) -LOCAL_SRC_FILES_linux := $(nonWindowsSources) $(nonWindowsHostSources) +LOCAL_SRC_FILES := $(libcutils_common_sources) dlmalloc_stubs.c +LOCAL_SRC_FILES_darwin := $(libcutils_nonwindows_sources) $(libcutils_nonwindows_host_sources) +LOCAL_SRC_FILES_linux := $(libcutils_nonwindows_sources) $(libcutils_nonwindows_host_sources) LOCAL_STATIC_LIBRARIES := liblog LOCAL_CFLAGS_darwin := -Werror -Wall -Wextra LOCAL_CFLAGS_linux := -Werror -Wall -Wextra @@ -68,9 +68,9 @@ include $(BUILD_HOST_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := libcutils -LOCAL_SRC_FILES := $(commonSources) dlmalloc_stubs.c -LOCAL_SRC_FILES_darwin := $(nonWindowsSources) $(nonWindowsHostSources) -LOCAL_SRC_FILES_linux := $(nonWindowsSources) $(nonWindowsHostSources) +LOCAL_SRC_FILES := $(libcutils_common_sources) dlmalloc_stubs.c +LOCAL_SRC_FILES_darwin := $(libcutils_nonwindows_sources) $(libcutils_nonwindows_host_sources) +LOCAL_SRC_FILES_linux := $(libcutils_nonwindows_sources) $(libcutils_nonwindows_host_sources) LOCAL_SHARED_LIBRARIES := liblog LOCAL_CFLAGS_darwin := -Werror -Wall -Wextra LOCAL_CFLAGS_linux := -Werror -Wall -Wextra @@ -84,8 +84,8 @@ include $(BUILD_HOST_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := libcutils -LOCAL_SRC_FILES := $(commonSources) \ - $(nonWindowsSources) \ +LOCAL_SRC_FILES := $(libcutils_common_sources) \ + $(libcutils_nonwindows_sources) \ android_reboot.c \ ashmem-dev.c \ debugger.c \ From 1175d0fdb0b9870177eecc24b8aac3a10162b97a Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Tue, 24 Nov 2015 09:12:21 -0800 Subject: [PATCH 2/2] libcutils: turn on -Werror on Win32, fix resulting build break. Mingw doesn't provide strndup or strtok_r used in str_parms.c, resulting in -Wimplicit-function-declaration being emitted for the Windows build. None of the consumers of str_parms.c appear to be compiled for Windows, so we can just remove it from the Windows build. Change-Id: I36b66fc54ed261d38f5294bc8662ddb2db4fe64f --- libcutils/Android.mk | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libcutils/Android.mk b/libcutils/Android.mk index 6b0ed88e9..dd0810861 100644 --- a/libcutils/Android.mk +++ b/libcutils/Android.mk @@ -31,7 +31,6 @@ libcutils_common_sources := \ threads.c \ sched_policy.c \ iosched_policy.c \ - str_parms.c \ fs_config.c # some files must not be compiled when building against Mingw @@ -47,6 +46,7 @@ libcutils_nonwindows_sources := \ socket_loopback_server.c \ socket_network_client.c \ sockets.c \ + str_parms.c \ libcutils_nonwindows_host_sources := \ ashmem-host.c \ @@ -60,8 +60,7 @@ LOCAL_SRC_FILES := $(libcutils_common_sources) dlmalloc_stubs.c LOCAL_SRC_FILES_darwin := $(libcutils_nonwindows_sources) $(libcutils_nonwindows_host_sources) LOCAL_SRC_FILES_linux := $(libcutils_nonwindows_sources) $(libcutils_nonwindows_host_sources) LOCAL_STATIC_LIBRARIES := liblog -LOCAL_CFLAGS_darwin := -Werror -Wall -Wextra -LOCAL_CFLAGS_linux := -Werror -Wall -Wextra +LOCAL_CFLAGS := -Werror -Wall -Wextra LOCAL_MULTILIB := both LOCAL_MODULE_HOST_OS := darwin linux windows include $(BUILD_HOST_STATIC_LIBRARY) @@ -72,8 +71,7 @@ LOCAL_SRC_FILES := $(libcutils_common_sources) dlmalloc_stubs.c LOCAL_SRC_FILES_darwin := $(libcutils_nonwindows_sources) $(libcutils_nonwindows_host_sources) LOCAL_SRC_FILES_linux := $(libcutils_nonwindows_sources) $(libcutils_nonwindows_host_sources) LOCAL_SHARED_LIBRARIES := liblog -LOCAL_CFLAGS_darwin := -Werror -Wall -Wextra -LOCAL_CFLAGS_linux := -Werror -Wall -Wextra +LOCAL_CFLAGS := -Werror -Wall -Wextra LOCAL_MULTILIB := both include $(BUILD_HOST_SHARED_LIBRARY)