aws / s2n-tls

An implementation of the TLS/SSL protocols
https://aws.github.io/s2n-tls/usage-guide/
Apache License 2.0
4.53k stars 711 forks source link

cmake and make run feature tests with different flags #4187

Open lrstewart opened 1 year ago

lrstewart commented 1 year ago

Problem:

It looks like make is running the feature tests with the same flags it uses for real compilation, while cmake isn't. That makes the cmake feature tests much more lenient, and leads to some feature tests only failing in make.

For example, cmake runs:

/nix/store/a12yx0i0xh7i39bahq13jhmfplmn69ar-gcc-wrapper-11.3.0/bin/gcc   -c -Werror-implicit-function-declaration -Wno-unused-variable -o CMakeFiles/cmTC_f9a67.dir/S2N_LINUX_SENDFILE.c.o -c /home/ubuntu/s2n-tls/tests/features/S2N_LINUX_SENDFILE.c

While make runs:

cc -std=c99 -Wcast-qual -pedantic -Wall -Werror -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow  -Wcast-align -Wwrite-strings -fPIC -Wno-missing-braces -D_POSIX_C_SOURCE=200809L -O2 -I/home/ubuntu/s2n-tls/libcrypto-root/include/ -I/home/ubuntu/s2n-tls/api/ -I/home/ubuntu/s2n-tls -Wno-deprecated-declarations -Wno-unknown-pragmas -Wformat-security -D_FORTIFY_SOURCE=2 -fgnu89-inline -fvisibility=hidden -DS2N_EXPORTS -Wstack-protector -fstack-protector-all $(cat tests/features/GLOBAL.flags) $(cat tests/features/S2N_LINUX_SENDFILE.flags) -c -o tmp.o tests/features/S2N_LINUX_SENDFILE.c

Solution:

I'm not sure which behavior is preferable, but we should be consistent. This would also be solved by just finishing the migration from make to cmake.

Requirements / Acceptance Criteria:

What must a solution address in order to solve the problem? How do we know the solution is complete?

Out of scope:

Is there anything the solution will intentionally NOT address?

boquan-fang commented 1 month ago

I observed that CMake wouldn't error on -Wimplicit-function-declaration flag, but Makefile will error on that. Check PR#4816 for details.