From a67d165c9dfdb569758f22381d1d2fad9299e48f Mon Sep 17 00:00:00 2001 From: Ryan Prichard Date: Fri, 14 Sep 2018 14:47:39 -0700 Subject: android_support: fix lgamma and enable -Werror We had -Werror enabled already for C++ files, but also enable it for C files. Bug: https://github.com/android-ndk/ndk/issues/793 Test: ./checkbuild.py && ./run_tests.py Change-Id: If45b1fa2e737af2c6fe92f303f96f6c558417127 --- sources/android/support/Android.mk | 4 +-- sources/android/support/src/support_preinclude.h | 41 ++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 sources/android/support/src/support_preinclude.h (limited to 'sources') diff --git a/sources/android/support/Android.mk b/sources/android/support/Android.mk index 2c50a47c3..1770c49d4 100644 --- a/sources/android/support/Android.mk +++ b/sources/android/support/Android.mk @@ -36,7 +36,9 @@ android_support_c_includes += \ android_support_cflags += \ -include freebsd-compat.h \ -include openbsd-compat.h \ + -include $(LOCAL_PATH)/src/support_preinclude.h \ -D__BIONIC_BUILD_FOR_ANDROID_SUPPORT \ + -Werror \ android_support_sources := \ $(BIONIC_PATH)/libc/bionic/c32rtomb.cpp \ @@ -70,7 +72,6 @@ android_support_sources := \ $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_cosh.c \ $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_exp.c \ $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_hypot.c \ - $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_lgamma.c \ $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_log.c \ $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_log10.c \ $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_log2.c \ @@ -127,7 +128,6 @@ LOCAL_CFLAGS := $(android_support_cflags) LOCAL_CPPFLAGS := \ -fvisibility-inlines-hidden \ -std=c++11 \ - -Werror \ LOCAL_EXPORT_C_INCLUDES := $(android_support_export_c_includes) diff --git a/sources/android/support/src/support_preinclude.h b/sources/android/support/src/support_preinclude.h new file mode 100644 index 000000000..bf090b0d2 --- /dev/null +++ b/sources/android/support/src/support_preinclude.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#pragma once + +// Declare cimag and creal for use by __ldexp_cexp. libandroid_runtime doesn't +// really need __ldexp_cexp, but it does need __ldexp_exp, and both functions +// are defined in the same C file. complex.h doesn't declare cimag/creal when +// building libandroid_support, because the functions are only available +// starting with M, and libandroid_support is compiled for the oldest supported +// NDK API. +// +// The two functions are trivial (and have __builtin_{cimag,creal} +// equivalents). Clang inlines calls to these functions even with -O0. +double cimag(double _Complex z); +double creal(double _Complex z); -- cgit v1.2.3