ip7z / 7zip

7-Zip
695 stars 71 forks source link

Clang/LLVM 17 can't build on Linux due to too strict warning options #20

Closed ouankou closed 6 months ago

ouankou commented 6 months ago

For 23.01, -Werror triggered a lot of compilation errors when using Clang/LLVM 17 to build Alone2 on Linux.

https://github.com/ip7z/7zip/blob/5b39dc76f1bc82f941d5c800ab9f34407a06b53a/CPP/7zip/7zip_gcc.mak#L27

I've confirmed that removing this specific option when using Clang can resolve the issue.

May I open a PR for this? The fix may be as follows.

ifneq ($(CC), xlc)
CFLAGS_WARN_WALL = -Wall -Wextra
ifndef USE_CLANG
CFLAGS_WARN_WALL += -Werror
endif
endif 
ip7z commented 6 months ago

Next version of 7-zip will be compatible with clang 17 -Werror -Wall -Wextra.

ouankou commented 6 months ago

Thanks! Then I'll close this one.

mattdm commented 6 months ago

@ouankou Since compression tools are under a microscope these days, I'll add this comment even though the issue is closed....

Removing -Werror is a dangerous choice. The -Werror causes warnings to be turned to error messages, stopping the build. New compilers often add new warnings, and usually these days it is because they get better and better at highlighting potential bugs. Rather than ignoring those, it's better to check each one and evaluate the code based on the warning given.