weidai11 / cryptopp

free C++ class library of cryptographic schemes
https://cryptopp.com
Other
4.67k stars 1.47k forks source link

8.8.0 compilation warnings #1217

Closed jolaf closed 9 months ago

jolaf commented 1 year ago

I'm building CryptoPP 8.8.0 with CMake on Windows 10 and I see a lot of warnings (summarized below), while 8.7.0 build produces no warnings.

cpu.cpp:96:14: warning: unused function 'SigIllHandler' [-Wunused-function]
aria_simd.cpp:46:13: warning: unused function 'ARIA_BRF' [-Wunused-function]
chacha.cpp:86:13: warning: unused function 'MultiBlockSafe' [-Wunused-function]
eccrypto.cpp:58:16: warning: unused function 'ConvertToInteger' [-Wunused-function]
eccrypto.cpp:71:13: warning: function 'CheckMOVCondition' is not needed and will not be emitted [-Wunneeded-internal-declaration]
eccrypto.cpp:147:13: warning: unused function 'GetRecommendedParameters' [-Wunused-function]
donna_64.cpp:1013:1: warning: unused function 'expand_raw256_modm' [-Wunused-function]
donna_64.cpp:1279:1: warning: unused function 'ge25519_add' [-Wunused-function]
ecp.cpp:44:16: warning: unused function 'IdentityToInteger' [-Wunused-function]
lea_simd.cpp:314:16: warning: unused function 'RotateLeft<8U>' [-Wunused-function]
lea_simd.cpp:326:16: warning: unused function 'RotateRight<8U>' [-Wunused-function]
lsh256.cpp:177:13: warning: unused function 'LSH_IS_LSH512' [-Wunused-function]
lsh256.cpp:197:9: warning: unused function 'ROTL' [-Wunused-function]
rijndael.cpp:157:20: warning: unused function 'AliasedWithTable' [-Wunused-function]
lsh256_sse.cpp:160:16: warning: unused function 'loadLE32' [-Wunused-function]
lsh512_sse.cpp:166:16: warning: unused function 'loadLE64' [-Wunused-function]
lsh512_sse.cpp:170:9: warning: unused function 'ROTL64' [-Wunused-function]
simon128_simd.cpp:344:9: warning: unused function 'RotateRight64<8U>' [-Wunused-function]
xts.cpp:47:6: warning: unused function 'Modes_TestInstantiations' [-Wunused-function]
rijndael.cpp:157:20: warning: unused function 'AliasedWithTable' [-Wunused-function]
sm4_simd.cpp:162:16: warning: unused function 'UnpackXMM<0U>' [-Wunused-function]
sm4_simd.cpp:282:13: warning: unused function 'SM4_Dec_4_Blocks' [-Wunused-function]
sm4_simd.cpp:298:13: warning: unused function 'SM4_Dec_Block' [-Wunused-function]

sharkbox.cpp:50:1: warning: suggest braces around initialization of subobject [-Wmissing-braces]
sharkbox.cpp:307:1: warning: suggest braces around initialization of subobject [-Wmissing-braces]
sharkbox.cpp:564:1: warning: suggest braces around initialization of subobject [-Wmissing-braces]
sharkbox.cpp:821:1: warning: suggest braces around initialization of subobject [-Wmissing-braces]
sharkbox.cpp:1078:1: warning: suggest braces around initialization of subobject [-Wmissing-braces]
sharkbox.cpp:1335:1: warning: suggest braces around initialization of subobject [-Wmissing-braces]
sharkbox.cpp:1592:1: warning: suggest braces around initialization of subobject [-Wmissing-braces]
sharkbox.cpp:1849:1: warning: suggest braces around initialization of subobject [-Wmissing-braces]
sharkbox.cpp:2109:1: warning: suggest braces around initialization of subobject [-Wmissing-braces]
sharkbox.cpp:2366:1: warning: suggest braces around initialization of subobject [-Wmissing-braces]
sharkbox.cpp:2623:1: warning: suggest braces around initialization of subobject [-Wmissing-braces]
sharkbox.cpp:2880:1: warning: suggest braces around initialization of subobject [-Wmissing-braces]
sharkbox.cpp:3137:1: warning: suggest braces around initialization of subobject [-Wmissing-braces]
sharkbox.cpp:3394:1: warning: suggest braces around initialization of subobject [-Wmissing-braces]
sharkbox.cpp:3651:1: warning: suggest braces around initialization of subobject [-Wmissing-braces]
sharkbox.cpp:3908:1: warning: suggest braces around initialization of subobject [-Wmissing-braces]

tftables.cpp:63:2: warning: suggest braces around initialization of subobject [-Wmissing-braces]
tftables.cpp:128:2: warning: suggest braces around initialization of subobject [-Wmissing-braces]
tftables.cpp:193:2: warning: suggest braces around initialization of subobject [-Wmissing-braces]
tftables.cpp:258:2: warning: suggest braces around initialization of subobject [-Wmissing-braces]
noloader commented 1 year ago

What compiler are you using? What is the compile command used?

Shooting from the hip it looks like you should add /wd4514 to your command line. Our cryptest.nmake file also uses /W4 /wd4231 /wd4511 /wd4156.

jolaf commented 1 year ago

Compiler:

C:\> C:\Users\User\AppData\Local\Android\Sdk\ndk\25.2.9519653\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe -v
Android (9352603, based on r450784d1) clang version 14.0.7 (https://android.googlesource.com/toolchain/llvm-project 4c603efb0cca074e9238af8b4106c30add4418f6)
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/Users/User/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin  
jolaf commented 1 year ago

Command line:

C:\Users\User\AppData\Local\Android\Sdk\ndk\25.2.9519653\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe
--target=armv7-none-linux-androideabi24
--sysroot=C:/Users/User/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot
-DCRYPTOPP_DISABLE_MIXED_ASM
-IC:/Users/User/AppData/Local/Android/Sdk/ndk/25.2.9519653/sources/android/cpufeatures
-Wall
-fvisibility=hidden
-g
-DANDROID
-fdata-sections
-ffunction-sections
-funwind-tables
-fstack-protector-strong
-no-canonical-prefixes
-D_FORTIFY_SOURCE=2
-march=armv7-a
-mthumb
-Wformat
-Werror=format-security
-fvisibility=hidden
-D_DEBUG
-fno-limit-debug-info
-fPIC
-MD
-MT cryptopp.cmake/CMakeFiles/cryptopp-object.dir/.../cryptopp/cpu.cpp.o
-MF cryptopp.cmake\CMakeFiles\cryptopp-object.dir\...\cryptopp\cpu.cpp.o.d
-o cryptopp.cmake/CMakeFiles/cryptopp-object.dir/.../cryptopp/cpu.cpp.o
-c cryptopp/cpu.cpp
noloader commented 1 year ago

Andoid's NDK does not use -Wall. You should remove it, or add -Wno-unused-function to your command line.

jolaf commented 1 year ago

Thanks, that helped!