[PATCH v2 0/6] Compile glibc tests with Clang

H.J. Lu hjl.tools@gmail.com
Sun Dec 22 21:11:57 GMT 2024


Changes in v2:

1. Define

#ifdef __clang__
# define __attribute_optimization_barrier__ __attribute__ ((optnone))
#else
# define __attribute_optimization_barrier__ __attribute__ ((noinline, noclone))
#endif

and replace every

__attribute__ ((noinline, noclone))

with

__attribute_optimization_barrier__

2. Update the commit message for "stdio: Suppress -Wformat only for gcc".
3. Clean up the commit message for "Suppress Clang -Wimplicit-fallthrough warnings".
4. Add a reference to Clang /usr/include/tgmath.h dependency.
5. Add a configure check for -Wno-fortify-source to suppress Clang
warnings.
6. Add -Wno-fortify-source to Makefile for stdio-common/scanf13.c.

---
This patch set, some of patches are from azanella/clang branch with and
without modifications, allows compiling glibc tests with Clang.  Some
tests are disabled for Clang:

1. Tests require glibc <tgmath.h>.
2. Tests require C23 support.
3. Tests require libmvec ABI support.
4. Tests require trampoline.
5. Tests require STB_GNU_UNIQUE.
6. X86-64 tests require -mfpmath=387.

The goal is to compile glibc tests without any compile-time errors using
Clang 19.  It isn't a goal to compile glibc tests without any run-time
errors using Clang 19.  The current known Clang failures are:

FAIL: conform/ISO11/inttypes.h/conform
FAIL: conform/ISO11/stdint.h/conform
FAIL: conform/ISO11/tgmath.h/conform
FAIL: conform/ISO99/inttypes.h/conform
FAIL: conform/ISO99/stdint.h/conform
FAIL: conform/ISO99/tgmath.h/conform
FAIL: conform/POSIX2008/inttypes.h/conform
FAIL: conform/POSIX2008/stdint.h/conform
FAIL: conform/POSIX2008/tgmath.h/conform
FAIL: conform/XOPEN2K/inttypes.h/conform
FAIL: conform/XOPEN2K/stdint.h/conform
FAIL: conform/XOPEN2K/tgmath.h/conform
FAIL: conform/XOPEN2K8/inttypes.h/conform
FAIL: conform/XOPEN2K8/stdint.h/conform
FAIL: conform/XOPEN2K8/tgmath.h/conform
FAIL: elf/ifuncmain1static
FAIL: elf/ifuncmain4
FAIL: elf/ifuncmain4static
FAIL: elf/ifuncmain6pie
FAIL: elf/ifuncmain7
FAIL: elf/ifuncmain7pic
FAIL: elf/ifuncmain7picstatic
FAIL: elf/ifuncmain7pie
FAIL: elf/ifuncmain7static
FAIL: math/test-float128-isgreater
FAIL: math/test-float128-isgreaterequal
FAIL: math/test-float128-isless
FAIL: math/test-float128-islessequal
FAIL: math/test-float64x-fpclassify
FAIL: math/test-ldouble-fpclassify
FAIL: math/test-tgmath
FAIL: math/test-tgmath2
FAIL: stdio-common/tst-vfprintf-user-type


Adhemerval Zanella (2):
  include/sys/cdefs.h: Add __attribute_optimization_barrier__
  stdio: Suppress -Wformat only for gcc in tst-sprintf-errno.c

H.J. Lu (4):
  Suppress Clang -Wimplicit-fallthrough warnings
  Add a reference to Clang /usr/include/tgmath.h dependency
  string: Suppress Clang warnings on tester.c
  stdio-common: Suppress Clang warnings on scanf13.c

 Makerules                                     |  1 +
 benchtests/bench-hash-funcs-kernel.h          |  4 +--
 benchtests/bench-hash-funcs.c                 |  2 +-
 benchtests/bench-strchr.c                     |  4 +--
 configure                                     | 34 +++++++++++++++++++
 configure.ac                                  | 10 ++++++
 debug/tst-backtrace.h                         |  2 +-
 debug/tst-ssp-1.c                             |  2 +-
 elf/tst-align2.c                              |  4 +++
 elf/tst-p_alignmod-base.c                     |  2 +-
 gmon/tst-gmon.c                               |  8 +++--
 gmon/tst-mcount-overflow.c                    | 10 +++---
 include/sys/cdefs.h                           |  7 ++++
 malloc/tst-malloc-thread-exit.c               |  2 +-
 malloc/tst-malloc-thread-fail.c               |  2 +-
 malloc/tst-mallocstate.c                      |  2 +-
 misc/tst-syscalls.c                           | 14 ++++----
 misc/tst-tsearch.c                            |  4 +++
 nptl/tst-minstack-throw.cc                    |  8 ++---
 nptl/tst-thread-exit-clobber.cc               | 12 +++----
 nptl/tst-thread_local1.cc                     | 12 +++----
 stdio-common/Makefile                         |  2 ++
 stdio-common/scanf13.c                        |  9 +++++
 stdio-common/tst-sprintf-errno.c              |  2 +-
 stdlib/tst-makecontext-align.c                | 20 +++++------
 stdlib/tst-quick_exit.cc                      |  2 +-
 stdlib/tst-setcontext10.c                     |  6 ++--
 stdlib/tst-setcontext11.c                     |  2 +-
 stdlib/tst-setcontext5.c                      |  4 +--
 stdlib/tst-setcontext8.c                      |  2 +-
 stdlib/tst-setcontext9.c                      |  2 +-
 stdlib/tst-swapcontext1.c                     |  8 ++---
 stdlib/tst-swapcontext2.c                     |  8 ++---
 stdlib/tst-thread-quick_exit.cc               |  2 +-
 string/Makefile                               |  7 ++--
 string/tst-xbzero-opt.c                       |  2 +-
 sysdeps/generic/tst-stack-align.h             |  2 +-
 .../sysv/linux/x86_64/tst-cet-property-2.c    |  2 +-
 .../sysv/linux/x86_64/tst-cet-setcontext-1.c  |  2 +-
 .../unix/sysv/linux/x86_64/tst-cet-vfork-1.c  |  2 +-
 .../sysv/linux/x86_64/tst-gnu2-tls2-amx.c     |  2 +-
 sysdeps/x86/tst-ldbl-nonnormal-printf.c       |  2 +-
 sysdeps/x86/tst-memchr-rtm.c                  |  4 +--
 sysdeps/x86/tst-memcmp-rtm.c                  |  4 +--
 sysdeps/x86/tst-memmove-rtm.c                 |  4 +--
 sysdeps/x86/tst-memrchr-rtm.c                 |  4 +--
 sysdeps/x86/tst-memset-rtm.c                  |  4 +--
 sysdeps/x86/tst-strchr-rtm.c                  |  4 +--
 sysdeps/x86/tst-strcmp-rtm.c                  |  4 +--
 sysdeps/x86/tst-strcpy-rtm.c                  |  4 +--
 sysdeps/x86/tst-strlen-rtm.c                  |  4 +--
 sysdeps/x86/tst-strncmp-rtm.c                 |  8 ++---
 sysdeps/x86/tst-strrchr-rtm.c                 |  4 +--
 sysdeps/x86_64/tst-rsi-strlen.c               |  2 +-
 54 files changed, 182 insertions(+), 104 deletions(-)

-- 
2.47.1



More information about the Libc-alpha mailing list