mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 06:58:35 +00:00
build: Fix -Wconversion warnings for fpclassify et al
closes #8274 The parent commit tries a different approach, but that fails on Apple Clang version: Apple LLVM version 10.0.0 (clang-1000.11.45.5) Target: x86_64-apple-darwin17.7.0 which somehow compiles the check_c_source_compiles() check, but then complains during later compilation that __fpclassify is not defined (regardless of "#include <math.h>").
This commit is contained in:
42
src/nvim/math.c
Normal file
42
src/nvim/math.c
Normal file
@@ -0,0 +1,42 @@
|
||||
// This is an open source non-commercial project. Dear PVS-Studio, please check
|
||||
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "nvim/math.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "math.c.generated.h"
|
||||
#endif
|
||||
|
||||
#if defined(__clang__) && __clang__ == 1 && __clang_major__ >= 6
|
||||
// Workaround glibc + Clang 6+ bug. #8274
|
||||
// https://bugzilla.redhat.com/show_bug.cgi?id=1472437
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wconversion"
|
||||
#endif
|
||||
int xfpclassify(double d)
|
||||
{
|
||||
#if defined(__MINGW32__)
|
||||
// Workaround mingw warning. #7863
|
||||
return __fpclassify(d);
|
||||
#else
|
||||
return fpclassify(d);
|
||||
#endif
|
||||
}
|
||||
int xisinf(double d)
|
||||
{
|
||||
return isinf(d);
|
||||
}
|
||||
int xisnan(double d)
|
||||
{
|
||||
#if defined(__MINGW32__)
|
||||
// Workaround mingw warning. #7863
|
||||
return _isnan(d);
|
||||
#else
|
||||
return isnan(d);
|
||||
#endif
|
||||
}
|
||||
#if defined(__clang__) && __clang__ == 1 && __clang_major__ >= 6
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
Reference in New Issue
Block a user