Message ID | 6defa548-2da3-6cba-0372-f1e6c6b64c81@suse.cz |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp792271wrt; Fri, 6 Jan 2023 04:22:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXs78v8G5T1dWEq8s8ZAQbqC3CnL37fez9E3qy/O4NPFsis09a00TqZ8v4Mf9SrhZn2k39ya X-Received: by 2002:a17:907:d50e:b0:7b1:316c:38f5 with SMTP id wb14-20020a170907d50e00b007b1316c38f5mr49111389ejc.30.1673007734318; Fri, 06 Jan 2023 04:22:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673007734; cv=none; d=google.com; s=arc-20160816; b=tAnWoyLp/d8RLjFCD6qdes5FpbBvfoinZY1T5orOqcn3UpcVAdckmvlRO/foMjUQVu UIr6NojV0RSNFFr7ZSekl6HzI85XFt3r87MdK01Depxf/og0FX+4bfzmMEO8+hLQJvtQ e12LMsEVvU4m73sKAqYV/8AhTxlLsaGt+2gZ2xBcywYxeBYlZIHm5HmvvjdsG4rg42fo +g6nNT3WF2LxYdYFCuwW0OkDotIyyGPATcMgo+WCqreF5DvM37hZeFlZq/A5IgBoWdcI lxFwflKO/FiuJXefXRmAd6kLnR3EbQfhnh7LqKCy1trgfLLLXYkylpNJOlLMKfYZeNpN o4xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding:cc :content-language:to:subject:from:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature:dmarc-filter:delivered-to; bh=jI+xEh1SyPVD0tZltRz937GQohFGmrkbE+on9JA6NMg=; b=r9tJcr0olA2I5wQk0XTDmAqt6XSjj+SSdx7Z9ey9aBdoatdeQknE1Gw2YqAnWbTbG4 6NQlkCq1/v7xSaAJIlWHBes4Smt9Loaye7d0BHZLLsDdmsyaJQa8lxoy+tn5lSipkfQ1 Kii84aeXM2gt5bmH4Y9yycWUxiMAQ5jhUrTNv85dfu5eCS0Xq5tKyBbgdi6h8CPSoJ+G 7Kujsu8ZfSOIFpHX+leDxQrPRUQEeyVJORnIWtx/kBnt12TYl4fZ/GBcrI3sYHUwlyGc wxODVF+fGj5Q/EJG3bVf1gG4Zhvnh2rxVmk44BTsSRH1+Q1O61G0ucvxGsnam0WYjU7B rwkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="h/62xguA"; dkim=neutral (no key) header.i=@gcc.gnu.org header.s=susede2_ed25519; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id x8-20020a05640226c800b0048e9a300a48si1815929edd.451.2023.01.06.04.22.14 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jan 2023 04:22:14 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="h/62xguA"; dkim=neutral (no key) header.i=@gcc.gnu.org header.s=susede2_ed25519; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8AB0D38493C5 for <ouuuleilei@gmail.com>; Fri, 6 Jan 2023 12:21:52 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 494313858D28 for <gcc-patches@gcc.gnu.org>; Fri, 6 Jan 2023 12:21:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 494313858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E8431249F0; Fri, 6 Jan 2023 12:21:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1673007686; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jI+xEh1SyPVD0tZltRz937GQohFGmrkbE+on9JA6NMg=; b=h/62xguA/42PlFWKm2/M1WyAFlvoMnGS85RvlSXR7h6RiKwrXaW7ALVsvWdxeTp/+PSU5Y d4sjMCp3QYmiA0JmPWcU63o5dIHxhQLbJANRRxIFTet8E+tfSAzr9ewnAFMcuEb/gQeJjm Kn9ui5DXbn7n5IVQe9rGFz6e5Ykdnws= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1673007686; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jI+xEh1SyPVD0tZltRz937GQohFGmrkbE+on9JA6NMg=; b=lMIsK+oLUv9/p2ZfnG+72hPGey7KcTHiNtefwa+rPA1ZkE5XIqETjsqCL0MXPAYtz/VTbB 5g+IoCduFJyWOLDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D227313596; Fri, 6 Jan 2023 12:21:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id lLR4MkYSuGOIPAAAMHmgww (envelope-from <mliska@suse.cz>); Fri, 06 Jan 2023 12:21:26 +0000 Message-ID: <6defa548-2da3-6cba-0372-f1e6c6b64c81@suse.cz> Date: Fri, 6 Jan 2023 13:21:26 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 From: =?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz> Subject: [PATCH] Remove legacy pre-C++ 11 definitions To: gcc-patches@gcc.gnu.org Content-Language: en-US Cc: Jonathan Wakely <jwakely.gcc@gmail.com>, Andrew Pinski <pinskia@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754275758203526614?= X-GMAIL-MSGID: =?utf-8?q?1754275758203526614?= |
Series |
Remove legacy pre-C++ 11 definitions
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Martin Liška
Jan. 6, 2023, 12:21 p.m. UTC
As mentioned in the PRs, both are defined in C++ 11 which is a version we depend on. Ready to be installed now? Thanks, Martin PR middle-end/108311 PR middle-end/108312 gcc/ChangeLog: * system.h (va_copy): Remove as it is defined in C++ 11. (NULL): Likewise. --- gcc/system.h | 13 ------------- 1 file changed, 13 deletions(-)
Comments
On Fri, Jan 6, 2023 at 4:21 AM Martin Liška <mliska@suse.cz> wrote: > > As mentioned in the PRs, both are defined in C++ 11 > which is a version we depend on. > > Ready to be installed now? There is another #define NULL below: /* System headers may define NULL to be an integer (e.g. 0L), which cannot be used safely in certain contexts (e.g. as sentinels). Redefine NULL to nullptr in order to make it safer. Note that this might confuse system headers, however, by convention they must not be included after this point. */ #ifdef __cplusplus #undef NULL #define NULL nullptr #endif Thanks, Andrew Pinski > > Thanks, > Martin > > PR middle-end/108311 > PR middle-end/108312 > > gcc/ChangeLog: > > * system.h (va_copy): Remove as it is defined in C++ 11. > (NULL): Likewise. > --- > gcc/system.h | 13 ------------- > 1 file changed, 13 deletions(-) > > diff --git a/gcc/system.h b/gcc/system.h > index 5eaeb9d2d03..0d06b9749e5 100644 > --- a/gcc/system.h > +++ b/gcc/system.h > @@ -31,25 +31,12 @@ along with GCC; see the file COPYING3. If not see > /* We must include stdarg.h before stdio.h. */ > #include <stdarg.h> > > -#ifndef va_copy > -# ifdef __va_copy > -# define va_copy(d,s) __va_copy (d, s) > -# else > -# define va_copy(d,s) ((d) = (s)) > -# endif > -#endif > - > #ifdef HAVE_STDDEF_H > # include <stddef.h> > #endif > > #include <stdio.h> > > -/* Define a generic NULL if one hasn't already been defined. */ > -#ifndef NULL > -#define NULL 0 > -#endif > - > /* Use the unlocked open routines from libiberty. */ > > /* Some of these are #define on some systems, e.g. on AIX to redirect > -- > 2.39.0 >
On Fri, 6 Jan 2023, 17:21 Andrew Pinski, <pinskia@gmail.com> wrote: > On Fri, Jan 6, 2023 at 4:21 AM Martin Liška <mliska@suse.cz> wrote: > > > > As mentioned in the PRs, both are defined in C++ 11 > > which is a version we depend on. > > > > Ready to be installed now? > > There is another #define NULL below: > /* System headers may define NULL to be an integer (e.g. 0L), which cannot > be > used safely in certain contexts (e.g. as sentinels). Redefine NULL to > nullptr in order to make it safer. Note that this might confuse system > headers, however, by convention they must not be included after this > point. > */ > #ifdef __cplusplus > #undef NULL > #define NULL nullptr > #endif > Seems to me that GCC code should just use nullptr directly not redefine NULL. Thanks, > Andrew Pinski > > > > > Thanks, > > Martin > > > > PR middle-end/108311 > > PR middle-end/108312 > > > > gcc/ChangeLog: > > > > * system.h (va_copy): Remove as it is defined in C++ 11. > > (NULL): Likewise. > > --- > > gcc/system.h | 13 ------------- > > 1 file changed, 13 deletions(-) > > > > diff --git a/gcc/system.h b/gcc/system.h > > index 5eaeb9d2d03..0d06b9749e5 100644 > > --- a/gcc/system.h > > +++ b/gcc/system.h > > @@ -31,25 +31,12 @@ along with GCC; see the file COPYING3. If not see > > /* We must include stdarg.h before stdio.h. */ > > #include <stdarg.h> > > > > -#ifndef va_copy > > -# ifdef __va_copy > > -# define va_copy(d,s) __va_copy (d, s) > > -# else > > -# define va_copy(d,s) ((d) = (s)) > > -# endif > > -#endif > > - > > #ifdef HAVE_STDDEF_H > > # include <stddef.h> > > #endif > > > > #include <stdio.h> > > > > -/* Define a generic NULL if one hasn't already been defined. */ > > -#ifndef NULL > > -#define NULL 0 > > -#endif > > - > > /* Use the unlocked open routines from libiberty. */ > > > > /* Some of these are #define on some systems, e.g. on AIX to redirect > > -- > > 2.39.0 > > >
On 1/6/23 19:23, Jonathan Wakely wrote:
> Seems to me that GCC code should just use nullptr directly not redefine NULL.
Sure, but that would lead to a huge patch which would rename NULL to nullptr, right?
Martin
On Mon, 9 Jan 2023 at 15:17, Martin Liška <mliska@suse.cz> wrote: > > On 1/6/23 19:23, Jonathan Wakely wrote: > > Seems to me that GCC code should just use nullptr directly not redefine NULL. > > Sure, but that would lead to a huge patch which would rename NULL to nullptr, right? Yeah, which can probably be done separately (or not done at all). I was just commenting on the comment that Andrew showed. That comment explain that nullptr is better than 0 as a null pointer constant, which is a good reason to prefer nullptr. But not a good reason to redefine NULL; in code with a minimum requirement of C++11 you can just use nullptr directly.
On 1/9/23 16:19, Jonathan Wakely wrote: > On Mon, 9 Jan 2023 at 15:17, Martin Liška <mliska@suse.cz> wrote: >> >> On 1/6/23 19:23, Jonathan Wakely wrote: >>> Seems to me that GCC code should just use nullptr directly not redefine NULL. >> >> Sure, but that would lead to a huge patch which would rename NULL to nullptr, right? > > > Yeah, which can probably be done separately (or not done at all). That would be a massive patch affecting all targets and FEs. > I was just commenting on the comment that Andrew showed. That comment > explain that nullptr is better than 0 as a null pointer constant, > which is a good reason to prefer nullptr. But not a good reason to > redefine NULL; in code with a minimum requirement of C++11 you can > just use nullptr directly. Ok, so does it mean my patch addresses what can be easily adjusted? Thanks, Martin
diff --git a/gcc/system.h b/gcc/system.h index 5eaeb9d2d03..0d06b9749e5 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -31,25 +31,12 @@ along with GCC; see the file COPYING3. If not see /* We must include stdarg.h before stdio.h. */ #include <stdarg.h> -#ifndef va_copy -# ifdef __va_copy -# define va_copy(d,s) __va_copy (d, s) -# else -# define va_copy(d,s) ((d) = (s)) -# endif -#endif - #ifdef HAVE_STDDEF_H # include <stddef.h> #endif #include <stdio.h> -/* Define a generic NULL if one hasn't already been defined. */ -#ifndef NULL -#define NULL 0 -#endif - /* Use the unlocked open routines from libiberty. */ /* Some of these are #define on some systems, e.g. on AIX to redirect