[09/11] Avoid warning from -Wbuiltin-declaration-mismatch

Message ID 20250123134308.1785777-11-aleksandar.rakic@htecgroup.com (mailing list archive)
State New
Headers
Series Improve Mips target |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 fail Patch failed to apply

Commit Message

Aleksandar Rakic Jan. 23, 2025, 1:43 p.m. UTC
  Avoid GCC 11 warning from -Wbuiltin-declaration-mismatch for modfl and
sincosl under MIPS o32 ABI.

Cherry-picked 056065bbe644d396a6fadd7c759f91bba1855bd6
from https://github.com/MIPS/glibc

Signed-off-by: Chao-ying Fu <cfu@mips.com>
Signed-off-by: Aleksandar Rakic <aleksandar.rakic@htecgroup.com>
---
 sysdeps/ieee754/dbl-64/s_modf.c   | 4 ++++
 sysdeps/ieee754/dbl-64/s_sincos.c | 4 ++++
 2 files changed, 8 insertions(+)
  

Comments

Joseph Myers Jan. 23, 2025, 4:16 p.m. UTC | #1
On Thu, 23 Jan 2025, Aleksandar Rakic wrote:

> Avoid GCC 11 warning from -Wbuiltin-declaration-mismatch for modfl and
> sincosl under MIPS o32 ABI.

This should not be needed.  math/Makefile has

CFLAGS-s_modf.c += -fno-builtin-modfl
CFLAGS-s_sincos.c += -fno-builtin-sincosl

which are supposed to avoid such warnings.  (It wouldn't surprise me if 
we're missing some such -fno-builtin-* for functions not currently 
supported as built-in functions in GCC, but if such built-in functions get 
added in future and result in glibc build failures, we can add the 
corresponding options that were previously missed - the options work fine 
even when there is no such built-in function.)
  

Patch

diff --git a/sysdeps/ieee754/dbl-64/s_modf.c b/sysdeps/ieee754/dbl-64/s_modf.c
index 0de2084caf..eda2d65b51 100644
--- a/sysdeps/ieee754/dbl-64/s_modf.c
+++ b/sysdeps/ieee754/dbl-64/s_modf.c
@@ -23,6 +23,7 @@ 
 #include <math_private.h>
 #include <libm-alias-double.h>
 #include <stdint.h>
+#include <libc-diag.h>
 
 static const double one = 1.0;
 
@@ -60,5 +61,8 @@  __modf(double x, double *iptr)
 	}
 }
 #ifndef __modf
+DIAG_PUSH_NEEDS_COMMENT;
+DIAG_IGNORE_NEEDS_COMMENT (11, "-Wbuiltin-declaration-mismatch");
 libm_alias_double (__modf, modf)
+DIAG_POP_NEEDS_COMMENT;
 #endif
diff --git a/sysdeps/ieee754/dbl-64/s_sincos.c b/sysdeps/ieee754/dbl-64/s_sincos.c
index adbc57af28..531940d4c8 100644
--- a/sysdeps/ieee754/dbl-64/s_sincos.c
+++ b/sysdeps/ieee754/dbl-64/s_sincos.c
@@ -23,6 +23,7 @@ 
 #include <fenv_private.h>
 #include <math-underflow.h>
 #include <libm-alias-double.h>
+#include <libc-diag.h>
 
 #ifndef SECTION
 # define SECTION
@@ -106,5 +107,8 @@  __sincos (double x, double *sinx, double *cosx)
   *sinx = *cosx = x / x;
 }
 #ifndef __sincos
+DIAG_PUSH_NEEDS_COMMENT;
+DIAG_IGNORE_NEEDS_COMMENT (11, "-Wbuiltin-declaration-mismatch");
 libm_alias_double (__sincos, sincos)
+DIAG_POP_NEEDS_COMMENT;
 #endif