From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by sourceware.org (Postfix) with ESMTPS id 7FED53858D32 for ; Thu, 25 May 2023 16:58:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7FED53858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-96f53c06babso158259366b.3 for ; Thu, 25 May 2023 09:58:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685033890; x=1687625890; h=mime-version:references:in-reply-to:message-id:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=zpljmhJWlDBCz4PJEmuHackonGBgXGYTQWee8VVQpUo=; b=Ok5G49c3UBVll+KmJEp3jcH6SpXh1PggA6HTnnKDHnF59f9jlXLkywOnOWZlNrikZ0 JIWtNeTOjgVX6kVQGCWtNcVOqp01bZIQA0DyWUZcVOhP2+cwDDx+1FttwSNrKu2rQN+d EFKelob0O2mjHV2i80Tc22f98T/isefMu6vge1hA/hL0fWS6J6BjSskNJ3XFfh9qY1/q LZQBo606Qp4zBV/xT/ZyjAx8jHM8Qw3R2a2WOLXRvs1IeHEgPDYLDEUqao2NQtP20Dmw E5sw+WBKWcYZW2EQo7Rc9sOB1DvC/QPY8qcLPqo2IwT2ZnY5UISDSEdmyrWNvFX6e6DJ Qfcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685033890; x=1687625890; h=mime-version:references:in-reply-to:message-id:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zpljmhJWlDBCz4PJEmuHackonGBgXGYTQWee8VVQpUo=; b=Mhriyty0I0Fa2UizrKrZJHQ0hfLLc754Y7ogUXW4J4va3Sl5sGhIF7PKa2zBHtaxV7 opri1vFW90Mn9IZ6o+ZhKAhk+iKoT9wN238rvwcWEf8TH7BlbbrFNlRIl2Nwl4Ti7fiu PUhicx9wAryIjqgcvxWjtkkHIyZeeWAS6OtGBtXqnVQ0glYZEdRJw8P7H9DgI3yQg8l1 y+8CayLfnAI3tDrQwiIO7XMrM2+LJmtM51CYDEib1PSQqLkeED6fO4Ag2nTr7zx+BLTL rgWdjXOPbkgjVWW4YP+r+c9e6cagz9w6ktui8ra8NyQgRI35RvB5S3U9cqJha9emtzZF L83g== X-Gm-Message-State: AC+VfDzaoo9x/1j+UKeuInSv45In6g9P7aQmcn3IUliYak/n9n7QWMFu m01IAkvFdmspdTRmCuF2bt4= X-Google-Smtp-Source: ACHHUZ6Q4xVbGw/EWzp+ZVaokisRw1bes7PzLnBnu2Qmj4ICjGfKeqY8BHm1cyZPznYJv4KkVW0gBg== X-Received: by 2002:a17:907:807:b0:96a:246b:c65d with SMTP id wv7-20020a170907080700b0096a246bc65dmr2204272ejb.12.1685033889591; Thu, 25 May 2023 09:58:09 -0700 (PDT) Received: from nbbrfq.loc (80-110-214-113.static.upcbusiness.at. [80.110.214.113]) by smtp.gmail.com with ESMTPSA id d21-20020a170906371500b0094f1fe1696bsm1059197ejc.216.2023.05.25.09.58.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 09:58:09 -0700 (PDT) Date: Thu, 25 May 2023 18:58:04 +0200 From: Bernhard Reutner-Fischer To: "Roger Sayle" Cc: rep.dot.nop@gmail.com, , "'Uros Bizjak'" , jeffreyalaw@gmail.com Subject: Re: [i386 PATCH] A minor code clean-up: Use NULL_RTX instead of nullptr Message-ID: <20230525185804.7af6ea5e@nbbrfq.loc> In-Reply-To: <07ac01d98e68$bced1fa0$36c75ee0$@nextmovesoftware.com> References: <07ac01d98e68$bced1fa0$36c75ee0$@nextmovesoftware.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/hEkC66.Rgaf.AWZU1jfCvS3" X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 List-Id: --MP_/hEkC66.Rgaf.AWZU1jfCvS3 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline On Wed, 24 May 2023 18:54:06 +0100 "Roger Sayle" wrote: > My understanding is that GCC's preferred null value for rtx is NULL_RTX > (and for tree is NULL_TREE), and by being typed allows strict type checking, > and use with function polymorphism and template instantiation. > C++'s nullptr is preferred over NULL and 0 for pointer types that don't > have a defined null of the correct type. > > This minor clean-up uses NULL_RTX consistently in i386-expand.cc. Oh. Well, i can't resist cleanups :) Given $ cat /tmp/inp0.c ; echo EOF rtx myfunc (int i, int j) { rtx ret; if (i) return NULL; if (j) ret = NULL; if (ret == NULL) { ret = NULL_RTX; } if (!ret) return (rtx)2; return NULL_RTX; } EOF $ spatch --c++=11 --smpl-spacing --in-place --sp-file ~/coccinelle/rtx-null.0.cocci /tmp/inp0.c init_defs_builtins: /usr/bin/../lib/coccinelle/standard.h --- /tmp/inp0.c +++ /tmp/cocci-output-76891-58af4a-inp0.c @@ -2,10 +2,10 @@ rtx myfunc (int i, int j) { rtx ret; if (i) - return NULL; + return NULL_RTX; if (j) - ret = NULL; - if (ret == NULL) { + ret = NULL_RTX; + if (ret == NULL_RTX) { ret = NULL_RTX; } if (!ret) HANDLING: /tmp/inp0.c diff = So you if you would feel like, someone could find ./ \( -name "testsuite" -o -name "contrib" -o -name "examples" -o -name ".git" -o -name "zlib" -o -name "intl" \) -prune -o \( -name "*.[chpx]*" -a -type f \) -exec spatch --c++=11 --smpl-spacing --in-place $opts --sp-file ~/coccinelle/rtx-null.0.cocci {} \; with the attached rtx-null coccinelle script. (and handle nullptr too, and the same game for tree) Just a thought.. --MP_/hEkC66.Rgaf.AWZU1jfCvS3 Content-Type: application/octet-stream; name=rtx-null.0.cocci Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=rtx-null.0.cocci Ly8gdXNlIE5VTExfUlRYIGZvciBydHgKLy8gSWRlYSBzdG9sZW4gZnJvbSBSb2dlcgpAIGFzc2ln bm1lbnQgQAp0eXBlZGVmIHJ0eDsKbG9jYWwgaWRleHByZXNzaW9uIHJ0eCBycjsKQEAKLXJyID0g TlVMTDsKK3JyID0gTlVMTF9SVFg7CgpAIG5lIEAKdHlwZWRlZiBydHg7CmxvY2FsIGlkZXhwcmVz c2lvbiBydHggcnI7CkBACi1yciAhPSBOVUxMOworcnIgIT0gTlVMTF9SVFg7CgpAIGVxIEAKdHlw ZWRlZiBydHg7CmxvY2FsIGlkZXhwcmVzc2lvbiBydHggcnI7Ci8vIG92ZXJyaWRlIHRoZSBtZXRh dmFyaWFibGUgTlVMTAovLyBXZSB3YW50IHRvIHJldGFpbiB0aGUgbmVnYXRpb24gaW4gaWYgKCF0 aGVfcnR4KSBhbmQgbm90IHRoZV9ydHggPT0gTlVMTF9SVFgKaWRlbnRpZmllciBOVUxMID1+ICJO VUxMIjsKQEAKLXJyID09IE5VTEwKK3JyID09IE5VTExfUlRYCgpAIHJldF9udWxsIEAKdHlwZWRl ZiBydHg7CmlkZW50aWZpZXIgZm47Ci8vIG92ZXJyaWRlIHRoZSBtZXRhdmFyaWFibGUgTlVMTApp ZGVudGlmaWVyIE5VTEwgPX4gIk5VTEwiOwpAQApydHggZm4gKC4uLikKewouLi4KLXJldHVybiBO VUxMOworcmV0dXJuIE5VTExfUlRYOwouLi4KfQoKCg== --MP_/hEkC66.Rgaf.AWZU1jfCvS3--