Skip to content
  • Rolf Eike Beer's avatar
    cmELF: fix signedness warning on OpenBSD · 3022f2a1
    Rolf Eike Beer authored
    OpenBSD defines Elf64_Dyn::d_tag to be of an unsigned type, which differs from
    what most other platforms do and what is the case for 32 bit. To have the tag
    as unsigned makes sense, but this causes a compilation warning:
    
    /.../CMake/Source/cmELF.cxx: In member function 'const cmELF::StringEntry* cmELFInternalImpl<Types>::GetDynamicSectionString(int) [with Types = cmELFTypes64]':
    /.../CMake/Source/cmELF.cxx:945:   instantiated from here
    /.../CMake/Source/cmELF.cxx:668: warning: comparison between signed and unsigned integer expressions
    
    Add an explicit typedef to cast the value to for 32 and 64 bit. That type is
    unsigned and has the proper length for both platforms so no information is
    lost. Explicitely cast both arguments before comparing them to avoid the
    warning in all situations.
    3022f2a1