lib/libm: Do not force floating point type size evaluation.
Since C99, `FLT_EVAL_METHOD` should be left for the compiler/libc to define. Its redefinition breaks compilation with picolibc as the target's libc, since it defines said symbol in math.h before the libm define is evaluated by the compiler. In its place, there is a check to make sure floating point type sizes are what are expected to be, triggering a compilation error if those assumptions are no longer valid. Co-authored-by: Angus Gratton <angus@redyak.com.au> Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit is contained in:
parent
3af006efb3
commit
3613ad9624
@ -19,7 +19,10 @@
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
|
||||
#define FLT_EVAL_METHOD 0
|
||||
// These lines verify that FLT_EVAL_METHOD==0, MicroPython's libm requires this.
|
||||
// If compilation fails here then check the host compiler's FLT_EVAL_METHOD.
|
||||
typedef float float_t;
|
||||
typedef double double_t;
|
||||
|
||||
#define FORCE_EVAL(x) do { \
|
||||
if (sizeof(x) == sizeof(float)) { \
|
||||
|
@ -15,7 +15,10 @@
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
|
||||
#define FLT_EVAL_METHOD 0
|
||||
// These lines verify that FLT_EVAL_METHOD==0, MicroPython's libm requires this.
|
||||
// If compilation fails here then check the host compiler's FLT_EVAL_METHOD.
|
||||
typedef float float_t;
|
||||
typedef double double_t;
|
||||
|
||||
#define FORCE_EVAL(x) do { \
|
||||
if (sizeof(x) == sizeof(float)) { \
|
||||
|
Loading…
x
Reference in New Issue
Block a user