| Summary: | the CMake build with GCC is far too lenient | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Benoit Pierre <benoit.pierre> |
| Component: | build | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 2.0.3 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: |
use -Wall and -Wshadow when building with CMake and GCC
use -Wl,--no-undefined when building with CMake and GCC |
||
Created attachment 1829 [details]
use -Wl,--no-undefined when building with CMake and GCC
This patch adds -Wl,--no-undefined to the linker flags when building with CMake and GCC so unresolved symbols are detected when linking the shared library version of SDL.
These patches are in! https://hg.libsdl.org/SDL/rev/39eb61ccbc82 https://hg.libsdl.org/SDL/rev/22232029f074 If you set CMAKE_REQUIRED_FLAGS, and the test fails, do you need to re-set CMAKE_REQUIRED_FLAGS to the previous value? No, you're right, it should be reset with set(CMAKE_REQUIRED_FLAGS) so has not to impact latter tests with check_c_compiler_flag (thankfully there are currently none). Okay, fixed! https://hg.libsdl.org/SDL/rev/029f8d643dbe |
Created attachment 1828 [details] use -Wall and -Wshadow when building with CMake and GCC 1. no warning compilation flags are used (-Wall, -Wshadow, ...) 2. the resulting shared library is linked without checking for missing symbols So it's possible to add some code calling a mythical SDL_foobar function, and get a successful build, with zero warnings... The attached patch add -Wall and -Werror to the GCC compilation flags when supported.