From patchwork Mon Oct 15 14:34:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 984236 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-487570-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="lyYNgQDV"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="K+VfORJI"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42Ygtb4Cbyz9sDJ for ; Tue, 16 Oct 2018 01:34:15 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; q=dns; s=default; b=X7uuEJCxCJilyyA6 amDLQ8ph8aihpuxpn+dVZOAWwApySGPbma3U65BNJrr2sk5J5dviyybZRqwMwatc sX83zFZVeJl4Ofx6NkmH92YE8VHM38akiTY3bxnMXoBrWuKo20D1pH3ujBcu+3cT BP5pPdEWwmOtU9hmB/2kWP57Pxg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; s=default; bh=SYTT7LT+Agb+cOMxlcorOe mqOoQ=; b=lyYNgQDVF1dA3tDlOUqJPA+7UW3ATA9qHtx/0ZVJqJ9iBq5uz1N/hX xfqi/5cgt5coqhFjoakEWvT/60gDi+JL4PWCSSAlaY1efCSanGr33Y56nPk+rZcP xZ2b2dOT49inyL60olQfdoktdGzW95zR1qXSjjcP8UTtbt1UsOL6Y= Received: (qmail 46211 invoked by alias); 15 Oct 2018 14:34:08 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 46199 invoked by uid 89); 15 Oct 2018 14:34:07 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=tree_static, TREE_STATIC X-HELO: EUR04-VI1-obe.outbound.protection.outlook.com Received: from mail-eopbgr80087.outbound.protection.outlook.com (HELO EUR04-VI1-obe.outbound.protection.outlook.com) (40.107.8.87) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 15 Oct 2018 14:34:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yYEIsYzlGmdVmf5qIHXxqv+EP2Jslhd5HVmJQAZfb5A=; b=K+VfORJIaqKhyOjGrkZ2uFu88y6u9ORjlAJ9Q/DuafDzDt3qt3C4lBNGlbpEq3U2yn7VdbK4AXPO79+pH0zP4c4Q/Scvm0cfjvIr01D9Q/MKu0UaVNnqO+EIguG5oRvlZbJQ+31JAG8b8RVlHgbZu++uTDNqmGzKpOQBS5qZDgI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Richard.Sandiford@arm.com; Received: from localhost (217.140.106.32) by VI1PR08MB3261.eurprd08.prod.outlook.com (2603:10a6:803:3d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.23; Mon, 15 Oct 2018 14:34:02 +0000 From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, joseph@codesourcery.com, jason@redhat.com, nathan@acm.org, nd@arm.com, richard.sandiford@arm.com Cc: joseph@codesourcery.com, jason@redhat.com, nathan@acm.org, nd@arm.com Subject: [04/10] Move COMPLETE_OR_UNBOUND_ARRAY_TYPE_P to the C and C++ frontends References: <87d0sbjn97.fsf@arm.com> Date: Mon, 15 Oct 2018 15:34:00 +0100 In-Reply-To: <87d0sbjn97.fsf@arm.com> (Richard Sandiford's message of "Mon, 15 Oct 2018 15:30:28 +0100") Message-ID: <87sh17i8iv.fsf@arm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) There was only one use of COMPLETE_OR_UNBOUND_ARRAY_TYPE_P outside the frontends, in expr.c. This patch expands the macro there and moves the macro's definition to c-common.h. It feels a bit odd that we still have decls with no layout at this late stage, but that's a separate issue... 2018-10-15 Richard Sandiford gcc/ * tree.h (COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): Move to c-common.h. * expr.c (expand_expr_real_1): Expand use of COMPLETE_OR_UNBOUND_ARRAY_TYPE_P here. gcc/c-family/ * c-common.h (COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro, moved from tree.h. Index: gcc/tree.h =================================================================== --- gcc/tree.h 2018-10-15 14:13:04.148469305 +0100 +++ gcc/tree.h 2018-10-15 14:13:08.520433065 +0100 @@ -602,10 +602,6 @@ #define COMPLETE_TYPE_P(NODE) (TYPE_SIZE /* Nonzero if this type is the (possibly qualified) void type. */ #define VOID_TYPE_P(NODE) (TREE_CODE (NODE) == VOID_TYPE) -/* Nonzero if this type is complete or is an array with unspecified bound. */ -#define COMPLETE_OR_UNBOUND_ARRAY_TYPE_P(NODE) \ - (COMPLETE_TYPE_P (TREE_CODE (NODE) == ARRAY_TYPE ? TREE_TYPE (NODE) : (NODE))) - #define FUNC_OR_METHOD_TYPE_P(NODE) \ (TREE_CODE (NODE) == FUNCTION_TYPE || TREE_CODE (NODE) == METHOD_TYPE) Index: gcc/expr.c =================================================================== --- gcc/expr.c 2018-10-15 14:12:54.040553089 +0100 +++ gcc/expr.c 2018-10-15 14:13:08.520433065 +0100 @@ -9884,7 +9884,8 @@ expand_expr_real_1 (tree exp, rtx target /* If a static var's type was incomplete when the decl was written, but the type is complete now, lay out the decl now. */ if (DECL_SIZE (exp) == 0 - && COMPLETE_OR_UNBOUND_ARRAY_TYPE_P (TREE_TYPE (exp)) + && DEFINITE_TYPE_P (TREE_CODE (type) == ARRAY_TYPE + ? TREE_TYPE (type) : type) && (TREE_STATIC (exp) || DECL_EXTERNAL (exp))) layout_decl (exp, 0); Index: gcc/c-family/c-common.h =================================================================== --- gcc/c-family/c-common.h 2018-10-15 14:13:04.148469305 +0100 +++ gcc/c-family/c-common.h 2018-10-15 14:13:08.516433099 +0100 @@ -746,6 +746,10 @@ #define C_TYPE_OBJECT_OR_INCOMPLETE_P(ty #define COMPLETE_OR_VOID_TYPE_P(NODE) \ (COMPLETE_TYPE_P (NODE) || VOID_TYPE_P (NODE)) +/* Nonzero if this type is complete or is an array with unspecified bound. */ +#define COMPLETE_OR_UNBOUND_ARRAY_TYPE_P(NODE) \ + (COMPLETE_TYPE_P (TREE_CODE (NODE) == ARRAY_TYPE ? TREE_TYPE (NODE) : (NODE))) + struct visibility_flags { unsigned inpragma : 1; /* True when in #pragma GCC visibility. */