Clean warnings on Android under Clang

This commit is contained in:
Jeffrey Walton 2021-02-14 14:49:27 -05:00
parent 2c1d574442
commit cb6fdb715f
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
3 changed files with 23 additions and 9 deletions

View File

@ -1526,9 +1526,12 @@ ifeq ($(wildcard GNUmakefile.deps),GNUmakefile.deps)
-include GNUmakefile.deps -include GNUmakefile.deps
endif # Dependencies 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 # Cryptogams ARM asm implementation. AES needs -mthumb for Clang
aes_armv4.o : aes_armv4.S 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 # SSSE3 or NEON available
aria_simd.o : aria_simd.cpp aria_simd.o : aria_simd.cpp
@ -1612,15 +1615,15 @@ sha_simd.o : sha_simd.cpp
# Cryptogams SHA1 asm implementation. # Cryptogams SHA1 asm implementation.
sha1_armv4.o : sha1_armv4.S 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. # Cryptogams SHA256 asm implementation.
sha256_armv4.o : sha256_armv4.S 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. # Cryptogams SHA512 asm implementation.
sha512_armv4.o : sha512_armv4.S 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 sha3_simd.o : sha3_simd.cpp
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SHA3_FLAG) -c) $< $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SHA3_FLAG) -c) $<

View File

@ -882,14 +882,17 @@ ifeq ($(wildcard GNUmakefile.deps),GNUmakefile.deps)
-include GNUmakefile.deps -include GNUmakefile.deps
endif # Dependencies 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 # Cryptogams ARM asm implementation. AES needs -mthumb for Clang
aes_armv4.o : aes_armv4.S 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. # Use C++ compiler on C source after patching.
# https://github.com/weidai11/cryptopp/issues/926 # https://github.com/weidai11/cryptopp/issues/926
cpu-features.o: cpu-features.h cpu-features.c 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 # SSSE3 or NEON available
aria_simd.o : aria_simd.cpp aria_simd.o : aria_simd.cpp
@ -961,15 +964,15 @@ sha_simd.o : sha_simd.cpp
# Cryptogams SHA1 asm implementation. # Cryptogams SHA1 asm implementation.
sha1_armv4.o : sha1_armv4.S 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. # Cryptogams SHA256 asm implementation.
sha256_armv4.o : sha256_armv4.S 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. # Cryptogams SHA512 asm implementation.
sha512_armv4.o : sha512_armv4.S 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 # SSE4.2/SHA-NI or ARMv8a available
shacal2_simd.o : shacal2_simd.cpp shacal2_simd.o : shacal2_simd.cpp

View File

@ -163,6 +163,8 @@ THE_ARCH=$(tr '[:upper:]' '[:lower:]' <<< "${ANDROID_CPU}")
# consistent with Android.mk and 'APP_STL := c++_shared'. # consistent with Android.mk and 'APP_STL := c++_shared'.
case "$THE_ARCH" in case "$THE_ARCH" in
armv7*|armeabi*) armv7*|armeabi*)
#CC="clang"
#CXX="clang++"
CC="armv7a-linux-androideabi${ANDROID_API}-clang" CC="armv7a-linux-androideabi${ANDROID_API}-clang"
CXX="armv7a-linux-androideabi${ANDROID_API}-clang++" CXX="armv7a-linux-androideabi${ANDROID_API}-clang++"
LD="arm-linux-androideabi-ld" 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" ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -funwind-tables -std=c++11 -stdlib=libc++ -fexceptions -frtti"
;; ;;
armv8*|aarch64|arm64*) armv8*|aarch64|arm64*)
#CC="clang"
#CXX="clang++"
CC="aarch64-linux-android${ANDROID_API}-clang" CC="aarch64-linux-android${ANDROID_API}-clang"
CXX="aarch64-linux-android${ANDROID_API}-clang++" CXX="aarch64-linux-android${ANDROID_API}-clang++"
LD="aarch64-linux-android-ld" 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" ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -funwind-tables -std=c++11 -stdlib=libc++ -fexceptions -frtti"
;; ;;
i686|x86) i686|x86)
#CC="clang"
#CXX="clang++"
CC="i686-linux-android${ANDROID_API}-clang" CC="i686-linux-android${ANDROID_API}-clang"
CXX="i686-linux-android${ANDROID_API}-clang++" CXX="i686-linux-android${ANDROID_API}-clang++"
LD="i686-linux-android-ld" 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" ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -funwind-tables -std=c++11 -stdlib=libc++ -fexceptions -frtti"
;; ;;
x86_64|x64) x86_64|x64)
#CC="clang"
#CXX="clang++"
CC="x86_64-linux-android${ANDROID_API}-clang" CC="x86_64-linux-android${ANDROID_API}-clang"
CXX="x86_64-linux-android${ANDROID_API}-clang++" CXX="x86_64-linux-android${ANDROID_API}-clang++"
LD="x86_64-linux-android-ld" LD="x86_64-linux-android-ld"