From patchwork Wed Oct 7 12:06:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 1377968 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=i9FxNvOF; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C5tNm3Lkmz9sSG for ; Wed, 7 Oct 2020 23:06:47 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3D6CF3951421; Wed, 7 Oct 2020 12:06:45 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qv1-xf2e.google.com (mail-qv1-xf2e.google.com [IPv6:2607:f8b0:4864:20::f2e]) by sourceware.org (Postfix) with ESMTPS id 443E53951413 for ; Wed, 7 Oct 2020 12:06:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 443E53951413 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nathanmsidwell@gmail.com Received: by mail-qv1-xf2e.google.com with SMTP id ev17so965663qvb.3 for ; Wed, 07 Oct 2020 05:06:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=gnK5nvHa79hmSjZiYUnUpKiFEnZwvZhURBqRAN3RV34=; b=i9FxNvOFSGBZivCYgDgzFlJefeWey8AfGWvkwjClQBXBqaM1S7nD4QQRL+ga3fiTLg IGVeo97QejFGiCMjZqgPdaG/NVogNM9tMAfGyTywvIewKSICJpYtSeVujJvpmErzGC01 H2yu9767Nl9TVeinZQMfNM78r/gEh1hG7vbZ70cEILxFZtyCUTN3/+/nEa+VSe7uKL2/ gZiY0To/pt+b3BztWCbxMIjAxUK5r70V6k8CjH7tZK8rpWD7rWzXwt+PKPcmX/6WxtSp V89bvJUSljWaEezLMHbDqBkdpZnXtZXgZ70mmHNymxxm6XQn+02dGRbQUi0U6HA7mUuU 0DvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:from:subject:message-id:date :user-agent:mime-version:content-language; bh=gnK5nvHa79hmSjZiYUnUpKiFEnZwvZhURBqRAN3RV34=; b=Hxj5361/2Nzd4f5AQMD1RnQqDZ06s59qqPjMNuSQjngsfpqoLkn4VB10vIl6qrm6Xe OsokJ/BV/H8IRFVSjzPvkZxJWkNyod+QrOfKHMf2KICoP2ySX3gFcIZpdOPkG6/iR9RP omgTxQYazdszuuPsTYED/Efw39Y9jZS30WqRd/kAwmqtx/Cva9EFdDVWGfTomOQThTJi 4Ljjf0rj4Dw2LbSm7dPIj1ya4QEjRWk/q44zH2t7kcdTzb9vU2oJKMVoD5wBbf4TyT/N QJqtFe992Q1nOw9cQZqmaQRrheyxQPo6/a1K/Gbscp6/HE2hUMzMebHniF9hipKgFMVI R6YA== X-Gm-Message-State: AOAM532JD0CSJZCtgyxCak/2XUWY1pP//VtaTDpWS+fGv81Ab6rWGGuc 877lBaumu0+FgG3+LHQKzEA= X-Google-Smtp-Source: ABdhPJyYF79Rwbw8deBt19ygqMy1l3Ww9voB6VnTwl+FV/GOcVoCFhdCf7dp9JYXZTrp31Nr1t88vA== X-Received: by 2002:a0c:e5cf:: with SMTP id u15mr2781577qvm.24.1602072401514; Wed, 07 Oct 2020 05:06:41 -0700 (PDT) Received: from ?IPv6:2620:10d:c0a8:1102:e5ab:2f85:d303:6d18? ([2620:10d:c091:480::1:ea67]) by smtp.googlemail.com with ESMTPSA id j30sm1338449qtb.54.2020.10.07.05.06.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Oct 2020 05:06:40 -0700 (PDT) To: GCC Patches From: Nathan Sidwell Subject: c++: Rename DECL_BUILTIN_P to DECL_UNDECLARED_BUILTIN_P Message-ID: Date: Wed, 7 Oct 2020 08:06:39 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" I realized I'd misnamed DECL_BUILTIN_P, it's only true of compiler builtins unless and until the user declares them -- at that point they're real decls, and will have a location in the user's source. (BUILT_IN_FN and friends still work though). This renames them so future-me is not confused as to why the predicate becomes false. gcc/cp/ * cp-tree.h (DECL_BUILTIN_P): Rename to ... (DECL_UNDECLARED_BUILTIN_P): ... here. * decl.c (duplicate_decls): Adjust. * name-lookup.c (anticipated_builtin_p): Adjust. (do_nonmember_using_decl): Likewise. libcc1/ * libcp1plugin.cc (supplement_binding): Rename DECL_BUILTIN_P. pushing to trunk nathan diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index c9ad75117ad..22700844fac 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4035,8 +4035,9 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) #define FNDECL_USED_AUTO(NODE) \ TREE_LANG_FLAG_2 (FUNCTION_DECL_CHECK (NODE)) -/* True if NODE is a builtin decl. */ -#define DECL_BUILTIN_P(NODE) \ +/* True if NODE is an undeclared builtin decl. As soon as the user + declares it, the location will be updated. */ +#define DECL_UNDECLARED_BUILTIN_P(NODE) \ (DECL_SOURCE_LOCATION(NODE) == BUILTINS_LOCATION) /* True for artificial decls added for OpenMP privatized non-static diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index ac5fd92a162..ee9190d8d0c 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1467,7 +1467,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden) /* Check for redeclaration and other discrepancies. */ if (TREE_CODE (olddecl) == FUNCTION_DECL - && DECL_BUILTIN_P (olddecl)) + && DECL_UNDECLARED_BUILTIN_P (olddecl)) { if (TREE_CODE (newdecl) != FUNCTION_DECL) { diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 2f42ad0d532..5e714503e4b 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -2134,7 +2134,7 @@ anticipated_builtin_p (tree ovl) { return (TREE_CODE (ovl) == OVERLOAD && OVL_HIDDEN_P (ovl) - && DECL_BUILTIN_P (OVL_FUNCTION (ovl))); + && DECL_UNDECLARED_BUILTIN_P (OVL_FUNCTION (ovl))); } /* BINDING records an existing declaration for a name in the current scope. @@ -3987,7 +3987,7 @@ do_nonmember_using_decl (name_lookup &lookup, bool fn_scope_p, } else if (old.using_p ()) continue; /* This is a using decl. */ - else if (old.hidden_p () && DECL_BUILTIN_P (old_fn)) + else if (old.hidden_p () && DECL_UNDECLARED_BUILTIN_P (old_fn)) continue; /* This is an anticipated builtin. */ else if (!matching_fn_p (new_fn, old_fn)) continue; /* Parameters do not match. */ diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc index 98174250585..e7ab325d7df 100644 --- a/libcc1/libcp1plugin.cc +++ b/libcc1/libcp1plugin.cc @@ -353,7 +353,7 @@ supplement_binding (cxx_binding *binding, tree decl) /* If TARGET_BVAL is anticipated but has not yet been declared, pretend it is not there at all. */ || (TREE_CODE (target_bval) == FUNCTION_DECL - && DECL_BUILTIN_P (target_bval))) + && DECL_UNDECLARED_BUILTIN_P (target_bval))) binding->value = decl; else if (TREE_CODE (target_bval) == TYPE_DECL && DECL_ARTIFICIAL (target_bval)