Fix compilation errors on modern C compilers and CMake >= 3.28#185
Open
ludomal wants to merge 1 commit into
Open
Fix compilation errors on modern C compilers and CMake >= 3.28#185ludomal wants to merge 1 commit into
ludomal wants to merge 1 commit into
Conversation
- CMakeLists.txt, src/wmc_tool/CMakeLists.txt: Update cmake_minimum_required to VERSION 3.10...3.31 (range syntax required by CMake >= 3.28) - shiftbit.c: Pass FILE* (Fi) instead of int fd (fi) to fread() - mnru.c: Assign 0 instead of NULL to long field s->seed - endian.c: Add void return types to reverse_endian_short/long, use unsigned types in test functions to match signatures
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes compilation errors that prevent the STL from building with modern C compilers (Clang 17+, GCC 14+) and CMake >= 3.28.
Changes
CMake version policy (
CMakeLists.txt,src/wmc_tool/CMakeLists.txt)CMake 3.28+ removed compatibility with
cmake_minimum_required(VERSION)values below 3.5. The previousVERSION 3.1caused a fatal configuration error:Updated to use the range syntax
VERSION 3.10...3.31:3.10) ensures broad compatibility with systems still running older CMake (e.g., Ubuntu 20.04 ships 3.16).3.31) tells CMake which policy version the project has been tested against, preventing unexpected policy changes from newer CMake versions.src/g711/shiftbit.c- incompatible pointer to integer conversionfread()was called withfi(anintfile descriptor fromfileno()) instead ofFi(theFILE *fromfopen()). This was introduced when migrating from POSIXread()tofread()but the argument was not updated.src/mnru/mnru.c- incompatible integer to pointer conversions->seedis declared aslongbut was assignedNULL(a pointer type). Changed to0.src/unsup/endian.c- implicit int return typereverse_endian_short()andreverse_endian_long()had no return type specifier, which defaults toint(invalid in C99 and later). Added explicitvoidreturn types. Also fixed signedness mismatch intest_s()/test_l()local variables.Testing
Successfully compiled and linked (100% targets) on:
No functional changes (only type corrections and CMake version policy update).