build: Fix -Wconversion warnings for fpclassify et al

closes #8274

- Instead of #undef and re-#define, define "xfoo" wrappers to avoid
  include-order sensitivity.
- The warnings are bogus, caused by bad interaction between glibc and
  clang 6+.
  - https://bugs.llvm.org/show_bug.cgi?id=35268
  - https://bugs.llvm.org/show_bug.cgi?id=39738
  - https://bugzilla.redhat.com/show_bug.cgi?id=1472437
This commit is contained in:
Justin M. Keyes
2019-01-20 22:40:31 +01:00
parent 53c0f0bba5
commit c6a039d087
5 changed files with 40 additions and 19 deletions

View File

@@ -28,11 +28,6 @@
#include "nvim/lib/kvec.h"
#include "nvim/eval/typval_encode.h"
#ifdef __MINGW32__
# undef fpclassify
# define fpclassify __fpclassify
#endif
#define ga_concat(a, b) ga_concat(a, (char_u *)b)
#define utf_ptr2char(b) utf_ptr2char((char_u *)b)
#define utf_ptr2len(b) ((size_t)utf_ptr2len((char_u *)b))
@@ -327,7 +322,7 @@ int encode_read_from_list(ListReaderState *const state, char *const buf,
#define TYPVAL_ENCODE_CONV_FLOAT(tv, flt) \
do { \
const float_T flt_ = (flt); \
switch (fpclassify(flt_)) { \
switch (xfpclassify(flt_)) { \
case FP_NAN: { \
ga_concat(gap, (char_u *) "str2float('nan')"); \
break; \
@@ -531,7 +526,7 @@ int encode_read_from_list(ListReaderState *const state, char *const buf,
#define TYPVAL_ENCODE_CONV_FLOAT(tv, flt) \
do { \
const float_T flt_ = (flt); \
switch (fpclassify(flt_)) { \
switch (xfpclassify(flt_)) { \
case FP_NAN: { \
EMSG(_("E474: Unable to represent NaN value in JSON")); \
return FAIL; \