Skip to content

Commit 417e646

Browse files
authored
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
1 parent 964791a commit 417e646

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/libspl/include/limits.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,21 @@
2525
*/
2626

2727
#include_next <limits.h>
28+
#include <float.h>
2829

2930
#ifndef _LIBSPL_LIMITS_H
3031
#define _LIBSPL_LIMITS_H
3132

33+
#ifndef DBL_DIG
3234
#define DBL_DIG 15
3335
#define DBL_MAX 1.7976931348623157081452E+308
3436
#define DBL_MIN 2.2250738585072013830903E-308
37+
#endif
3538

39+
#ifndef FLT_DIG
3640
#define FLT_DIG 6
3741
#define FLT_MAX 3.4028234663852885981170E+38F
3842
#define FLT_MIN 1.1754943508222875079688E-38F
43+
#endif
3944

4045
#endif /* _LIBSPL_LIMITS_H */

0 commit comments

Comments
 (0)