Hi!

Since the switch to -std=gnu23 by default, float.h (included from
tsystem.h) defines INFINITY macro (to __builtin_inff ()), which now
results in a warning when compiling libgcc2.c which defines it
to something else (and, worse aarch64 compiles it with -Werror and
build fails).
libgcc2.c asserts INFINITY has the expected type which depends on
the macros with which libgcc2.c is being compiled, so guarding
the define with #ifndef INFINITY wouldn't work.
So this patch instead #undefs the macro before defining it.

I've committed this as obvious to unbreak things, if somebody has
better ideas what to do, it can be tweaked incrementally.

2024-11-16  Jakub Jelinek  <ja...@redhat.com>

        PR libgcc/117624
        * libgcc2.c (INFINITY): Add #undef before #define.

--- libgcc/libgcc2.c.jj 2024-04-19 08:44:48.210621580 +0200
+++ libgcc/libgcc2.c    2024-11-16 17:03:18.709319513 +0100
@@ -2673,6 +2673,7 @@ NAME (TYPE x, int m)
 #define isfinite(x)    __builtin_isfinite (x)
 #define isinf(x)       __builtin_isinf (x)
 
+#undef INFINITY
 #define INFINITY       CONCAT2(__builtin_huge_val, CEXT) ()
 #define I              1i
 

        Jakub

Reply via email to