cr-marcstevens / sha1collisiondetection

Library and command line tool to detect SHA-1 collision in a file
Other
1.31k stars 185 forks source link

Don't use gcc-specific compilerflags if not using gcc #41

Closed MrShark closed 2 months ago

MrShark commented 6 years ago

Makes compilation using xlc on AIX (and likely other compilers) not warn so much.

shumow commented 6 years ago

Hi @MrShark, thanks for looking at this.

If you check the build logs for your job, you can see that the command line parameters for both clang and gcc are only "-Ilib" dropping the "-O2 -Wall -Werror -Wextra -pedantic -std=c90" So I think that the logic you put in to check for gcc is incorrect.

Also, I don't think that checking for gcc only is what we want, as we want to support compiling with clang, which matches all the gcc parameters.

MrShark commented 6 years ago

Ahh, sorry. I only checked this patch on AIX. I will have a look att it (and also try to fix some other gnu-isms I found in make clean)

cr-marcstevens commented 6 years ago

Since a lot of common compilers allow for these gnu-isms, can you make it check for the specific non-supporting compiler?

BTW Which of the compiler options specifically cause issues? E.g., -Ilib, -O2 and -std=c90 are more important than -W* and -pedantic.

MrShark commented 6 years ago

A new patch: 4b0064d5abb218f2fa3b2282fb0ce4bed1749a1e

gmake apperently sets CC to cc by default, making the detection code from the manual void :-(

Well, well I added code to detect if gcc or clang is installed and then if $CC is cc use them, currently preferring clang if both are installed. This approach messes up if you have an other compiler installed as cc without an alias alongside gcc/clang and want to use cc for compilation (but probably not worse then before).

MrShark commented 2 months ago

Cleaning up among my old pull requests, I no longer have access to AIX systems to test this out on.