From cb6fdb715fc8b28094a75cb2f0de7c366de06aaa Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Sun, 14 Feb 2021 14:49:27 -0500 Subject: [PATCH] Clean warnings on Android under Clang --- GNUmakefile | 11 +++++++---- GNUmakefile-cross | 13 ++++++++----- TestScripts/setenv-android.sh | 8 ++++++++ 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index e3bd459b..6ce0f623 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -1526,9 +1526,12 @@ ifeq ($(wildcard GNUmakefile.deps),GNUmakefile.deps) -include GNUmakefile.deps endif # Dependencies +# A few recipes trigger warnings for -std=c++11 and -stdlib=c++ +NOSTD_CXXFLAGS=$(filter-out -stdlib=%,$(filter-out -std=%,$(CXXFLAGS))) + # Cryptogams ARM asm implementation. AES needs -mthumb for Clang aes_armv4.o : aes_armv4.S - $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRYPTOGAMS_ARMV4_THUMB_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_THUMB_FLAG) -c) $< # SSSE3 or NEON available aria_simd.o : aria_simd.cpp @@ -1612,15 +1615,15 @@ sha_simd.o : sha_simd.cpp # Cryptogams SHA1 asm implementation. sha1_armv4.o : sha1_armv4.S - $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $< # Cryptogams SHA256 asm implementation. sha256_armv4.o : sha256_armv4.S - $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $< # Cryptogams SHA512 asm implementation. sha512_armv4.o : sha512_armv4.S - $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $< sha3_simd.o : sha3_simd.cpp $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SHA3_FLAG) -c) $< diff --git a/GNUmakefile-cross b/GNUmakefile-cross index 5948798d..04b0e538 100755 --- a/GNUmakefile-cross +++ b/GNUmakefile-cross @@ -882,14 +882,17 @@ ifeq ($(wildcard GNUmakefile.deps),GNUmakefile.deps) -include GNUmakefile.deps endif # Dependencies +# A few recipes trigger warnings for -std=c++11 and -stdlib=c++ +NOSTD_CXXFLAGS=$(filter-out -stdlib=%,$(filter-out -std=%,$(CXXFLAGS))) + # Cryptogams ARM asm implementation. AES needs -mthumb for Clang aes_armv4.o : aes_armv4.S - $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRYPTOGAMS_ARMV4_THUMB_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_THUMB_FLAG) -c) $< # Use C++ compiler on C source after patching. # https://github.com/weidai11/cryptopp/issues/926 cpu-features.o: cpu-features.h cpu-features.c - $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -c) cpu-features.c + $(CXX) -x c $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) -c) cpu-features.c # SSSE3 or NEON available aria_simd.o : aria_simd.cpp @@ -961,15 +964,15 @@ sha_simd.o : sha_simd.cpp # Cryptogams SHA1 asm implementation. sha1_armv4.o : sha1_armv4.S - $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $< # Cryptogams SHA256 asm implementation. sha256_armv4.o : sha256_armv4.S - $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $< # Cryptogams SHA512 asm implementation. sha512_armv4.o : sha512_armv4.S - $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $< # SSE4.2/SHA-NI or ARMv8a available shacal2_simd.o : shacal2_simd.cpp diff --git a/TestScripts/setenv-android.sh b/TestScripts/setenv-android.sh index 41197638..fb40ab29 100755 --- a/TestScripts/setenv-android.sh +++ b/TestScripts/setenv-android.sh @@ -163,6 +163,8 @@ THE_ARCH=$(tr '[:upper:]' '[:lower:]' <<< "${ANDROID_CPU}") # consistent with Android.mk and 'APP_STL := c++_shared'. case "$THE_ARCH" in armv7*|armeabi*) + #CC="clang" + #CXX="clang++" CC="armv7a-linux-androideabi${ANDROID_API}-clang" CXX="armv7a-linux-androideabi${ANDROID_API}-clang++" LD="arm-linux-androideabi-ld" @@ -180,6 +182,8 @@ case "$THE_ARCH" in ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -funwind-tables -std=c++11 -stdlib=libc++ -fexceptions -frtti" ;; armv8*|aarch64|arm64*) + #CC="clang" + #CXX="clang++" CC="aarch64-linux-android${ANDROID_API}-clang" CXX="aarch64-linux-android${ANDROID_API}-clang++" LD="aarch64-linux-android-ld" @@ -195,6 +199,8 @@ case "$THE_ARCH" in ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -funwind-tables -std=c++11 -stdlib=libc++ -fexceptions -frtti" ;; i686|x86) + #CC="clang" + #CXX="clang++" CC="i686-linux-android${ANDROID_API}-clang" CXX="i686-linux-android${ANDROID_API}-clang++" LD="i686-linux-android-ld" @@ -211,6 +217,8 @@ case "$THE_ARCH" in ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -funwind-tables -std=c++11 -stdlib=libc++ -fexceptions -frtti" ;; x86_64|x64) + #CC="clang" + #CXX="clang++" CC="x86_64-linux-android${ANDROID_API}-clang" CXX="x86_64-linux-android${ANDROID_API}-clang++" LD="x86_64-linux-android-ld"