Fix -Werror,-Wmacro-redefined in limits.h

Those macros are also defined by the compiler-provided float.h which
will be included later on (at least in the FreeBSD buildworld case) and
triggers these -Werror warnings. Including <float.h> first and only
defining the macros when DBL_DIG/FLT_DIG is missing fixes this problem.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Closes #10864
This commit is contained in:
Alexander Richardson 2020-09-02 00:22:09 +01:00 committed by GitHub
parent 964791acdc
commit 417e646722
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -25,16 +25,21 @@
*/
#include_next <limits.h>
#include <float.h>
#ifndef _LIBSPL_LIMITS_H
#define _LIBSPL_LIMITS_H
#ifndef DBL_DIG
#define DBL_DIG 15
#define DBL_MAX 1.7976931348623157081452E+308
#define DBL_MIN 2.2250738585072013830903E-308
#endif
#ifndef FLT_DIG
#define FLT_DIG 6
#define FLT_MAX 3.4028234663852885981170E+38F
#define FLT_MIN 1.1754943508222875079688E-38F
#endif
#endif /* _LIBSPL_LIMITS_H */