cmake: remove unused macros from config.h template - #231
Conversation
Six macros defined in config.h.cmake are never referenced in any C or header file in the library: CPU_IS_LITTLE_ENDIAN, HAVE_LRINT, HAVE_LRINTF, HAVE_STDINT_H, SIZEOF_INT, SIZEOF_LONG These appear to be remnants from a time when libsamplerate provided its own lrint/lrintf fallbacks and portability shims for older compilers. That code was removed, but the corresponding config.h entries were not. Also remove the if(CPU_IS_BIG_ENDIAN)/set(CPU_IS_LITTLE_ENDIAN) block from CMakeLists.txt, which existed solely to populate the now-removed CPU_IS_LITTLE_ENDIAN entry. Verified by grepping all .c and .h files under src/ and include/: none of the six symbols appear.
|
Hi, a gentle bump on this one after a few months. It's a small, self-contained change (removing unused macros from the config.h.cmake template), so happy to adjust if you'd like anything different, or let me know if it's not a priority. |
|
Sorry, just checked the first one ( |
erikd pointed out CPU_IS_LITTLE_ENDIAN is referenced across src/*.c (aiff.c, au.c, caf.c, common.c, double64.c, dwd.c, float32.c, mat4.c, mat5.c, paf.c, pcm.c, raw.c, sd2.c, sndfile.c, svx.c) - removing it would have broken the build. Confirmed the other five macros removed in this PR (HAVE_LRINT, HAVE_LRINTF, HAVE_STDINT_H, SIZEOF_INT, SIZEOF_LONG) have no remaining references anywhere else in the repo, so those stay removed.
|
You're right, sorry — I checked |
|
I am also a little concerned that before you restored Any idea why this was not caught by any of the |
Summary
Six macros defined in
config.h.cmakeare never referenced in any C or header file in the library:CPU_IS_LITTLE_ENDIANHAVE_LRINTHAVE_LRINTFHAVE_STDINT_HSIZEOF_INTSIZEOF_LONGThese appear to be remnants from when libsamplerate provided its own
lrint/lrintffallbacks and portability shims for older compilers. That code was removed, but the correspondingconfig.hentries were not.The
if(CPU_IS_BIG_ENDIAN)/set(CPU_IS_LITTLE_ENDIAN)block inCMakeLists.txtis also removed, as it existed solely to populate the now-removedCPU_IS_LITTLE_ENDIANentry.Verification
Grepped all
.cand.hfiles undersrc/andinclude/— none of the six symbols appear anywhere.Spotted while using libsamplerate as a vendored CMake submodule in an Android project; the Android Studio C/C++ unused-macro inspection flagged these in the generated
config.h.