Skip to content

Commit

Permalink
Fix -Werror,-Wmacro-redefined in limits.h
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Alex Richardson <[email protected]>
Closes #10864
  • Loading branch information
arichardson authored Sep 1, 2020
1 parent 964791a commit 417e646
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/libspl/include/limits.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit 417e646

Please sign in to comment.