From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id EC349398C000 for ; Fri, 19 Feb 2021 15:10:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EC349398C000 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-4-5P5gJ9spMQCpGlxwwAK5Iw-1; Fri, 19 Feb 2021 10:10:25 -0500 X-MC-Unique: 5P5gJ9spMQCpGlxwwAK5Iw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B9564BBEE3 for ; Fri, 19 Feb 2021 15:10:24 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-113-131.ams2.redhat.com [10.36.113.131]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1CFBD1970D for ; Fri, 19 Feb 2021 15:10:23 +0000 (UTC) From: Florian Weimer To: libc-stable@sourceware.org Subject: [PATCH 2.33 COMMITTED] string: Work around GCC PR 98512 in rawmemchr Date: Fri, 19 Feb 2021 16:10:59 +0100 Message-ID: <871rdcay9o.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-stable@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-stable mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 15:10:30 -0000 (cherry picked from commit 044e603b698093cf48f6e6229e0b66acf05227e4) --- string/rawmemchr.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/string/rawmemchr.c b/string/rawmemchr.c index 59bbeeaa42..b8523118e5 100644 --- a/string/rawmemchr.c +++ b/string/rawmemchr.c @@ -22,24 +22,28 @@ # define RAWMEMCHR __rawmemchr #endif +/* The pragmata should be nested inside RAWMEMCHR below, but that + triggers GCC PR 98512. */ +DIAG_PUSH_NEEDS_COMMENT; +#if __GNUC_PREREQ (7, 0) +/* GCC 8 warns about the size passed to memchr being larger than + PTRDIFF_MAX; the use of SIZE_MAX is deliberate here. */ +DIAG_IGNORE_NEEDS_COMMENT (8, "-Wstringop-overflow="); +#endif +#if __GNUC_PREREQ (11, 0) +/* Likewise GCC 11, with a different warning option. */ +DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overread"); +#endif + /* Find the first occurrence of C in S. */ void * RAWMEMCHR (const void *s, int c) { - DIAG_PUSH_NEEDS_COMMENT; -#if __GNUC_PREREQ (7, 0) - /* GCC 8 warns about the size passed to memchr being larger than - PTRDIFF_MAX; the use of SIZE_MAX is deliberate here. */ - DIAG_IGNORE_NEEDS_COMMENT (8, "-Wstringop-overflow="); -#endif -#if __GNUC_PREREQ (11, 0) - /* Likewise GCC 11, with a different warning option. */ - DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overread"); -#endif if (c != '\0') return memchr (s, c, (size_t)-1); - DIAG_POP_NEEDS_COMMENT; return (char *)s + strlen (s); } libc_hidden_def (__rawmemchr) weak_alias (__rawmemchr, rawmemchr) + +DIAG_POP_NEEDS_COMMENT;