From 2ec400bfc7d1605b68ae3f5501add7bf2647b9dd Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 8 Oct 2013 17:04:33 -0700 Subject: [PATCH] Don't allow int<->pointer conversions. Normally we don't have -Werror for upstream code, but for those warnings that probably point to 32-bit assumptions about pointers, we want those warnings to always be errors. Change-Id: Ibece9caf09b2f7989ca600ef448d07868669a8fb --- libc/Android.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libc/Android.mk b/libc/Android.mk index a39b06021..f4fdb4c37 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -562,7 +562,13 @@ libc_common_cflags := \ -DINET6 \ -I$(LOCAL_PATH)/private \ -DPOSIX_MISTAKE \ - -Wall -Wextra + -Wall -Wextra \ + +# Try to catch typical 32-bit assumptions that break with 64-bit pointers. +libc_common_cflags += \ + -Werror=pointer-to-int-cast \ + -Werror=int-to-pointer-cast \ + -Werror=type-limits \ ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true) libc_common_cflags += -DDEBUG