From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [96.47.72.81]) by sourceware.org (Postfix) with ESMTPS id BFBBA3858D39 for ; Tue, 28 Mar 2023 15:10:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BFBBA3858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 4PmClx5qtlz3FXs; Tue, 28 Mar 2023 15:10:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PmClx4ztTz3KKs; Tue, 28 Mar 2023 15:10:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680016205; h=from:from: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=zp7KhFfW7yoXh6dkhEGuFLg1flsOQVGz3Kb4fFsb6/I=; b=xJmAi/KPS9t+0ArQADUIO/IxjP/zqyKUf+7LfJA1ybfBnq46pmlLKCGnGZBcCBg+f/Yn9o pypI3FIqielkXn1aKGRT1mVxh9IxcW2g+5sl0tjyDXkJA0dHfTtQ3o/7Mz8uxe8igLZKPZ MXvacmDB+faAoDO6pUJwWabHArkWhjFthCFpnfdcFu/oZ2ctvUGNlFetTiexBReKnj0Fod d/UDpLiF/qkLFvRiAvd6LWTmkBy/+DAPBHtacYKpynnyWEsRCjJgefcS2+beCr7pYV9EkG pQRXWf01j6ov2JXmURR/Wi1xt5VSStkdT4K82FpSLVt2r44EsAEaFHnV9MfdVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680016205; h=from:from: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=zp7KhFfW7yoXh6dkhEGuFLg1flsOQVGz3Kb4fFsb6/I=; b=oiooCpD+8vUpOlYUUozkmxygYYIvjihs46HwQxQGdd0HzV0iUBIvUu1L6bXJQMvNrBY7GE rpHbzD1OpJdzu000dy/IJ625B1voFjTdLneDsPUqe9VN6HMkHNJpBuzTn3GGbaUPCvo2EE EymNoQmCh0fGyiVEXnVHEp/nNy8tWMgdSeZ0pwcJFo9XElBeKr8ZS7M211ID6AW1HjmfSS 6r5fJlqVUbBqo5jvfgCRWRi2Q6Ao2I5jkq7UObhxpkPlzXyXxv9ijOzNSKW3YJxKQ6nSyt ExM74tHFYh7LGNSl6sDYGNJ++qiVmi70JZ+cVKF5HcGMqNdgpn0xRGibzkFifg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1680016205; a=rsa-sha256; cv=none; b=OqtO0njppCngvylLfygPanoB+m4vEMKAuSAED/d4Y3PgdZO4+NnHtpzEDI5KGQekxgr19q lZLb82pR20soi+KayOmVPX4wzSuqPr0ViVWi++tE1wgwpmoGbbkRipfX6hBg62JnaaCr+4 Z+iIalG2VM2l0e/ZOr1nBFIIcwTchrEkUrM4JUk6NdmJfB7Wy6hnLyUyA9eJQlLw5cBbsc v68oMy0R+SaBb3eGzC+Q/gAVymOKA8WBkFqbtv1ZrunaiLfKfiXZId8cmQW2kK8YK3+WAM +zadBzWz0F8+iSGywqr6sGFhhblPMzpz2xW081pHL9qXXM+Go2YSA0rFTLtJQA== Received: from [IPV6:2601:648:8680:16b0:2d4e:165:cff:1385] (unknown [IPv6:2601:648:8680:16b0:2d4e:165:cff:1385]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4PmClx11jhzf6N; Tue, 28 Mar 2023 15:10:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <7657bb99-0319-ed79-fe2a-fb74a3876798@FreeBSD.org> Date: Tue, 28 Mar 2023 08:10:02 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH] gdb: fix -Wdeprecated-declarations on macOS Content-Language: en-US To: Simon Marchi , Enze Li , gdb-patches@sourceware.org Cc: enze.li@gmx.com References: <6379554d-4e45-0ff8-a972-47596ea83b90@simark.ca> From: John Baldwin In-Reply-To: <6379554d-4e45-0ff8-a972-47596ea83b90@simark.ca> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 List-Id: On 3/28/23 7:55 AM, Simon Marchi via Gdb-patches wrote: > 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? Even if vfork is deprecated, you still want to use it instead of fork I think as long as it exists. The real fix is to add a patch to use posix_spawn to fork the shell instead of vfork when posix_spawn exists. posix_spawn is just a wrapper around vfork + execve on FreeBSD's libc for example (I haven't looked to see what it is on Linux but suspect it is similar). -- John Baldwin