From patchwork Sun Dec 22 21:11:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 103625 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 48C3C385840B for ; Sun, 22 Dec 2024 21:14:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 48C3C385840B Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=b49YWEv0 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id 273A73858420 for ; Sun, 22 Dec 2024 21:12:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 273A73858420 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 273A73858420 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::435 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734901941; cv=none; b=x0Xx+1Tync0UrD1FDzlWZp9Sn5Fv+kvWALdxtjQ/b8cEd3V4XFvYW0Aa3kpGmWzFGKLejS5GZjgOLmOHSoySeEZ1g3hkKG27jrv0+ImjBau9f44YMC9DCwnIn+e/VJdyGadTaurB/WqFDQEhABmySyG4aaUPY8xqmyj9pOjo3Sg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734901941; c=relaxed/simple; bh=ZBR2n1dOEeLi02IQEiHg5aLxwBozmckUMUUXgmYCgBw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=b1gIadscKcrm+BwHjlQKLraCGBbW5FdbeJbZneDHR78+4EYOMUvKcF33cHQan4csegS/rTWiO+a2MPfpBp+qClXNBn7Z6UhPBHLxEL4e0V1I3P3gs9dyWY5Cw7XqGBdVdSOB7Oy1LpjpBS1V4uhzPIF83FhQ+7rpYxIvudZ7dmE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-725d9f57d90so2606353b3a.1 for ; Sun, 22 Dec 2024 13:12:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734901940; x=1735506740; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r5g8xfNMEO1nMN9UTvoU5kYvsFHlRPZ1WmySe7gxE5Y=; b=b49YWEv0vuMLHC5c2yrHAmzAUvwyAv6FZKdJ29VNsSrcuqNMjDdvGJ8I3qPn/+jrqA HX+CYrERexAYwZUL+93iy5ElHXW7HwGimV3aq4BH0RN6vlHBn0JhTG9ujc6vzkT9/UkO nPAEbG0gack9XeX4QtKDMa0eMP1k+zSm+oXJZKUXyJCvHGVSQVhc6ng34SrRblTloWx8 cXCSr49LLQ4fReRu1A/VmXm/dX1zdRbasfthiKGtIoSwh+5vklhWmcYTIhMBTquj30i+ Tuc9/rZr5d4FpqtmRR8nVh9OXNb6k+BTM2QnQ2pSwnV+PqWkBBVNpnw2lY0EUPqzW6Vy RVUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734901940; x=1735506740; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r5g8xfNMEO1nMN9UTvoU5kYvsFHlRPZ1WmySe7gxE5Y=; b=j/rYWqtJaRj6fbN/8caH3WphFjoO54u6M9j45ZQth3KiC/1C+PYgu207OvdDOKBc4C MT7aNdrxrIZhXO5nqT8LcahIHifrLeHwmURmZnsgVCruR2bVGncDOx8J6lrrXBxG9FSQ dR67kUtDoesz3ZeUz5nbkHQlhbBaNaokKURnlOgR6wPshjpp/gxQuLb/czMyt34L7eHi 1xnwJcV6+xvl1am9reQf7ln8dXemqGQTbJs1R6ntkWX5ukjm5RnelUlJjqYR+qdj3c35 dpLp3UTOgqKHWz9GQTzKisBghFanY87oBAU3hToCgbDT8wPoKe8PeWkrUVkACjGApRbC oNQw== X-Gm-Message-State: AOJu0Yz2pFlQOYyUAOZ9ZnKhmqQAvNK9mqgZdmV+PvdfY0h+JEQf3Los g/V9aii22LE1wVB9m4vSPB1LVwcs0WJGDL2MDNsFTFvHTNDytdxn X-Gm-Gg: ASbGnctDC3JO4CAmC1895PVu/9Urawq5TJOuXYWRo84wD758mpCm1bBegxas6qxzlyZ KJf+iJ6M4V1svIA6EEHhGtpiQ5HFf5UrEBLHGpZ0VOagGfEbeHblwuVfUQv7J5m61arzwtXJlDA ZXwCog+zTmy+l6FD1TcrlbezIu05Rx4e2hoMGHF4Ycq2N4sRUO8X9d3e427iPl1oYGgNUfJ1PUv xchFaqd+NncDOoKe2YHaUlrtddRb5fkUIxJMb4R3BCrm8X4Mb7etuUvBfUtikB/huFaRHU= X-Google-Smtp-Source: AGHT+IHY9haOO1GLnVg3LSpqso8neTx2wON9F+ceduaIz18DH6FPkVSKkAQxKoThxmaufpozZogaSQ== X-Received: by 2002:a05:6a00:a86:b0:728:e27c:a9bc with SMTP id d2e1a72fcca58-72abdd8c46fmr15340416b3a.7.1734901939772; Sun, 22 Dec 2024 13:12:19 -0800 (PST) Received: from gnu-tgl-3.localdomain ([120.204.185.181]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8fb8f5sm6736485b3a.146.2024.12.22.13.12.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Dec 2024 13:12:19 -0800 (PST) Received: from gnu-tgl-3.lan (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id 80392C028D; Mon, 23 Dec 2024 05:12:15 +0800 (CST) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: sam@gentoo.org, schwab@linux-m68k.org, Adhemerval Zanella Subject: [PATCH v2 1/6] include/sys/cdefs.h: Add __attribute_optimization_barrier__ Date: Mon, 23 Dec 2024 05:11:58 +0800 Message-ID: <20241222211203.66704-2-hjl.tools@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241222211203.66704-1-hjl.tools@gmail.com> References: <20241222211203.66704-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3019.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org From: Adhemerval Zanella Add __attribute_optimization_barrier__ to disable inlining and cloning on a function. For Clang, expand it to __attribute__ ((optnone)) Otherwise, expand it to __attribute__ ((noinline, clone)) Co-Authored-By: H.J. Lu Reviewed-by: Sam James --- benchtests/bench-hash-funcs-kernel.h | 4 ++-- benchtests/bench-hash-funcs.c | 2 +- benchtests/bench-strchr.c | 4 ++-- debug/tst-backtrace.h | 2 +- debug/tst-ssp-1.c | 2 +- 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 ++++++------- nptl/tst-minstack-throw.cc | 8 ++++---- nptl/tst-thread-exit-clobber.cc | 12 +++++------ nptl/tst-thread_local1.cc | 12 +++++------ 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/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 +- 45 files changed, 112 insertions(+), 101 deletions(-) diff --git a/benchtests/bench-hash-funcs-kernel.h b/benchtests/bench-hash-funcs-kernel.h index 7eaa3665b6..3e58fde084 100644 --- a/benchtests/bench-hash-funcs-kernel.h +++ b/benchtests/bench-hash-funcs-kernel.h @@ -35,7 +35,7 @@ #define PRIMITIVE_CAT(x, y) x ## y #define CAT(x, y) PRIMITIVE_CAT (x, y) -static double __attribute__ ((noinline, noclone)) +static double __attribute_optimization_barrier__ CAT (do_one_test_kernel, POSTFIX) (const char *s, size_t len) { @@ -58,7 +58,7 @@ CAT (do_one_test_kernel, POSTFIX) (const char *s, size_t len) return (double) cur / (double) NFIXED_ITERS; } -static double __attribute__ ((noinline, noclone)) +static double __attribute_optimization_barrier__ CAT (do_rand_test_kernel, POSTFIX) (char const *bufs, unsigned int const *sizes) { diff --git a/benchtests/bench-hash-funcs.c b/benchtests/bench-hash-funcs.c index 8dd88c9e39..3d15029278 100644 --- a/benchtests/bench-hash-funcs.c +++ b/benchtests/bench-hash-funcs.c @@ -67,7 +67,7 @@ do_one_test (json_ctx_t *json_ctx, size_t len) json_element_object_end (json_ctx); } -static void __attribute__ ((noinline, noclone)) +static void __attribute_optimization_barrier__ do_rand_test (json_ctx_t *json_ctx) { size_t i, sz, offset; diff --git a/benchtests/bench-strchr.c b/benchtests/bench-strchr.c index eed6882085..fed3b9b223 100644 --- a/benchtests/bench-strchr.c +++ b/benchtests/bench-strchr.c @@ -92,7 +92,7 @@ IMPL (generic_strchrnul, 0) branch coming we want to test the case where a potential branch in strchr can be used to skip a later mispredict because of the relationship between the two branches. */ -static void __attribute__ ((noinline, noclone)) +static void __attribute_optimization_barrier__ do_one_rand_plus_branch_test (json_ctx_t *json_ctx, impl_t *impl, const CHAR *s, const CHAR *c) { @@ -117,7 +117,7 @@ do_one_rand_plus_branch_test (json_ctx_t *json_ctx, impl_t *impl, json_element_double (json_ctx, (double)cur / (double)iters); } -static void __attribute__ ((noinline, noclone)) +static void __attribute_optimization_barrier__ do_one_rand_test (json_ctx_t *json_ctx, impl_t *impl, const CHAR *s, const CHAR *c) { diff --git a/debug/tst-backtrace.h b/debug/tst-backtrace.h index 53239dad59..0ed38b6892 100644 --- a/debug/tst-backtrace.h +++ b/debug/tst-backtrace.h @@ -33,7 +33,7 @@ volatile int x; /* Use this attribute to prevent inlining, so that all expected frames are present. */ -#define NO_INLINE __attribute__ ((noinline, noclone, weak)) +#define NO_INLINE __attribute__ ((weak)) __attribute_optimization_barrier__ /* Look for a match in SYM from backtrace_symbols to NAME, a fragment of a function name. Ignore the filename before '(', but presume diff --git a/debug/tst-ssp-1.c b/debug/tst-ssp-1.c index a1e4fb0630..2c8861ae59 100644 --- a/debug/tst-ssp-1.c +++ b/debug/tst-ssp-1.c @@ -21,7 +21,7 @@ #include static void -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ test (char *foo) { int i; diff --git a/elf/tst-p_alignmod-base.c b/elf/tst-p_alignmod-base.c index d6930b9f16..23b20f12db 100644 --- a/elf/tst-p_alignmod-base.c +++ b/elf/tst-p_alignmod-base.c @@ -26,7 +26,7 @@ int foo __attribute__ ((aligned (ALIGN))) = 1; bool -__attribute__ ((weak, noclone, noinline)) +__attribute__ ((weak)) __attribute_optimization_barrier__ is_aligned_p (void *p, int align) { return (((uintptr_t) p) & (align - 1)) == 0; diff --git a/gmon/tst-gmon.c b/gmon/tst-gmon.c index 9de4e7f85f..eca8246a5c 100644 --- a/gmon/tst-gmon.c +++ b/gmon/tst-gmon.c @@ -16,15 +16,17 @@ License along with the GNU C Library; if not, see . */ +#include + /* This program does not use the test harness because we want tight control over the call graph. */ -__attribute__ ((noinline, noclone, weak)) void +__attribute__ ((weak)) __attribute_optimization_barrier__ void f1 (void) { } -__attribute__ ((noinline, noclone, weak)) void +__attribute__ ((weak)) __attribute_optimization_barrier__ void f2 (void) { f1 (); @@ -32,7 +34,7 @@ f2 (void) asm volatile (""); } -__attribute__ ((noinline, noclone, weak)) void +__attribute__ ((weak)) __attribute_optimization_barrier__ void f3 (int count) { for (int i = 0; i < count; ++i) diff --git a/gmon/tst-mcount-overflow.c b/gmon/tst-mcount-overflow.c index 0e60f7e2e6..a681872bf7 100644 --- a/gmon/tst-mcount-overflow.c +++ b/gmon/tst-mcount-overflow.c @@ -16,6 +16,8 @@ License along with the GNU C Library; if not, see . */ +#include + /* Program with sufficiently complex, yet pointless, call graph that it will trigger an mcount overflow, when you set the minarcs/maxarcs tunables to very low values. */ @@ -31,12 +33,12 @@ /* Defines 16 leaf functions named f1_0 to f1_15 */ #define REP(n) \ - __attribute__ ((noinline, noclone, weak)) void f1_##n (void) {}; + __attribute__ ((weak)) __attribute_optimization_barrier__ void f1_##n (void) {}; REPS #undef REP /* Calls all 16 leaf functions f1_* in succession */ -__attribute__ ((noinline, noclone, weak)) void +__attribute__ ((weak)) __attribute_optimization_barrier__ void f2 (void) { # define REP(n) f1_##n(); @@ -47,12 +49,12 @@ f2 (void) /* Defines 16 functions named f2_0 to f2_15, which all just call f2 */ #define REP(n) \ - __attribute__ ((noinline, noclone, weak)) void \ + __attribute__ ((weak)) __attribute_optimization_barrier__ void \ f2_##n (void) { f2(); PREVENT_TAIL_CALL; }; REPS #undef REP -__attribute__ ((noinline, noclone, weak)) void +__attribute__ ((weak)) __attribute_optimization_barrier__ void f3 (int count) { for (int i = 0; i < count; ++i) diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h index b84ad34a70..a676f75f62 100644 --- a/include/sys/cdefs.h +++ b/include/sys/cdefs.h @@ -56,4 +56,11 @@ rtld_hidden_proto (__chk_fail) #endif /* !defined _ISOMAC */ +/* Prevents a function from being considered for inlining and cloning. */ +#ifdef __clang__ +# define __attribute_optimization_barrier__ __attribute__ ((optnone)) +#else +# define __attribute_optimization_barrier__ __attribute__ ((noinline, noclone)) +#endif + #endif diff --git a/malloc/tst-malloc-thread-exit.c b/malloc/tst-malloc-thread-exit.c index aec3897087..269abcea8c 100644 --- a/malloc/tst-malloc-thread-exit.c +++ b/malloc/tst-malloc-thread-exit.c @@ -42,7 +42,7 @@ static int inner_thread_count = 4; static size_t malloc_size = 32; static void -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ unoptimized_free (void *ptr) { free (ptr); diff --git a/malloc/tst-malloc-thread-fail.c b/malloc/tst-malloc-thread-fail.c index f698871876..56553dd299 100644 --- a/malloc/tst-malloc-thread-fail.c +++ b/malloc/tst-malloc-thread-fail.c @@ -33,7 +33,7 @@ /* Wrapper for calloc with an optimization barrier. */ static void * -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ allocate_zeroed (size_t a, size_t b) { return calloc (a, b); diff --git a/malloc/tst-mallocstate.c b/malloc/tst-mallocstate.c index f72e1a1b28..3664fcda01 100644 --- a/malloc/tst-mallocstate.c +++ b/malloc/tst-mallocstate.c @@ -366,7 +366,7 @@ full_heap_check (void) } /* Used as an optimization barrier to force a heap allocation. */ -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static void my_free (void *ptr) { diff --git a/misc/tst-syscalls.c b/misc/tst-syscalls.c index d060b125c9..ac1e1014e1 100644 --- a/misc/tst-syscalls.c +++ b/misc/tst-syscalls.c @@ -37,7 +37,7 @@ struct Array static int error_count; -__attribute__ ((noclone, noinline)) +__attribute_optimization_barrier__ struct Array allocate (size_t bytes) { @@ -52,7 +52,7 @@ allocate (size_t bytes) return __extension__ (struct Array) {bytes, p}; } -__attribute__ ((noclone, noinline)) +__attribute_optimization_barrier__ void deallocate (struct Array b) { @@ -66,7 +66,7 @@ deallocate (struct Array b) } } -__attribute__ ((noclone, noinline)) +__attribute_optimization_barrier__ void * do_mmap (void *addr, size_t length) { @@ -74,7 +74,7 @@ do_mmap (void *addr, size_t length) MAP_PRIVATE | MAP_ANON, -1, 0); } -__attribute__ ((noclone, noinline)) +__attribute_optimization_barrier__ void * reallocate (struct Array b) { @@ -86,7 +86,7 @@ reallocate (struct Array b) return NULL; } -__attribute__ ((noclone, noinline)) +__attribute_optimization_barrier__ void protect (struct Array b) { @@ -104,7 +104,7 @@ protect (struct Array b) } } -__attribute__ ((noclone, noinline)) +__attribute_optimization_barrier__ ssize_t do_read (int fd, void *ptr, struct Array b) { @@ -116,7 +116,7 @@ do_read (int fd, void *ptr, struct Array b) return 0; } -__attribute__ ((noclone, noinline)) +__attribute_optimization_barrier__ ssize_t do_write (int fd, void *ptr, struct Array b) { diff --git a/nptl/tst-minstack-throw.cc b/nptl/tst-minstack-throw.cc index b729091ec4..ff0d3d39da 100644 --- a/nptl/tst-minstack-throw.cc +++ b/nptl/tst-minstack-throw.cc @@ -24,7 +24,7 @@ #include /* Throw a std::runtime_exception. */ -__attribute__ ((noinline, noclone, weak)) +__attribute__ ((weak)) __attribute_optimization_barrier__ void do_throw_exception () { @@ -38,17 +38,17 @@ struct class_with_destructor ~class_with_destructor (); }; -__attribute__ ((noinline, noclone, weak)) +__attribute__ ((weak)) __attribute_optimization_barrier__ class_with_destructor::class_with_destructor () { } -__attribute__ ((noinline, noclone, weak)) +__attribute__ ((weak)) __attribute_optimization_barrier__ class_with_destructor::~class_with_destructor () { } -__attribute__ ((noinline, noclone, weak)) +__attribute__ ((weak)) __attribute_optimization_barrier__ void function_with_destructed_object () { diff --git a/nptl/tst-thread-exit-clobber.cc b/nptl/tst-thread-exit-clobber.cc index b3b6989268..9a50848ef8 100644 --- a/nptl/tst-thread-exit-clobber.cc +++ b/nptl/tst-thread-exit-clobber.cc @@ -73,7 +73,7 @@ enum { no_check = -1 }; /* Check that VALUE is the magic value for INDEX, behind a compiler barrier. */ -__attribute__ ((noinline, noclone, weak)) +__attribute__ ((weak)) __attribute_optimization_barrier__ void check_magic (int index, unsigned int value) { @@ -103,7 +103,7 @@ check_magic (int index, unsigned int value) /* Check that VALUE is the magic value for INDEX, behind a compiler barrier. Double variant. */ -__attribute__ ((noinline, noclone, weak)) +__attribute__ ((weak)) __attribute_optimization_barrier__ void check_magic (int index, double value) { @@ -153,7 +153,7 @@ struct checker call_pthread_exit are used to call pthread_exit indirectly, with the intent of clobbering the register values. */ -__attribute__ ((noinline, noclone, weak)) +__attribute__ ((weak)) __attribute_optimization_barrier__ void call_pthread_exit_0 (const values *pvalues) { @@ -166,7 +166,7 @@ call_pthread_exit_0 (const values *pvalues) pthread_exit (NULL); } -__attribute__ ((noinline, noclone, weak)) +__attribute__ ((weak)) __attribute_optimization_barrier__ void call_pthread_exit_1 (const values *pvalues) { @@ -180,7 +180,7 @@ call_pthread_exit_1 (const values *pvalues) call_pthread_exit_0 (&other_values); } -__attribute__ ((noinline, noclone, weak)) +__attribute__ ((weak)) __attribute_optimization_barrier__ void call_pthread_exit () { @@ -192,7 +192,7 @@ call_pthread_exit () pthread_exit. If Nested is true, call pthread_exit indirectly via call_pthread_exit. */ template -__attribute__ ((noinline, noclone, weak)) +__attribute__ ((weak)) __attribute_optimization_barrier__ void * threadfunc (void *closure) { diff --git a/nptl/tst-thread_local1.cc b/nptl/tst-thread_local1.cc index 270520528c..d78ad2731c 100644 --- a/nptl/tst-thread_local1.cc +++ b/nptl/tst-thread_local1.cc @@ -53,27 +53,27 @@ to_string (const counter &c) template struct counting { - counting () __attribute__ ((noinline, noclone)); - ~counting () __attribute__ ((noinline, noclone)); - void operation () __attribute__ ((noinline, noclone)); + counting () __attribute_optimization_barrier__; + ~counting () __attribute_optimization_barrier__; + void operation () __attribute_optimization_barrier__; }; template -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ counting::counting () { ++Counter->constructed; } template -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ counting::~counting () { ++Counter->destructed; } template -void __attribute__ ((noinline, noclone)) +void __attribute_optimization_barrier__ counting::operation () { // Optimization barrier. diff --git a/stdlib/tst-makecontext-align.c b/stdlib/tst-makecontext-align.c index e54b3e1ff2..a2648bf41e 100644 --- a/stdlib/tst-makecontext-align.c +++ b/stdlib/tst-makecontext-align.c @@ -30,7 +30,7 @@ static const char *context; /* Check that ADDRESS is aligned to ALIGNMENT bytes, behind a compiler barrier. */ -__attribute__ ((noinline, noclone, weak)) +__attribute__ ((weak)) __attribute_optimization_barrier__ void check_align (void *address, size_t alignment) { @@ -45,7 +45,7 @@ check_align (void *address, size_t alignment) /* Various alignment checking functions. */ -__attribute__ ((noinline, noclone, weak)) +__attribute__ ((weak)) __attribute_optimization_barrier__ void check_align_int (void) { @@ -53,7 +53,7 @@ check_align_int (void) check_align (&a, __alignof__ (a)); } -__attribute__ ((noinline, noclone, weak)) +__attribute__ ((weak)) __attribute_optimization_barrier__ void check_align_long (void) { @@ -61,7 +61,7 @@ check_align_long (void) check_align (&a, __alignof__ (a)); } -__attribute__ ((noinline, noclone, weak)) +__attribute__ ((weak)) __attribute_optimization_barrier__ void check_align_long_long (void) { @@ -69,7 +69,7 @@ check_align_long_long (void) check_align (&a, __alignof__ (a)); } -__attribute__ ((noinline, noclone, weak)) +__attribute__ ((weak)) __attribute_optimization_barrier__ void check_align_double (void) { @@ -77,7 +77,7 @@ check_align_double (void) check_align (&a, __alignof__ (a)); } -__attribute__ ((noinline, noclone, weak)) +__attribute__ ((weak)) __attribute_optimization_barrier__ void check_align_4 (void) { @@ -85,7 +85,7 @@ check_align_4 (void) check_align (&a, 4); } -__attribute__ ((noinline, noclone, weak)) +__attribute__ ((weak)) __attribute_optimization_barrier__ void check_align_8 (void) { @@ -93,7 +93,7 @@ check_align_8 (void) check_align (&a, 8); } -__attribute__ ((noinline, noclone, weak)) +__attribute__ ((weak)) __attribute_optimization_barrier__ void check_align_16 (void) { @@ -105,7 +105,7 @@ check_align_16 (void) check_align (&a, 16); } -__attribute__ ((noinline, noclone, weak)) +__attribute__ ((weak)) __attribute_optimization_barrier__ void check_align_32 (void) { @@ -120,7 +120,7 @@ check_align_32 (void) } /* Call all the alignment checking functions. */ -__attribute__ ((noinline, noclone, weak)) +__attribute__ ((weak)) __attribute_optimization_barrier__ void check_alignments (void) { diff --git a/stdlib/tst-quick_exit.cc b/stdlib/tst-quick_exit.cc index 4331d80383..1cf2dbfed2 100644 --- a/stdlib/tst-quick_exit.cc +++ b/stdlib/tst-quick_exit.cc @@ -26,7 +26,7 @@ struct A thread_local A a; void -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ optimization_barrier (A &) { } diff --git a/stdlib/tst-setcontext10.c b/stdlib/tst-setcontext10.c index 7267f5efe3..4991d87ebb 100644 --- a/stdlib/tst-setcontext10.c +++ b/stdlib/tst-setcontext10.c @@ -37,7 +37,7 @@ static ucontext_t ctx; static void f2 (void); static void -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ f1 (void) { printf ("start f1\n"); @@ -45,7 +45,7 @@ f1 (void) } static void -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ f2 (void) { printf ("start f2\n"); @@ -64,7 +64,7 @@ f3 (void) } static int -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ do_test_1 (void) { char st1[32768]; diff --git a/stdlib/tst-setcontext11.c b/stdlib/tst-setcontext11.c index 1883c44b76..dbb23640d2 100644 --- a/stdlib/tst-setcontext11.c +++ b/stdlib/tst-setcontext11.c @@ -54,7 +54,7 @@ f1 (int a0, int a1, int a2, int a3) } static void -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ call_longjmp (void) { longjmp_called = 1; diff --git a/stdlib/tst-setcontext5.c b/stdlib/tst-setcontext5.c index 9b29907a13..ad40081852 100644 --- a/stdlib/tst-setcontext5.c +++ b/stdlib/tst-setcontext5.c @@ -27,7 +27,7 @@ static volatile int done; static void f2 (void); static void -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ f1 (void) { printf ("start f1\n"); @@ -35,7 +35,7 @@ f1 (void) } static void -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ f2 (void) { printf ("start f2\n"); diff --git a/stdlib/tst-setcontext8.c b/stdlib/tst-setcontext8.c index cdcf5eb871..72f1c1b2c4 100644 --- a/stdlib/tst-setcontext8.c +++ b/stdlib/tst-setcontext8.c @@ -26,7 +26,7 @@ static ucontext_t ctx[3]; static atomic_int done; static void -__attribute__((noinline, noclone)) +__attribute_optimization_barrier__ f2 (void) { printf ("start f2\n"); diff --git a/stdlib/tst-setcontext9.c b/stdlib/tst-setcontext9.c index 91b6255138..7d2d341fe0 100644 --- a/stdlib/tst-setcontext9.c +++ b/stdlib/tst-setcontext9.c @@ -26,7 +26,7 @@ static ucontext_t ctx[5]; static atomic_int done; static void -__attribute__((noinline, noclone)) +__attribute_optimization_barrier__ f2 (void) { done++; diff --git a/stdlib/tst-swapcontext1.c b/stdlib/tst-swapcontext1.c index c96b8a27a8..8b1590d0fd 100644 --- a/stdlib/tst-swapcontext1.c +++ b/stdlib/tst-swapcontext1.c @@ -29,7 +29,7 @@ const char *fmt2 = "\e[34m"; #define handle_error(msg) \ do { perror(msg); exit(EXIT_FAILURE); } while (0) -__attribute__((noinline, noclone)) +__attribute_optimization_barrier__ static void func4(ucontext_t *uocp, ucontext_t *ucp, const char *str, const char *fmt) { @@ -39,7 +39,7 @@ func4(ucontext_t *uocp, ucontext_t *ucp, const char *str, const char *fmt) printf(" %sfunc4: returning\e[0m\n", fmt); } -__attribute__((noinline, noclone)) +__attribute_optimization_barrier__ static void func3(ucontext_t *uocp, ucontext_t *ucp, const char *str, const char *fmt) { @@ -48,7 +48,7 @@ func3(ucontext_t *uocp, ucontext_t *ucp, const char *str, const char *fmt) printf(" %sfunc3: returning\e[0m\n", fmt); } -__attribute__((noinline, noclone)) +__attribute_optimization_barrier__ static void func1(void) { @@ -59,7 +59,7 @@ func1(void) } } -__attribute__((noinline, noclone)) +__attribute_optimization_barrier__ static void func2(void) { diff --git a/stdlib/tst-swapcontext2.c b/stdlib/tst-swapcontext2.c index a9c1dc827c..f8efdde7e6 100644 --- a/stdlib/tst-swapcontext2.c +++ b/stdlib/tst-swapcontext2.c @@ -32,7 +32,7 @@ static jmp_buf jmpbuf; #define handle_error(msg) \ do { perror(msg); exit(EXIT_FAILURE); } while (0) -__attribute__((noinline, noclone)) +__attribute_optimization_barrier__ static void func4(ucontext_t *uocp, ucontext_t *ucp, const char *str, const char *fmt) { @@ -42,7 +42,7 @@ func4(ucontext_t *uocp, ucontext_t *ucp, const char *str, const char *fmt) printf(" %sfunc4: returning\e[0m\n", fmt); } -__attribute__((noinline, noclone)) +__attribute_optimization_barrier__ static void func3(ucontext_t *uocp, ucontext_t *ucp, const char *str, const char *fmt) { @@ -51,7 +51,7 @@ func3(ucontext_t *uocp, ucontext_t *ucp, const char *str, const char *fmt) printf(" %sfunc3: returning\e[0m\n", fmt); } -__attribute__((noinline, noclone)) +__attribute_optimization_barrier__ static void func1(void) { @@ -67,7 +67,7 @@ func1(void) } } -__attribute__((noinline, noclone)) +__attribute_optimization_barrier__ static void func2(void) { diff --git a/stdlib/tst-thread-quick_exit.cc b/stdlib/tst-thread-quick_exit.cc index dadccee334..66ea855a0d 100644 --- a/stdlib/tst-thread-quick_exit.cc +++ b/stdlib/tst-thread-quick_exit.cc @@ -30,7 +30,7 @@ thread_local A a1; thread_local A a2; void -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ optimization_barrier (A &) { } diff --git a/string/tst-xbzero-opt.c b/string/tst-xbzero-opt.c index 2392eaa2c1..0247eec9af 100644 --- a/string/tst-xbzero-opt.c +++ b/string/tst-xbzero-opt.c @@ -97,7 +97,7 @@ static const unsigned char test_pattern[16] = static ucontext_t uc_main, uc_co; -static __attribute__ ((noinline, noclone)) int +static __attribute_optimization_barrier__ int use_test_buffer (unsigned char *buf) { unsigned int sum = 0; diff --git a/sysdeps/generic/tst-stack-align.h b/sysdeps/generic/tst-stack-align.h index 12473e32b8..e73acdc29a 100644 --- a/sysdeps/generic/tst-stack-align.h +++ b/sysdeps/generic/tst-stack-align.h @@ -20,7 +20,7 @@ #include int -__attribute__ ((weak, noclone, noinline)) +__attribute__ ((weak)) __attribute_optimization_barrier__ is_aligned (void *p, int align) { return (((uintptr_t) p) & (align - 1)) != 0; diff --git a/sysdeps/unix/sysv/linux/x86_64/tst-cet-property-2.c b/sysdeps/unix/sysv/linux/x86_64/tst-cet-property-2.c index 5274a09509..2b0126bf8e 100644 --- a/sysdeps/unix/sysv/linux/x86_64/tst-cet-property-2.c +++ b/sysdeps/unix/sysv/linux/x86_64/tst-cet-property-2.c @@ -25,7 +25,7 @@ extern void bar (void); void -__attribute__ ((noclone, noinline)) +__attribute_optimization_barrier__ test (void (*func_p) (void)) { func_p (); diff --git a/sysdeps/unix/sysv/linux/x86_64/tst-cet-setcontext-1.c b/sysdeps/unix/sysv/linux/x86_64/tst-cet-setcontext-1.c index 388931f5f3..c9d49bd907 100644 --- a/sysdeps/unix/sysv/linux/x86_64/tst-cet-setcontext-1.c +++ b/sysdeps/unix/sysv/linux/x86_64/tst-cet-setcontext-1.c @@ -30,7 +30,7 @@ static ucontext_t ctx[5]; static atomic_int done; static void -__attribute__((noinline, noclone)) +__attribute_optimization_barrier__ f2 (void) { printf ("start f2\n"); diff --git a/sysdeps/unix/sysv/linux/x86_64/tst-cet-vfork-1.c b/sysdeps/unix/sysv/linux/x86_64/tst-cet-vfork-1.c index 56d77530ae..cf23bd4021 100644 --- a/sysdeps/unix/sysv/linux/x86_64/tst-cet-vfork-1.c +++ b/sysdeps/unix/sysv/linux/x86_64/tst-cet-vfork-1.c @@ -25,7 +25,7 @@ #include #include -__attribute__ ((noclone, noinline)) +__attribute_optimization_barrier__ static void do_test_1 (void) { diff --git a/sysdeps/unix/sysv/linux/x86_64/tst-gnu2-tls2-amx.c b/sysdeps/unix/sysv/linux/x86_64/tst-gnu2-tls2-amx.c index ae4dd82556..c3b2afe136 100644 --- a/sysdeps/unix/sysv/linux/x86_64/tst-gnu2-tls2-amx.c +++ b/sysdeps/unix/sysv/linux/x86_64/tst-gnu2-tls2-amx.c @@ -27,7 +27,7 @@ extern int arch_prctl (int, ...); #define X86_XSTATE_TILEDATA_ID 18 /* Initialize tile config. */ -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static void init_tile_config (__tilecfg *tileinfo) { diff --git a/sysdeps/x86/tst-ldbl-nonnormal-printf.c b/sysdeps/x86/tst-ldbl-nonnormal-printf.c index 3a60750de4..5869e74994 100644 --- a/sysdeps/x86/tst-ldbl-nonnormal-printf.c +++ b/sysdeps/x86/tst-ldbl-nonnormal-printf.c @@ -23,7 +23,7 @@ /* Fill the stack with non-zero values. This makes a crash in snprintf more likely. */ -static void __attribute__ ((noinline, noclone)) +static void __attribute_optimization_barrier__ fill_stack (void) { char buffer[65536]; diff --git a/sysdeps/x86/tst-memchr-rtm.c b/sysdeps/x86/tst-memchr-rtm.c index 7dc0718b7c..773f972693 100644 --- a/sysdeps/x86/tst-memchr-rtm.c +++ b/sysdeps/x86/tst-memchr-rtm.c @@ -22,7 +22,7 @@ #define STRING_SIZE 1024 char string1[STRING_SIZE]; -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int prepare (void) { @@ -36,7 +36,7 @@ prepare (void) return EXIT_FAILURE; } -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int function (void) { diff --git a/sysdeps/x86/tst-memcmp-rtm.c b/sysdeps/x86/tst-memcmp-rtm.c index 124eb17aed..91920412ed 100644 --- a/sysdeps/x86/tst-memcmp-rtm.c +++ b/sysdeps/x86/tst-memcmp-rtm.c @@ -23,7 +23,7 @@ char string1[STRING_SIZE]; char string2[STRING_SIZE]; -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int prepare (void) { @@ -35,7 +35,7 @@ prepare (void) return EXIT_FAILURE; } -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int function (void) { diff --git a/sysdeps/x86/tst-memmove-rtm.c b/sysdeps/x86/tst-memmove-rtm.c index dfb5533784..ed4bcc1ee7 100644 --- a/sysdeps/x86/tst-memmove-rtm.c +++ b/sysdeps/x86/tst-memmove-rtm.c @@ -23,7 +23,7 @@ char string1[STRING_SIZE]; char string2[STRING_SIZE]; -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int prepare (void) { @@ -35,7 +35,7 @@ prepare (void) return EXIT_FAILURE; } -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int function (void) { diff --git a/sysdeps/x86/tst-memrchr-rtm.c b/sysdeps/x86/tst-memrchr-rtm.c index 48512de7f4..f597081310 100644 --- a/sysdeps/x86/tst-memrchr-rtm.c +++ b/sysdeps/x86/tst-memrchr-rtm.c @@ -22,7 +22,7 @@ #define STRING_SIZE 1024 char string1[STRING_SIZE]; -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int prepare (void) { @@ -36,7 +36,7 @@ prepare (void) return EXIT_FAILURE; } -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int function (void) { diff --git a/sysdeps/x86/tst-memset-rtm.c b/sysdeps/x86/tst-memset-rtm.c index 60e714c757..cf12a2af24 100644 --- a/sysdeps/x86/tst-memset-rtm.c +++ b/sysdeps/x86/tst-memset-rtm.c @@ -22,7 +22,7 @@ #define STRING_SIZE 1024 char string1[STRING_SIZE]; -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int prepare (void) { @@ -30,7 +30,7 @@ prepare (void) return EXIT_SUCCESS; } -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int function (void) { diff --git a/sysdeps/x86/tst-strchr-rtm.c b/sysdeps/x86/tst-strchr-rtm.c index 8294cc5118..c7b020d459 100644 --- a/sysdeps/x86/tst-strchr-rtm.c +++ b/sysdeps/x86/tst-strchr-rtm.c @@ -22,7 +22,7 @@ #define STRING_SIZE 1024 char string1[STRING_SIZE]; -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int prepare (void) { @@ -36,7 +36,7 @@ prepare (void) return EXIT_FAILURE; } -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int function (void) { diff --git a/sysdeps/x86/tst-strcmp-rtm.c b/sysdeps/x86/tst-strcmp-rtm.c index c2274a5d3e..96e19be6c2 100644 --- a/sysdeps/x86/tst-strcmp-rtm.c +++ b/sysdeps/x86/tst-strcmp-rtm.c @@ -40,7 +40,7 @@ CHAR string1[STRING_SIZE]; CHAR string2[STRING_SIZE]; -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int prepare (void) { @@ -52,7 +52,7 @@ prepare (void) return EXIT_FAILURE; } -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int function (void) { diff --git a/sysdeps/x86/tst-strcpy-rtm.c b/sysdeps/x86/tst-strcpy-rtm.c index 139f52004e..15f3419045 100644 --- a/sysdeps/x86/tst-strcpy-rtm.c +++ b/sysdeps/x86/tst-strcpy-rtm.c @@ -23,7 +23,7 @@ char string1[STRING_SIZE]; char string2[STRING_SIZE]; -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int prepare (void) { @@ -35,7 +35,7 @@ prepare (void) return EXIT_FAILURE; } -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int function (void) { diff --git a/sysdeps/x86/tst-strlen-rtm.c b/sysdeps/x86/tst-strlen-rtm.c index 5b083f29dc..0155b68647 100644 --- a/sysdeps/x86/tst-strlen-rtm.c +++ b/sysdeps/x86/tst-strlen-rtm.c @@ -22,7 +22,7 @@ #define STRING_SIZE 1024 char string1[STRING_SIZE]; -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int prepare (void) { @@ -35,7 +35,7 @@ prepare (void) return EXIT_FAILURE; } -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int function (void) { diff --git a/sysdeps/x86/tst-strncmp-rtm.c b/sysdeps/x86/tst-strncmp-rtm.c index ebc8837ad1..bd54c41e77 100644 --- a/sysdeps/x86/tst-strncmp-rtm.c +++ b/sysdeps/x86/tst-strncmp-rtm.c @@ -40,7 +40,7 @@ CHAR string1[STRING_SIZE]; CHAR string2[STRING_SIZE]; -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int prepare (void) { @@ -52,7 +52,7 @@ prepare (void) return EXIT_FAILURE; } -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int function (void) { @@ -62,7 +62,7 @@ function (void) return 1; } -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int function_overflow (void) { @@ -72,7 +72,7 @@ function_overflow (void) return 1; } -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int function_overflow2 (void) { diff --git a/sysdeps/x86/tst-strrchr-rtm.c b/sysdeps/x86/tst-strrchr-rtm.c index 487d2071d4..c7f41427b5 100644 --- a/sysdeps/x86/tst-strrchr-rtm.c +++ b/sysdeps/x86/tst-strrchr-rtm.c @@ -22,7 +22,7 @@ #define STRING_SIZE 1024 char string1[STRING_SIZE]; -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int prepare (void) { @@ -35,7 +35,7 @@ prepare (void) return EXIT_FAILURE; } -__attribute__ ((noinline, noclone)) +__attribute_optimization_barrier__ static int function (void) { diff --git a/sysdeps/x86_64/tst-rsi-strlen.c b/sysdeps/x86_64/tst-rsi-strlen.c index 2c424ffe94..704a2f56a8 100644 --- a/sysdeps/x86_64/tst-rsi-strlen.c +++ b/sysdeps/x86_64/tst-rsi-strlen.c @@ -44,7 +44,7 @@ typedef struct } parameter_t; size_t -__attribute__ ((weak, noinline, noclone)) +__attribute__ ((weak)) __attribute_optimization_barrier__ do_strlen (parameter_t *a, int zero, const CHAR *str) { return CALL (a, str); From patchwork Sun Dec 22 21:11:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 103623 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 214FC385840E for ; Sun, 22 Dec 2024 21:12:45 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by sourceware.org (Postfix) with ESMTPS id 6169D3858C3A for ; Sun, 22 Dec 2024 21:12:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6169D3858C3A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6169D3858C3A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::52e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734901940; cv=none; b=oiRtGmFaCYNpslhW/eKBsBlLMumJTcHJZZPKkgNV68EPUPN+u1/gMOUqW1JM3OW+2kWcscHoUUWkNfrYvIYq+bilmlexLOHhNfp+lZKHtazIYbllncmJ7dmZ+PXI7Gmgy6rfIpAHPtq149PirJ5Qc0HqbHn+g1uZdl2fK8GQLCU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734901940; c=relaxed/simple; bh=z0Y5LZQ1kLd4mDaZD6369MO2LWCaGkdLEhiazEB8Fgc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Hc5v7JTvDwvamoC15dCJQlnDpq5tjoZAXOJg7I2vLW6+e+oPNz5jW2pHiGIY4VNPvq17qrA+rtqkQI3F4pDbw52PtLmcI8X0vjxJdtzv4zH9B2vvdLka27HR1racbP1xDlp1ZsBEoACHMlYTvZlxp6MLE0IDbFvnQ7fbpzoi/lQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6169D3858C3A Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=RjKWjLc3 Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-7fd5248d663so2605286a12.0 for ; Sun, 22 Dec 2024 13:12:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734901939; x=1735506739; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iqxVL1XqxTsfVDTB0TXHjph8wD1I5U3gHnisHnhcGmI=; b=RjKWjLc3NHMvu9LdVa7I0px0XFDiKa96dV7zbSvElwvPdvhGlBr226cX+MXjZhzfAD wK+HgCXvnDvQdYWMHynNUlENW0ePkvcSHq11SK54jsKqqCqBfES9e7Js2btXoSjurg0p AJ/MJk2LCXmkcFEsrkj/MgkdcoTMLmWndPcNvQE7ezqZBmHb0ZL69DMAZNytuFB3IVpL 6Z8SLhKMfmbr9735ch4BFEuLbm6bE2OPnIwtEkaIT7xU6ZdzYwC0fhcx0q8xyC1ugSt/ AhRuIqRccIvKun6/qvxhJnr+A9Hd8mZZJJrbkcKyza0f4Ej62PLozoyOupGRI5EpTbYZ Aj+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734901939; x=1735506739; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iqxVL1XqxTsfVDTB0TXHjph8wD1I5U3gHnisHnhcGmI=; b=iEml8lIZshI5YoLWXymGcHPaNom8qTDigqTjpU8zNU5jdf+hvZCW7X/JvAvxcRURcR 2sZP+71MsTCy7X6AgRKCYtXfZG33jXaLoQqfd1S5yH5W9laGXQytZd7vHOoXjIkS7P7s tevPpFpYDApKShVMQk7LbxJez0R56vGskq9QiRk+aQM7if4h3c4G24p6YZkWDaqH/9iA ii1D2/OyiA/HimrAqojm7ofM4+wVYfH5VVEcrKTFCrSsvb90LaIvXkRTBwqhcs6fVz7s pdOhnBr3YAkLTQWEaI/XQ05b2Q22YLUloIvXKD0YYUha5h8e8FshRaiHYxqLy9aVE1qp Irkg== X-Gm-Message-State: AOJu0YwiF0k5K8bI1N3Y1tBCTSmHX7tw8CGiaBWznbvBxlIvC2UJLeMC vY9ccTU8purgdpjZzpOULDTkuPQem8DiDZeGSgHWFUt/Z/TS/8Bz X-Gm-Gg: ASbGncvg+GynuKSD8z5adMqp3kfVN4EKRRyOcZr2CNem8i7QGWheauwEkrcKo+sm1aK ycWki6F/b9j+hQbTCaIdtMcrO/IZQKkog6Awz0/UNo9yiIIyhBAqSgjc9vw+dy/qwKs4UpXzf1v Im+OVrmuMgya+wfR3skO8ssEOoobRSPKcKl/bRqmj5zrXRrDI3FZZM2dR4rLBRZ/i1S0ntSCWzb fDBpFGYmNERJteVSqrQF/Ny81KPovyREhSx7DTAe+cgVA5wZTEDRoUpsZdHRr/iuaX2GK4= X-Google-Smtp-Source: AGHT+IGL40jmB08OkIemAhaopEQ3zr1VGhUt9q4a4slopDUTXo54TRoXnapQD+XitiBjSNZjphl/TA== X-Received: by 2002:a17:90b:4ec6:b0:2ee:cdea:ad91 with SMTP id 98e67ed59e1d1-2f452e2e460mr17389965a91.15.1734901939205; Sun, 22 Dec 2024 13:12:19 -0800 (PST) Received: from gnu-tgl-3.localdomain ([120.204.185.181]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2d9dc737fsm7604902a91.0.2024.12.22.13.12.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Dec 2024 13:12:18 -0800 (PST) Received: from gnu-tgl-3.lan (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id 8CB09C03E9; Mon, 23 Dec 2024 05:12:15 +0800 (CST) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: sam@gentoo.org, schwab@linux-m68k.org, Adhemerval Zanella Subject: [PATCH v2 2/6] stdio: Suppress -Wformat only for gcc in tst-sprintf-errno.c Date: Mon, 23 Dec 2024 05:11:59 +0800 Message-ID: <20241222211203.66704-3-hjl.tools@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241222211203.66704-1-hjl.tools@gmail.com> References: <20241222211203.66704-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3019.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org From: Adhemerval Zanella Since Clang doesn't support DIAG_IGNORE_NEEDS_COMMENT (11, "-Wformat="); and for unknown reasons, it doesn't warn the %#m specifier, suppress -Wformat only for gcc in tst-sprintf-errno.c. Co-Authored-By: H.J. Lu Reviewed-by: Sam James --- stdio-common/tst-sprintf-errno.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdio-common/tst-sprintf-errno.c b/stdio-common/tst-sprintf-errno.c index e00c3fb485..2ea1fde2dc 100644 --- a/stdio-common/tst-sprintf-errno.c +++ b/stdio-common/tst-sprintf-errno.c @@ -24,7 +24,7 @@ /* GCC does not yet know about the %#m specifier. */ DIAG_PUSH_NEEDS_COMMENT; -DIAG_IGNORE_NEEDS_COMMENT (11, "-Wformat="); +DIAG_IGNORE_NEEDS_COMMENT_GCC (11, "-Wformat="); static int do_test (void) From patchwork Sun Dec 22 21:12:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 103628 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2FB0D3858C3A for ; Sun, 22 Dec 2024 21:16:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2FB0D3858C3A Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=FivtDnr/ X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id 2C1843858428 for ; Sun, 22 Dec 2024 21:12:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2C1843858428 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2C1843858428 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734901942; cv=none; b=K4Af7nSZtWFYCqxMWUmsJ3/YcpCG7ZKLQonfUlQ5zQWap7zdEZscy1/mjOOraNiqZvc8D11IVWmIc/HAwJqjwo+z19vHAj6n9ajf4uDEX/CE9fNTznGApyZk/nMiVD4Frh1BIMsJmT0OnQvlvc+WI6U6W+NJrwPYpG8p0jn/A7o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734901942; c=relaxed/simple; bh=dOWxHaDuA9TbByIXS1N2aXm4b4Pj+QmfRHuYoL/QgGM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=jlOwfTiUvEabNso8Un+MGBIGgzwGm4KjuCqbkyZcSlL4ue1ZfPnNXYMKbfAe8LmhHEhT+3cgh/96A9MTDeuHrIv20jjox2kC4Vx4uUHY5XwzYgg17bg5HQuuk89jS1zjaZxjuGC9X6QXkfB7hBjEVOhofep9mVqPkLfEv3aV+w8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-2163bd70069so32931625ad.0 for ; Sun, 22 Dec 2024 13:12:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734901940; x=1735506740; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JtQRIoX85DS6A2XRYqtZbpmWN1+YZMuzlFmiYX7RD1Y=; b=FivtDnr/oo9nONCQWwmMNiGddUGTMcmulNVdKgcBiIvVyLsYkhD+mbn8wH3vt4VLJY MV6mVtrkaxnHYhP8PvzADXawOjF6SkYE6B6Klm5qSu7bopcUQYLONDLQRGgLU3IhDWSY 6ofOV8AdkM2BaW/8LZoXtGiuWiBsyO99OkzpHHjTFlOPWAJb+lSFvg3ObFpEduYK8Tyx NhuK8UQckiSsing0WS4E2uApgGnJ3Tw4i6GsaA3DRYjzdVQjpXGhRZb9NqgPlK833Rq/ JqR648C8+lOBoK17uSouwlKjZoO9Qb29Hn1EDj6hPQGx+Tx0+bmPBPbWqgLahJHk8li6 AIUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734901940; x=1735506740; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JtQRIoX85DS6A2XRYqtZbpmWN1+YZMuzlFmiYX7RD1Y=; b=MqKo0u4FADhoIHA5SIVzaTsr0lxerPqDzw4Rh4nSX2QUT7Vj21p/97Kkk8XlKFXS9M BFSn4QTbvhnC2pHlM2wq4b+MqklFytRTfhaEVvdfqN653XWoKZ9MS+KhTsZ9qgDpIf19 4z0Zh4/6mCQBODAXRt6L2Y97q2xBQpp9c9ApJ9G2BPORG2PC0kuxYrEfHO9/4KnOeHd8 STWGRPD9ldkT/e88E8PS1PpI6l21WuySAT4pZJ2BjQTr3L2lXOGUTZMIx4jHdhm/2n3I Qo6kE2orRagWH+9+5+pea4JAvcvswo7c+r2jTN2lEVSM09NzU4jpF8NDc/yyBS+bXEwE KNvA== X-Gm-Message-State: AOJu0Yw0FYSfy9NVjP4BJjs6QCx8C6Zf0pZneCKlrXMwNa1IFxI7j2fg 3ca5/AZSz3WT4+iRJ3n2wo1bk0D34aXv8BTofIfT62gtDECozHgJWzeNxHMz8kECyA== X-Gm-Gg: ASbGncs7Tt8TBQqgtBAvi9N+ULy390YbMGE+TS5d0b3wqmeX9yXKg6sHyCTt5eN5p7/ zHnmwO0elVxqNol0yK/Y8AW3dY9AX9kQ1Apt2MeMA07ih8F2EXFnBv5ynhUe+uEkGzvdyFHDm1A DZIuzINF+m/n2jpeNRcAuw+JSRD7aXnIqUK0uE7D0CC9tGTD76g0ub12JICNbJAfUsqy2KvUZMl ZLApR6GIaDJRissyfHX15ieamMKCuSdpB2baHCPz2EYrznIXmjrvptIhM+/wFnoS2/ZTxg= X-Google-Smtp-Source: AGHT+IG3mmL9Paxb99LVWXOMdFrRbaA1HjImrvK3yP1w6P2alNxUGaTvP3tWNyln6iXY90jnm8Vcgw== X-Received: by 2002:a17:902:db0e:b0:215:8695:ef91 with SMTP id d9443c01a7336-219e6e8957amr160989825ad.6.1734901940455; Sun, 22 Dec 2024 13:12:20 -0800 (PST) Received: from gnu-tgl-3.localdomain ([120.204.185.181]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc96eb83sm61004875ad.97.2024.12.22.13.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Dec 2024 13:12:20 -0800 (PST) Received: from gnu-tgl-3.lan (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id 978E0C042C; Mon, 23 Dec 2024 05:12:15 +0800 (CST) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: sam@gentoo.org, schwab@linux-m68k.org Subject: [PATCH v2 3/6] Suppress Clang -Wimplicit-fallthrough warnings Date: Mon, 23 Dec 2024 05:12:00 +0800 Message-ID: <20241222211203.66704-4-hjl.tools@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241222211203.66704-1-hjl.tools@gmail.com> References: <20241222211203.66704-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3019.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org Since Clang doesn't properly handle /* FALLTHROUGH */ in elf/tst-align2.c nor /* fall through */ in misc/tst-tsearch.c tst-align2.c:100:9: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough] 100 | case 'A': | ^ tst-align2.c:100:9: note: insert '__attribute__((fallthrough));' to silence this warning 100 | case 'A': | ^ | __attribute__((fallthrough)); tst-align2.c:100:9: note: insert 'break;' to avoid fall-through 100 | case 'A': | ^ | break; suppress them when compiled with Clang. Signed-off-by: H.J. Lu Reviewed-by: Sam James --- elf/tst-align2.c | 4 ++++ misc/tst-tsearch.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/elf/tst-align2.c b/elf/tst-align2.c index c73ea5a5fe..c49ed70c17 100644 --- a/elf/tst-align2.c +++ b/elf/tst-align2.c @@ -22,6 +22,7 @@ #include #include #include +#include static int res, fds[2], result; static bool test_destructors; @@ -91,6 +92,8 @@ do_test (void) int des_seen = 0, dso_des_seen = 0; while ((len = TEMP_FAILURE_RETRY (read (fds[0], &c, 1))) > 0) { + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (3.2, "-Wimplicit-fallthrough"); switch (c) { case 'B': @@ -112,6 +115,7 @@ do_test (void) result = 1; break; } + DIAG_POP_NEEDS_COMMENT_CLANG; } close (fds[0]); diff --git a/misc/tst-tsearch.c b/misc/tst-tsearch.c index 2ca561dd7d..2a8f13f774 100644 --- a/misc/tst-tsearch.c +++ b/misc/tst-tsearch.c @@ -26,6 +26,7 @@ #include #include #include +#include #define SEED 0 #define BALANCED 1 @@ -286,6 +287,8 @@ mangle_tree (enum order how, enum action what, void **root, int lag) abort (); } + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (3.2, "-Wimplicit-fallthrough"); switch (what) { case build_and_del: @@ -331,6 +334,7 @@ mangle_tree (enum order how, enum action what, void **root, int lag) break; } + DIAG_POP_NEEDS_COMMENT_CLANG; } } From patchwork Sun Dec 22 21:12:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 103626 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BA5103858C35 for ; Sun, 22 Dec 2024 21:14:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA5103858C35 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=JtcHYSF2 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id 8C7FE3858C35 for ; Sun, 22 Dec 2024 21:12:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8C7FE3858C35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8C7FE3858C35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::42b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734901940; cv=none; b=OBAlfVVmWtRRKCjzIcxxrUcxhBZPqO0t7KceVcFkQuu+5JAfG4tGWhikCoM/SZw+GQ+NMENhB8umLfgp25CHL/DOKxOQKrY7kbJBBUxnHPxNzClZCrkZwVLWvHO4ObXd/F3zbfnaNcaXeb1bfX/Ax8ht+C/73cz858ry5Ml48iQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734901940; c=relaxed/simple; bh=CTnkIHcBA4vVc1VOk0AbZs4BYY1AhStbP1ZUilsXeOo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Mc0yznHi9QOqmA7mkAmxP+lKG2HT0QwTCZBfciiN3i8hjJO1EAcUp7bqEcEsi0pT8yQQwB1J0Y3X4+4WsnUpqdHAKM8bX3Ol10ykg60q06sVlpG6tY0EFopjRnJ1z1AFUscvdkXQoHF6ySlbhn55IBfP6+Jd1sPzYgcyOu3XDJ0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8C7FE3858C35 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-72764c995e5so2183479b3a.2 for ; Sun, 22 Dec 2024 13:12:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734901939; x=1735506739; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4bApsexE4E/8BR5RQ4pzIxfAwol51ZkSXSCfeEKzi7Q=; b=JtcHYSF2zPiYwVBWm7DcL9uOV508alFZgvIi6l0AM+tYXLHGdpbnoS+h6EV/ibS8uU wfDmR2pMVvTN+kVir1bYuE8PaKzOuShfviF9Z3tmpcxb/uGjUQx60yapAnuR3cBtwYhV EWW7JjRuI4xtnQYp8fpU5msD1G2W8zOyiO5cISsB03iPmeRDQ7yZe5Fk/V0D/RDHS8TK 1iIXznBDzdDojNIEyjbR3j8labaI7kJdNeZtSg6pfVqF9h/o1u1XBzpQIWRLHviNeqZC whJiihXO0U3A0pXo3ytv3ygq4AnJhAPXWAySbJ9832omWlBSEpxCkJPSl8i0xU0Nlwf1 1hPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734901939; x=1735506739; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4bApsexE4E/8BR5RQ4pzIxfAwol51ZkSXSCfeEKzi7Q=; b=ElxYy8Md9KeGxup4Vovj5oTrLX7sofEmPMaEWgmraZZc0omURw1rP24zoPlBo8ndFP dIKZLLHBo19+lcUjRHj0M9/5sraU/b9BigInuGVMrv1uM2YqOUrcJB5OorfbpheKBGeq pbYNSSkL4zATH13b+wu11ooxvzBF+uv9rT4qW7r+7pHe52ge9ePnfZQn/VUd7fMxMsaC XODrzFSEY9jLFbgpyR6LnoA3LGMrKtVGs0wKBgwjczhs34vGMXKqb4xjJaCpguMxRoZh kGrG6x4m8GwEE6b63cW8ccDbYGHmgW6rgFHxLBnbOG4Dq+LUuj5zuYdCm2TXk1bdWvq7 uZRA== X-Gm-Message-State: AOJu0YwxA9vTuhFIit/uzCXMCu8I7owaeHs+j/LZDRIhfmq8ppgLcOX2 Y+jgSfnVdYdIN8WPaKt1+fhkB1lkWUEaD9jnUnxwf9DvEhcc8BpN X-Gm-Gg: ASbGnctVBdNxDB02aEMDvVT1Qbhz1Kjmdeb9Ow0LXUfUAJIGhEclUyoOtjkH6Po3x2U NkhRvP8n39kAaDOoXA/Av05auElQVGEAwS8yP6c/s+Bbq3Zb34ZIWW0Z00+TzjNX9nbUKphgLvC 5CdMPdBAJaig5VIVpiV979BGOQf/YZafa+Cg5dUau7vhjgRWF1mgHMl4VJfVwQgp5nh4vx2q16S yEYdnGr9pPBpLPRWmz647kv49fm8RCDTxas3mihlUHmuWx17FEUjMg+fJyo4ggmzwJvMBg= X-Google-Smtp-Source: AGHT+IHIG+2fevGQ+Wd0Nv0LXAtkTep0zqYestNKsVvswr+xB+TDFyb2RIlEFKFRzqAWj7V0dJ5Big== X-Received: by 2002:a05:6a20:d49b:b0:1e1:a8b7:b45d with SMTP id adf61e73a8af0-1e5e0445550mr16911319637.4.1734901939374; Sun, 22 Dec 2024 13:12:19 -0800 (PST) Received: from gnu-tgl-3.localdomain ([120.204.185.181]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8faf9esm6737210b3a.144.2024.12.22.13.12.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Dec 2024 13:12:19 -0800 (PST) Received: from gnu-tgl-3.lan (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id A2306C044D; Mon, 23 Dec 2024 05:12:15 +0800 (CST) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: sam@gentoo.org, schwab@linux-m68k.org Subject: [PATCH v2 4/6] Add a reference to Clang /usr/include/tgmath.h dependency Date: Mon, 23 Dec 2024 05:12:01 +0800 Message-ID: <20241222211203.66704-5-hjl.tools@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241222211203.66704-1-hjl.tools@gmail.com> References: <20241222211203.66704-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3019.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org The fake Clang /usr/include/tgmath.h dependency bug is: https://github.com/llvm/llvm-project/issues/120891 Signed-off-by: H.J. Lu Reviewed-by: Sam James --- Makerules | 1 + 1 file changed, 1 insertion(+) diff --git a/Makerules b/Makerules index c8b54f7d9a..b60b7e2315 100644 --- a/Makerules +++ b/Makerules @@ -471,6 +471,7 @@ ifneq (,$(objpfx)) # Continuation lines here are dangerous because they introduce spaces! # Also remove the /usr/include/tgmath.h dependency generated by Clang # even though Clang never reads /usr/include/tgmath.h. +# https://github.com/llvm/llvm-project/issues/120891 define sed-remove-objpfx -e 's@ $(subst .,\.,$(subst @,\@,$(common-objpfx)))@ $$(common-objpfx)@g' \ -e 's@^$(subst .,\.,$(subst @,\@,$(common-objpfx)))@$$(common-objpfx)@g' \ From patchwork Sun Dec 22 21:12:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 103627 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C241D3858D34 for ; Sun, 22 Dec 2024 21:16:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C241D3858D34 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=K2UqOoCx X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id A74F4385840B for ; Sun, 22 Dec 2024 21:12:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A74F4385840B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A74F4385840B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::434 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734901940; cv=none; b=Hz511xAdU1yhOA3RZeCzl6UL0w29Do8l5hNVPFpCLOlo3UprRRlxej1HzDA4mHYriH9HJ157nefVUcZ4fnUi7LpsMv6U5dOmBGvx5q1y9Kafup2rkxTXOHUqvH1p94iu0yS6muIisrLVBZJmDxbr+lUnfpODkEE7vVGLelb+6Ng= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734901940; c=relaxed/simple; bh=tIPm2m0fBi3zSBPmmtp7ihCfytX/2ETvr7JBWO7m7XQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=cKPg5/WY6hpbFYA2xH6XLe5S3+009LYphFX9+hV06oJWSIZvm6sjARI8WhUkltzZLdDkKzbF4rn3K76YO6KPnE9cUE5Yx7ozyv161Sg9bzw7qJgrWNb51foBn0qpCrjLUQHIF5zZxKVAuDBUWpYoE3vMyxrfM4Q+ieQLWzvu2FY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A74F4385840B Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-725ce7b82cbso4153856b3a.0 for ; Sun, 22 Dec 2024 13:12:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734901940; x=1735506740; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5306KeSvoEZEhUwx3H1yiIka43x3sahS7nm2TABzHX8=; b=K2UqOoCx8zZDd0fAIiS88wCwFImpd5PI7z93KXdHEvb3ULvzSmJXPyYBIKMWWvoBI8 1R5jV0zM5Xlr6qfamo2N7jISLC3lxH5PpxbogZMRI04gaiTB5AH11Bx/sjFlrWpUqYZ5 LFvNCfULrbnFEtJoabi/aRtESwgcCH9M6Ad7cPOlhaN0oDFFjcIsR0Wa+1rdJ/LXjraY Sr5I2P19yf165vAnFKNKi/01JL9gPK55ULlNieOUPl++KPDoeUYobj/Oir8AvsY6vP6y /JBIC0KRieKtaB2f5fZvusFeE9dUDGzLoddQHAxx0A9O/BktGNGrX96Mp+IE8kvtukSc n5iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734901940; x=1735506740; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5306KeSvoEZEhUwx3H1yiIka43x3sahS7nm2TABzHX8=; b=pNWhshnZLvXSjyO0zu/uHw+ngxounIpRnkGVA/ewOgapSAl08d+o/YntGr2OXMt5c4 ISLnaAaGgEHlgc3Gy/SUtXaaWXb2N7Coxm0O6ch0anfbCr/JL2P23nftLIOapLTwGp+d gcxcO8HneJe15QDEVboW5TLobVXFIJP4Pirocw4Q1qXw6ZHEHy37Fg+MtkkAtsWmRcqo OCa8cZPKTGeGoJAegdyoxC9JV7+PXTYY6edx0KVfG6XoxFiOTibb66yM9w3Mu+UMxI31 cQ3do3xa3qQbW91n4iM67B4G65qhtI+zXxLNe1a0JvUC6bBJT1Gj0v4dBvgsDMO1m8r5 J4PA== X-Gm-Message-State: AOJu0YwFZKl6fKuNRsMNFl0cAYaKhE8W3ejN+392m945NIdBi5GTMc2t ArkKvzxjelD1tTpsqdXjL/DzmzVRCiqIwCN3gK3mW2LjmeJz2FMV X-Gm-Gg: ASbGncvALIf4o5I3YetbBeBUkKw50oAg/lntksMQLPgJs9rxUL10e+cVVUndF/4RTXc UjS68JDnHRJYvpbLQMPcRvnh2XUz7a5GIhHOyfKSPH/thgAswhWk8CMLzOzrLG8Re3TX4jYWhOa SKRs6C2L1UdvNgfoSIKgFMPdvt80VQ4wYqFnEpSNJJr4OjOjRvc0qHAbSXYRImbfD+da+CslYus j43Ei7D+JDBr1YIcdFIAsBXKxTH7ekj6vQ7md/oXxFjjiEzhA3W1YwHoICiJsI8B4y6ys0= X-Google-Smtp-Source: AGHT+IE8PxwD3zXE7FIXzHQibLjZzFTW9Pd17r7W48+Sv9fKrGXlo7CnM557WvRB+EdtG+xWlzCqXw== X-Received: by 2002:a17:902:ef12:b0:216:52a5:dd41 with SMTP id d9443c01a7336-219e6ec13bcmr167832135ad.31.1734901939562; Sun, 22 Dec 2024 13:12:19 -0800 (PST) Received: from gnu-tgl-3.localdomain ([120.204.185.181]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc9d447fsm59050295ad.128.2024.12.22.13.12.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Dec 2024 13:12:19 -0800 (PST) Received: from gnu-tgl-3.lan (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id ACF48C0460; Mon, 23 Dec 2024 05:12:15 +0800 (CST) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: sam@gentoo.org, schwab@linux-m68k.org Subject: [PATCH v2 5/6] string: Suppress Clang warnings on tester.c Date: Mon, 23 Dec 2024 05:12:02 +0800 Message-ID: <20241222211203.66704-6-hjl.tools@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241222211203.66704-1-hjl.tools@gmail.com> References: <20241222211203.66704-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3019.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org Add a configure check for -Wno-fortify-source to suppress Clang warnings on string/tester.c, like: tester.c:385:10: error: 'strncat' size argument is too large; destination buffer has size 50, but size argument is 99 [-Werror,-Wfortify-source] 385 | check (strncat (one, "lmn", 99) == one, 1); /* Returned value. */ Signed-off-by: H.J. Lu Reviewed-by: Sam James --- configure | 34 ++++++++++++++++++++++++++++++++++ configure.ac | 10 ++++++++++ string/Makefile | 7 +++++-- 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 6be04c64cc..40063243a8 100755 --- a/configure +++ b/configure @@ -8002,6 +8002,40 @@ test-config-cflags-wno-restrict = $libc_cv_test_cflags_wno_restrict" +saved_CC="$CC" +CC="$TEST_CC" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking -Wno-fortify-source in testing" >&5 +printf %s "checking -Wno-fortify-source in testing... " >&6; } +if test ${libc_cv_test_cflags_wno_fortify_source+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if { ac_try='${CC-cc} -c -Werror -Wno-fortify-source -xc /dev/null -S -o /dev/null' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + libc_cv_test_cflags_wno_fortify_source=-Wno-fortify-source +else case e in #( + e) libc_cv_test_cflags_wno_fortify_source= + ;; +esac +fi ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_test_cflags_wno_fortify_source" >&5 +printf "%s\n" "$libc_cv_test_cflags_wno_fortify_source" >&6; } + +CC="$saved_CC" + + +config_vars="$config_vars +test-config-cflags-wno-fortify-source = $libc_cv_test_cflags_wno_fortify_source" + + + saved_CC="$CC" CC="$TEST_CC" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking -finput-charset=ascii in testing" >&5 diff --git a/configure.ac b/configure.ac index 5c156556d1..7eac65c630 100644 --- a/configure.ac +++ b/configure.ac @@ -1590,6 +1590,16 @@ LIBC_TRY_TEST_CC_OPTION([-Wno-restrict], LIBC_CONFIG_VAR([test-config-cflags-wno-restrict], [$libc_cv_test_cflags_wno_restrict]) +dnl Check if TEST_CC supports -Wno-fortify-source. +LIBC_TRY_TEST_CC_OPTION([-Wno-fortify-source], + [-c -Werror -Wno-fortify-source], + libc_cv_test_cflags_wno_fortify_source, + [libc_cv_test_cflags_wno_fortify_source=-Wno-fortify-source], + [libc_cv_test_cflags_wno_fortify_source=] +) +LIBC_CONFIG_VAR([test-config-cflags-wno-fortify-source], + [$libc_cv_test_cflags_wno_fortify_source]) + dnl Check if TEST_CC supports -finput-charset=ascii. LIBC_TRY_TEST_CC_OPTION([-finput-charset=ascii], [-c -Werror -finput-charset=ascii], diff --git a/string/Makefile b/string/Makefile index 1dff405c27..ac70d63404 100644 --- a/string/Makefile +++ b/string/Makefile @@ -252,8 +252,11 @@ endif include ../Rules -CFLAGS-inl-tester.c += -fno-builtin -CFLAGS-noinl-tester.c += -fno-builtin +CFLAGS-tester.c += $(test-config-cflags-wno-fortify-source) +CFLAGS-inl-tester.c += -fno-builtin \ + $(test-config-cflags-wno-fortify-source) +CFLAGS-noinl-tester.c += -fno-builtin \ + $(test-config-cflags-wno-fortify-source) CFLAGS-tst-strlen.c += -fno-builtin CFLAGS-stratcliff.c += -fno-builtin CFLAGS-test-ffs.c += -fno-builtin From patchwork Sun Dec 22 21:12:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 103624 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 38671385840F for ; Sun, 22 Dec 2024 21:13:13 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id 28E6A3858288 for ; Sun, 22 Dec 2024 21:12:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 28E6A3858288 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 28E6A3858288 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734901947; cv=none; b=Egu6kOufpeT5hQjbdr/nkNwClz1RBMIE0fKLv25TfcOblHAJ0GNNp1OTCFuevhDJdo5NwUlZ3kf+10bkdKPkmwuavMprsPspvfGHGy2adcaPRsbdR96C57d7ZP3oJck/ZaCWbAa3NnE4iCGHYA1g6VpM7mAccOs+PdKwihBc9FI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734901947; c=relaxed/simple; bh=K5Ac2frWxXsHvWOA3l5r05anP/s877huHjsrFI3mlcc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=NVIaKMGKl07Y82RO/4PHYKzYsd72vuppRPrpW6XF1+aRk/P2hT63RNEVd2USso7ZAUHuP59ZFCRZSxXqoF3FxOJI5862aFrrdGH2r4pZvTiYBNeLbXQdrjPh5wQKYAXMnpRCxUobKw07exa++B1YY+s0AXc/CNwRzPZhUvTH0sA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-21649a7bcdcso32661785ad.1 for ; Sun, 22 Dec 2024 13:12:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734901943; x=1735506743; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wE5e2WOSXp/NWUC/+YvPosS6kr1GCv/E5ydoWD1gMZ4=; b=TQ7aSXTOGhiVAiED+QgtMeXIt/os3RCBQqnYJf1ANfMhitwr3e8w2+TJLsMQQDZKUB ElVotmdXQGhhdAINa3PDAf/RisfxSUfJDXVRLXIfLWZTBShAfYw2p+ocBmO/od2LccSc 7nrGozs4xtn2/YC+jWKPvVORIWU+A8i4pI3ND569c2Cpo3jVCFshak2myfXPRtMpvILk bIVbuif3uoQSy58OFWswdgT0ShE0fnO1paPWqhNY2erk3jdCO55euk2ZnAVvDo1qynO/ 8xSdobm4NnRt/SvaVSgLATkUM2YwHSIU4o60zmRhgG5mG/EwE63lg96yYL0lR7NvVpN8 UnkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734901943; x=1735506743; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wE5e2WOSXp/NWUC/+YvPosS6kr1GCv/E5ydoWD1gMZ4=; b=PXh6EENf6fpWfBGo3o0fU+ndp4aOw2MMcNEcOkihnpCu0ExRyHVHRSS+cTOpOpfZov 6JVQp0yRpdepSgIwqOZmtcLazvEbFYHXptgXReAlIJCX/2M/6lh+Jn/eYH/Hv1YlQztb 02LaZSKkv1bz+nxYd5VsxVgWwdKeKJff7/92LGTfYWRqOfLmYbKAJjAKvIqrakR4/Ccu /JdLYca+CMTNZMMP866r2+i1YENtlORSeUeKMCypmhp9KbdxbK4MVFR7Nx5rFzjC/Sjm tAG9cPYtyJcDF/pEK7jPhBpSeVGeMF5aaFB/ImD8CxQzDdGo1bc6DE8xv1nX6ozUka87 m7Cw== X-Gm-Message-State: AOJu0YzdHIXQDGEfOmKK5PH02nkLY1k+IoynM9XRwZPrrSanpBxinLSS v1eJ6rpsxiP2Ll1YV+ea3g1Pp8K3zpZbLdakTVSHDSncX9ijwpab X-Gm-Gg: ASbGncvoC/MeXDZ/Bs7WG7gT/gSVLLHkv2l5niXV4gBzYV7DfSPO3dFPFTfc+mEhMeJ jsBCINBENB+pgs2B0W37Cxg+U/T9gu8FQdW/yRcDl5B8APgBpNgPleQTT9VaJw7RZAgjMDhkZM6 PT90079p9drvSJyOGm/v/xHSZJeaocxP0FXks8ghZBJsiX6rvd38vTFySfzoNULZDxA0uTSgqWa vJ3j9PhyiFCAwOAeCt/VjhnhXYM50GDw8xdpgv62V64zm70enkVe5oQTMx2IxzSMu8E8JM= X-Google-Smtp-Source: AGHT+IH+57TkdLVUEyWWyg/KoV3upT9uv8uv6pCnrdm5OFd4KWHlOJIxoN5bj4gSIEw32JXjKX4VTg== X-Received: by 2002:a17:902:f682:b0:212:67a5:ab2d with SMTP id d9443c01a7336-219e70c012dmr130320795ad.44.1734901943274; Sun, 22 Dec 2024 13:12:23 -0800 (PST) Received: from gnu-tgl-3.localdomain ([120.204.185.181]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc962940sm60780385ad.34.2024.12.22.13.12.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Dec 2024 13:12:22 -0800 (PST) Received: from gnu-tgl-3.lan (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id B7C3BC04EA; Mon, 23 Dec 2024 05:12:15 +0800 (CST) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: sam@gentoo.org, schwab@linux-m68k.org, Adhemerval Zanella Subject: [PATCH v2 6/6] stdio-common: Suppress Clang warnings on scanf13.c Date: Mon, 23 Dec 2024 05:12:03 +0800 Message-ID: <20241222211203.66704-7-hjl.tools@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241222211203.66704-1-hjl.tools@gmail.com> References: <20241222211203.66704-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3019.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org Suppress Clang warnings on stdio-common/scanf13.c: 1. Before this commit: scanf13.c:43:17: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier] 43 | "A%mS%10mls%4ml[bcd]%4mCB", &lsp1, &lsp2, &lsp3, &lsp4) != 4) | ~~~~^ scanf13.c:43:22: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier] 43 | "A%mS%10mls%4ml[bcd]%4mCB", &lsp1, &lsp2, &lsp3, &lsp4) != 4) | ~~~~^ scanf13.c:43:50: error: data argument not used by format string [-Werror,-Wformat-extra-args] 43 | "A%mS%10mls%4ml[bcd]%4mCB", &lsp1, &lsp2, &lsp3, &lsp4) != 4) | ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ scanf13.c:145:27: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier] 145 | if (sscanf (buf, "%2048mls%mlc", &lsp3, &lsp4) != 2) | ~~~~~~^ scanf13.c:145:31: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier] 145 | if (sscanf (buf, "%2048mls%mlc", &lsp3, &lsp4) != 2) | ~~~^ scanf13.c:145:43: error: data argument not used by format string [-Werror,-Wformat-extra-args] 145 | if (sscanf (buf, "%2048mls%mlc", &lsp3, &lsp4) != 2) | ~~~~~~~~~~~~~~ ^ scanf13.c:161:31: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier] 161 | if (sscanf (buf, "%4mC%1500ml[dr/]%548ml[abc/d]%3mlc", | ~~~~~~^ scanf13.c:161:42: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier] 161 | if (sscanf (buf, "%4mC%1500ml[dr/]%548ml[abc/d]%3mlc", | ~~~~~~~~~~^ scanf13.c:161:53: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier] 161 | if (sscanf (buf, "%4mC%1500ml[dr/]%548ml[abc/d]%3mlc", | ~~~~~~~~~~^ scanf13.c:162:15: error: data argument not used by format string [-Werror,-Wformat-extra-args] 161 | if (sscanf (buf, "%4mC%1500ml[dr/]%548ml[abc/d]%3mlc", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 162 | &lsp1, &lsp2, &lsp3, &lsp4) != 4) | ^ 10 errors generated. 2. With DIAG_IGNORE_NEEDS_COMMENT_CLANG changes in stdio-common/scanf13.c: scanf13.c:28:40: error: 'sscanf' may overflow; destination buffer in argument 4 has size 8, but the corresponding specifier may require size 11 [-Werror,-Wfortify-source] 28 | "A%ms%10ms%4m[bcd]%4mcB", &sp1, &sp2, &sp3, &sp4) != 4) | ^ scanf13.c:94:34: error: 'sscanf' may overflow; destination buffer in argument 3 has size 8, but the corresponding specifier may require size 2049 [-Werror,-Wfortify-source] 94 | if (sscanf (buf, "%2048ms%mc", &sp3, &sp4) != 2) | ^ scanf13.c:110:61: error: 'sscanf' may overflow; destination buffer in argument 4 has size 8, but the corresponding specifier may require size 1501 [-Werror,-Wfortify-source] 110 | if (sscanf (buf, "%4mc%1500m[dr/]%548m[abc/d]%3mc", &sp1, &sp2, &sp3, &sp4) | ^ scanf13.c:110:67: error: 'sscanf' may overflow; destination buffer in argument 5 has size 8, but the corresponding specifier may require size 549 [-Werror,-Wfortify-source] 110 | if (sscanf (buf, "%4mc%1500m[dr/]%548m[abc/d]%3mc", &sp1, &sp2, &sp3, &sp4) | ^ 4 errors generated. Co-Authored-By: Adhemerval Zanella Signed-off-by: H.J. Lu Reviewed-by: Sam James --- stdio-common/Makefile | 2 ++ stdio-common/scanf13.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/stdio-common/Makefile b/stdio-common/Makefile index e5b4ce9e00..3f84de3e36 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -646,6 +646,8 @@ CFLAGS-dprintf.c += $(config-cflags-wno-ignored-attributes) CFLAGS-_itoa.o = $(no-stack-protector) CFLAGS-_itoa.op = $(no-stack-protector) +CFLAGS-scanf13.c += $(test-config-cflags-wno-fortify-source) + # scanf18.c and scanf19.c test a deprecated extension which is no # longer visible under most conformance levels; see the source files # for more detail. diff --git a/stdio-common/scanf13.c b/stdio-common/scanf13.c index 60aa62a26f..65b1429720 100644 --- a/stdio-common/scanf13.c +++ b/stdio-common/scanf13.c @@ -3,6 +3,7 @@ #include #include #include +#include int main (void) @@ -20,6 +21,9 @@ main (void) } while (0) setlocale (LC_ALL, "de_DE.UTF-8"); + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-invalid-specifier"); + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-extra-args"); if (sscanf ("A \xc3\x84-\t\t\xc3\x84-abcdefbcd\t\xc3\x84-B", "A%ms%10ms%4m[bcd]%4mcB", &sp1, &sp2, &sp3, &sp4) != 4) FAIL (); @@ -57,6 +61,7 @@ main (void) FAIL (); free (lsp4); } + DIAG_POP_NEEDS_COMMENT_CLANG; memset (buf, '/', sizeof (buf)); buf[0] = '\t'; @@ -142,6 +147,9 @@ main (void) FAIL (); free (lsp2); } + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-invalid-specifier"); + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-extra-args"); if (sscanf (buf, "%2048mls%mlc", &lsp3, &lsp4) != 2) FAIL (); else @@ -182,6 +190,7 @@ main (void) FAIL (); free (lsp4); } + DIAG_POP_NEEDS_COMMENT_CLANG; return result; }