51Degrees / common-cxx

A shared functionality library that is used by 51Degrees products
Other
0 stars 6 forks source link

compilation issues with -Werror #56

Open wlallemand opened 5 hours ago

wlallemand commented 5 hours ago

Hello,

There are code issues preventing to use float.h with -Werror and -Wundef

../common-cxx/float.h:155:5: warning: "_MSC_VER" is not defined, evaluates to 0 [-Wundef]
 #if _MSC_VER || (FLT_RADIX == 2 && FLT_MANT_DIG == 24 && FLT_MAX_EXP == 128 && FLT_MIN_EXP == -125)
     ^~~~~~~~
../common-cxx/float.h:155:18: warning: "FLT_RADIX" is not defined, evaluates to 0 [-Wundef]
 #if _MSC_VER || (FLT_RADIX == 2 && FLT_MANT_DIG == 24 && FLT_MAX_EXP == 128 && FLT_MIN_EXP == -125)
                  ^~~~~~~~~

The code should use #ifdef or #if defined to check if the define exists before using it, like it's done elsewhere in the code.