From patchwork Wed Jan 31 12:04:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 194718 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1837736dyb; Wed, 31 Jan 2024 04:05:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IE0lIRndaisvFux/ileBNnMLDttnyqskMpjDBQQcIKq2PV/MEL2pJW2PMb0sbcVzvTXNMj7 X-Received: by 2002:a05:622a:242:b0:42b:ee47:2307 with SMTP id c2-20020a05622a024200b0042bee472307mr418056qtx.59.1706702744961; Wed, 31 Jan 2024 04:05:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706702744; cv=pass; d=google.com; s=arc-20160816; b=BtQoUBrs1GSkVtyZS63AVDtl+/m66C4ksnMz9PncHNrz5/HVIjPopl7DaUf8OiVKIo ZH0E9vfiDs2lUgIgjlE8iHW0it8cqwIEa6RoSebj5rMUEKeOFFbym6jQGLBtNq3kn4zo t8zBna2rMDa987daXRbwBeP9391QKbJtqn2NCHOWMGSY0l9LishN0pDqJf+rLAa1xtkY tWVys4tGKMATZ8VD/3G22dtBs9xuyuClCnezCxqWXjXw51sOzncxkpww53V+mJILRgH4 F/STAgpT+S0qbU43j9CCnGPzhA7hAG62clqA2n/iNLUxHufC1HNdpptCrN/pI5eKTaO+ yKBw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :content-disposition:in-reply-to:mime-version:references:message-id :subject:cc:to:from:date:dkim-signature:arc-filter:dmarc-filter :delivered-to; bh=yyBgfon5gLvEFzACelDOfbi4jrYsAA/PnhPD3NcT8as=; fh=0LzS6HuAsVUJTzKOSA/YnzhtPJ5ASqdmSnsfnMDRTdU=; b=Dv3mEgHJ4CZ2geY82s81qJWQRrVfJWo/IS51wh/rffySx4P9/V8nk/8bwM8KLHCmaZ QxwR4B8I0s02nmEAhSy1DrjeIbMAUiXwsPPMFVDdIh3TWfNCSt6cAcD6Y6DDiZzRek00 uWTVuZ59DPdt7DR84UxJ1FuJk4x/J7p3gHYg72kNL+ycZvRDGNRJMVbG0cPDyGSB60U4 Qy2zAva98VSr4HQUyZ2byhmcwQcxw0kqw1RAnNPisWuchrXvxIn1MGqKgzP5hKX8ec9i rcYDVUFD/R9xXYr6uJSbxdoXHnlnjBfpMPWYyucSROMbNefJ7BRN1SuyvTkwKlYCAyy2 lLIg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MumuFDLU; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=1; AJvYcCXZBOc+VKo5uONsqCYHGrsqVEdXBbrpGPHwLJMzi7YLia1gG7jU2yr5te7XxCjQknYm73cGbmHn70sV+paNmMOHofrvBQ== Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id a10-20020a05622a064a00b00429a56bbfe9si11759731qtb.687.2024.01.31.04.05.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 04:05:44 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MumuFDLU; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 91CFC3858011 for ; Wed, 31 Jan 2024 12:05:44 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id C13443858014 for ; Wed, 31 Jan 2024 12:04:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C13443858014 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C13443858014 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706702671; cv=none; b=rwTekDKSdyojR6zljPPIU29by+0ynxRZmr6Ntpj3mNZ95tcRRBeCdLp4jcfxYrDOVyXMlUukt+G8gvX/xhPxRU2XreWBbM2w3zKpe+lKSNXBonJfMEdOg8XDVCE3ZqJXhVqhS2xhwGYg6X+e4JVfyCCa8ZMOfiUhw5Px/YSrkP4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706702671; c=relaxed/simple; bh=dUn32fF/GFgPAw/rsYuHNoFMpL9jCZa6CW3li2WqtLE=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=fqspNCXqwT3YdHad2V2v+WFiyBr8pz8sCcX6ynB3UIwl0lYo5iqT5jPQWtWponDpGZRWc6FUuekMj97+7diKgYB/zFg63OFvl12SGKOBkJBwXM1D55+pYLJYZrUs/EUT01kmQYSKfnSa0Jh/BZYGYLL/wBDmQWFo1epPzfoXiKI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706702667; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yyBgfon5gLvEFzACelDOfbi4jrYsAA/PnhPD3NcT8as=; b=MumuFDLUheM78bsh33Md2PdJzPjd0mq8YKokqYsyHkIKZfuJvmB+/ZIrIhmfe0TlnDfll3 FbqHWt9bFtcoDbMqrWjTPGkT7mvBgzVSxSVazbneCEoZYDTOg5pC2WyfWdHWoKj8chOhCy jBi2UJf8jq5LDJmsi37WohblTqymn5c= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-501-dBMdapCdMYm_8m0Y6Z6JpQ-1; Wed, 31 Jan 2024 07:04:24 -0500 X-MC-Unique: dBMdapCdMYm_8m0Y6Z6JpQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 01B3A10C04E4; Wed, 31 Jan 2024 12:04:24 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B941C1121312; Wed, 31 Jan 2024 12:04:23 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 40VC4Lpr286618 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 31 Jan 2024 13:04:21 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 40VC4K8t286617; Wed, 31 Jan 2024 13:04:20 +0100 Date: Wed, 31 Jan 2024 13:04:20 +0100 From: Jakub Jelinek To: Iain Sandoe Cc: GCC Patches Subject: [PATCH] libgcc: Avoid warnings on __gcc_nested_func_ptr_created [PR113402] Message-ID: References: <20240118145923.25112-1-iain@sandoe.co.uk> <147CA2E9-770F-48EA-9408-18C7090D05A6@sandoe.co.uk> MIME-Version: 1.0 In-Reply-To: <147CA2E9-770F-48EA-9408-18C7090D05A6@sandoe.co.uk> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789607537108792077 X-GMAIL-MSGID: 1789607537108792077 On Sun, Jan 28, 2024 at 11:02:33AM +0000, Iain Sandoe wrote: > * config/aarch64/heap-trampoline.c: Rename > __builtin_nested_func_ptr_created to __gcc_nested_func_ptr_created and > __builtin_nested_func_ptr_deleted to __gcc_nested_func_ptr_deleted. > * config/i386/heap-trampoline.c: Likewise. > * libgcc2.h: Likewise. I'm seeing hundreds of In file included from ../../../libgcc/libgcc2.c:56: ../../../libgcc/libgcc2.h:32:13: warning: conflicting types for built-in function ‘__gcc_nested_func_ptr_created’; expected ‘void(void *, void *, void *)’ [-Wbuiltin-declaration-mismatch] 32 | extern void __gcc_nested_func_ptr_created (void *, void *, void **); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warnings. Either we need to add like in r14-6218 #pragma GCC diagnostic ignored "-Wbuiltin-declaration-mismatch" (but in that case because of the libgcc2.h prototype (why is it there?) it would need to be also with #pragma GCC diagnostic push/pop around), or we could go with just following how the builtins are prototyped on the compiler side and only cast to void ** when dereferencing (which is in a single spot in each TU). 2024-01-31 Jakub Jelinek * libgcc2.h (__gcc_nested_func_ptr_created): Change type of last argument from void ** to void *. * config/i386/heap-trampoline.c (__gcc_nested_func_ptr_created): Change type of dst from void ** to void * and cast dst to void ** before dereferencing it. * config/aarch64/heap-trampoline.c (__gcc_nested_func_ptr_created): Likewise. Jakub --- libgcc/libgcc2.h.jj 2024-01-29 09:41:20.096387494 +0100 +++ libgcc/libgcc2.h 2024-01-31 12:43:22.702694509 +0100 @@ -29,7 +29,7 @@ see the files COPYING3 and COPYING.RUNTI #pragma GCC visibility push(default) #endif -extern void __gcc_nested_func_ptr_created (void *, void *, void **); +extern void __gcc_nested_func_ptr_created (void *, void *, void *); extern void __gcc_nested_func_ptr_deleted (void); extern int __gcc_bcmp (const unsigned char *, const unsigned char *, size_t); --- libgcc/config/i386/heap-trampoline.c.jj 2024-01-31 10:46:36.491743132 +0100 +++ libgcc/config/i386/heap-trampoline.c 2024-01-31 12:44:44.449550698 +0100 @@ -26,7 +26,7 @@ int get_trampolines_per_page (void); struct tramp_ctrl_data *allocate_tramp_ctrl (struct tramp_ctrl_data *parent); void *allocate_trampoline_page (void); -void __gcc_nested_func_ptr_created (void *chain, void *func, void **dst); +void __gcc_nested_func_ptr_created (void *chain, void *func, void *dst); void __gcc_nested_func_ptr_deleted (void); static const uint8_t trampoline_insns[] = { @@ -115,7 +115,7 @@ allocate_tramp_ctrl (struct tramp_ctrl_d HEAP_T_ATTR void -__gcc_nested_func_ptr_created (void *chain, void *func, void **dst) +__gcc_nested_func_ptr_created (void *chain, void *func, void *dst) { if (tramp_ctrl_curr == NULL) { @@ -158,7 +158,7 @@ __gcc_nested_func_ptr_created (void *cha __builtin___clear_cache ((void *)trampoline->insns, ((void *)trampoline->insns + sizeof(trampoline->insns))); - *dst = &trampoline->insns; + *(void **) dst = &trampoline->insns; } HEAP_T_ATTR --- libgcc/config/aarch64/heap-trampoline.c.jj 2024-01-31 10:46:36.491743132 +0100 +++ libgcc/config/aarch64/heap-trampoline.c 2024-01-31 12:45:11.282175257 +0100 @@ -26,7 +26,7 @@ int get_trampolines_per_page (void); struct tramp_ctrl_data *allocate_tramp_ctrl (struct tramp_ctrl_data *parent); void *allocate_trampoline_page (void); -void __gcc_nested_func_ptr_created (void *chain, void *func, void **dst); +void __gcc_nested_func_ptr_created (void *chain, void *func, void *dst); void __gcc_nested_func_ptr_deleted (void); #if defined(__gnu_linux__) @@ -115,7 +115,7 @@ allocate_tramp_ctrl (struct tramp_ctrl_d HEAP_T_ATTR void -__gcc_nested_func_ptr_created (void *chain, void *func, void **dst) +__gcc_nested_func_ptr_created (void *chain, void *func, void *dst) { if (tramp_ctrl_curr == NULL) { @@ -158,7 +158,7 @@ __gcc_nested_func_ptr_created (void *cha __builtin___clear_cache ((void *)trampoline->insns, ((void *)trampoline->insns + sizeof(trampoline->insns))); - *dst = &trampoline->insns; + *(void **) dst = &trampoline->insns; } HEAP_T_ATTR