Skip to content

cmake: remove unused macros from config.h template#231

Open
chrisdebian wants to merge 1 commit intolibsndfile:masterfrom
chrisdebian:remove-unused-config-macros
Open

cmake: remove unused macros from config.h template#231
chrisdebian wants to merge 1 commit intolibsndfile:masterfrom
chrisdebian:remove-unused-config-macros

Conversation

@chrisdebian
Copy link
Copy Markdown

Summary

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 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.

The if(CPU_IS_BIG_ENDIAN)/set(CPU_IS_LITTLE_ENDIAN) block in CMakeLists.txt is also removed, as it existed solely to populate the now-removed CPU_IS_LITTLE_ENDIAN entry.

Verification

Grepped all .c and .h files under src/ and include/ — none of the six symbols appear anywhere.

$ grep -r "CPU_IS_LITTLE_ENDIAN\|HAVE_LRINT\|HAVE_LRINTF\|HAVE_STDINT_H\|SIZEOF_INT\|SIZEOF_LONG" src/ include/
(no output)

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant