From: Marcus Hähnel <marcus.haehnel(a)kernkonzept.com>
Clang also supports the gnu_inline attribute and the
__GNUC_STDC_INLINE__ macro (C99 semantics). However, it reports as
GCC 4.2 compatible (__GNUC_MINOR__ / __GNUC__) and thus the current
defines do not think it can support this.
Add clang as an alternative for this support. Documentation shows that
this attribute is supported since at least Clang 8.
---
Requires the features.h change that introduces the __CLANG_PREREQ macro
include/sys/cdefs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
index 9b3a02177..656548c52 100644
--- a/include/sys/cdefs.h
+++ b/include/sys/cdefs.h
@@ -320,7 +320,7 @@
inline semantics, unless -fgnu89-inline is used.
For -std=gnu99, forcing gnu_inline attribute does not change behavior,
but may silence spurious warnings (such as in GCC 4.2). */
-#if !defined __cplusplus || __GNUC_PREREQ (4,3)
+#if !defined __cplusplus || __GNUC_PREREQ (4,3) || __CLANG_PREREQ(8,0)
# if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ || defined __cplusplus
# define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
# if __GNUC_PREREQ (4,3)
--
2.43.0
From: Marcus Hähnel <marcus.haehnel(a)kernkonzept.com>
Clang also supports the gnu_inline attribute and the
__GNUC_STDC_INLINE__ macro (C99 semantics). However, it reports as
GCC 4.2 compatible (__GNUC_MINOR__ / __GNUC__) and thus the current
defines do not think it can support this.
Add clang as an alternative for this support. Documentation shows that
this attribute is supported since at least Clang 8.
---
include/sys/cdefs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
index 9b3a02177..656548c52 100644
--- a/include/sys/cdefs.h
+++ b/include/sys/cdefs.h
@@ -320,7 +320,7 @@
inline semantics, unless -fgnu89-inline is used.
For -std=gnu99, forcing gnu_inline attribute does not change behavior,
but may silence spurious warnings (such as in GCC 4.2). */
-#if !defined __cplusplus || __GNUC_PREREQ (4,3)
+#if !defined __cplusplus || __GNUC_PREREQ (4,3) || __CLANG_PREREQ(8,0)
# if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ || defined __cplusplus
# define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
# if __GNUC_PREREQ (4,3)
--
2.43.0
This can be used to guard fatures for specific clang versions.
---
include/features.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/features.h b/include/features.h
index b5d4e79f2..1a4efb9db 100644
--- a/include/features.h
+++ b/include/features.h
@@ -140,6 +140,18 @@
# define __GNUC_PREREQ(maj, min) 0
#endif
+/* Convenience macro to test the version of clang.
+ Use like this:
+ #if __CLANG_PREREQ(3,2)
+ ... code requiring clang 3.2 or later ...
+ #endif */
+#if defined __clang__
+# define __CLANG_PREREQ(maj, min) \
+ ((__clang_major__ << 16) + __clang_minor__ >= ((maj) << 16) + (min))
+#else
+# define __CLANG_PREREQ(maj, min) 0
+#endif
+
/* Whether to use feature set F. */
#define __GLIBC_USE(F) __GLIBC_USE_ ## F
--
2.43.0
Make two implicit casts from double to int explicit to silence compiler
warnings about them. The casts are required during the computation of
exponentiation.
Signed-off-by: Sven Linker <sven.linker(a)kernkonzept.com>
---
libm/e_exp.c | 2 +-
libm/s_expm1.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libm/e_exp.c b/libm/e_exp.c
index ffa556120..f694f67d1 100644
--- a/libm/e_exp.c
+++ b/libm/e_exp.c
@@ -126,7 +126,7 @@ double __ieee754_exp(double x) /* default IEEE double exp */
if(hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */
hi = x-ln2HI[xsb]; lo=ln2LO[xsb]; k = 1-xsb-xsb;
} else {
- k = invln2*x+halF[xsb];
+ k = (int32_t)(invln2*x+halF[xsb]);
t = k;
hi = x - t*ln2HI[0]; /* t*ln2HI is exact here */
lo = t*ln2LO[0];
diff --git a/libm/s_expm1.c b/libm/s_expm1.c
index 8e51ae748..85defefa4 100644
--- a/libm/s_expm1.c
+++ b/libm/s_expm1.c
@@ -159,7 +159,7 @@ double expm1(double x)
else
{hi = x + ln2_hi; lo = -ln2_lo; k = -1;}
} else {
- k = invln2*x+((xsb==0)?0.5:-0.5);
+ k = (int32_t)(invln2*x+((xsb==0)?0.5:-0.5));
t = k;
hi = x - t*ln2_hi; /* t*ln2_hi is exact here */
lo = t*ln2_lo;
--
2.43.0
The parameters are not used in the function variant without vdso
support, so tell this to the compiler to avoid a warning. Also fix the
indentation to be in-line with other functions in the file.
---
ldso/ldso/dl-vdso.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/ldso/ldso/dl-vdso.c b/ldso/ldso/dl-vdso.c
index 196cbbb3b..01309011d 100755
--- a/ldso/ldso/dl-vdso.c
+++ b/ldso/ldso/dl-vdso.c
@@ -28,14 +28,14 @@
#ifndef __VDSO_SUPPORT__
- void load_vdso(void *sys_info_ehdr, char **envp ){
+void load_vdso( void *sys_info_ehdr attribute_unused,
+ char **envp attribute_unused ){
#ifdef __SUPPORT_LD_DEBUG__
- if ( _dl_debug_vdso != 0 ){
- _dl_dprintf(2,"_dl_vdso support not enabled\n" );
- }
-
-#endif
+ if ( _dl_debug_vdso != 0 ){
+ _dl_dprintf(2,"_dl_vdso support not enabled\n" );
}
+#endif
+}
#else
void *_dl__vdso_gettimeofday = 0;
--
2.43.0