From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 5719C3858D39 for ; Tue, 28 Mar 2023 14:55:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5719C3858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [172.16.0.146] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 764C91E0D2; Tue, 28 Mar 2023 10:55:32 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1680015332; bh=ijelKIe4lzX2qoILkseyYuobKgJrQZb+DfxTjzSy8xY=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=GazCgnGSiCWLPkppKkwIxmcIAbIQDEw08EyxyNO5108BdTiqkuPK8n9eXSg+V9aDE XTMemWkqomGpWvGn5fWbwVK/CgESdhQ+kA0UPCF287unspNzx3MLxvIjPyZKU2MLjd 32CIufKkdxUpuV3fb0aQR2YfW6y++YQ0dnfteGwc= Message-ID: <6379554d-4e45-0ff8-a972-47596ea83b90@simark.ca> Date: Tue, 28 Mar 2023 10:55:32 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH] gdb: fix -Wdeprecated-declarations on macOS To: Enze Li , gdb-patches@sourceware.org Cc: enze.li@gmx.com References: Content-Language: fr From: Simon Marchi In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS,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 List-Id: On 3/28/23 10:16, Enze Li via Gdb-patches wrote: > I noticed that there are some issues when compiling on macOS. There are > a few places where errors like the following are reported, > > ====== > CXX cli/cli-cmds.o > cli/cli-cmds.c:929:14: error: 'vfork' is deprecated: Use posix_spawn or fork [-Werror,-Wdeprecated-declarations] > if ((pid = vfork ()) == 0) > ^ > /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:604:1: note: 'vfork' has been explicitly marked deprecated here > __deprecated_msg("Use posix_spawn or fork") > ^ > /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:208:48: note: expanded from macro '__deprecated_msg' > #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) > ^ > 1 error generated. > ====== > > This patch is only available for the macOS platform. This is done by > using macros to differentiate between specific platforms. > > Tested by rebuilding both on x86_64 linux and macOS Big Sur. Any idea why vfork is deprecated on macOS? I can't find any answer online. I think it would be good to have a gdb_ util function with the ifdef at a single place, with an appropriate comment. I don't know how to call this function though. Would calling it gdb_vfork be misleading, because it won't always vfork? Simon