From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 56434 invoked by alias); 2 Jun 2015 12:34:13 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 56335 invoked by uid 89); 2 Jun 2015 12:34:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,KAM_ASCII_DIVIDERS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 02 Jun 2015 12:34:12 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 223708E4E2; Tue, 2 Jun 2015 12:34:11 +0000 (UTC) Received: from [10.10.57.160] (vpn-57-160.rdu2.redhat.com [10.10.57.160]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t52CYAd6012537; Tue, 2 Jun 2015 08:34:10 -0400 Message-ID: <556DA2C2.4010704@redhat.com> Date: Tue, 02 Jun 2015 12:47:00 -0000 From: Andrew MacLeod User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Richard Biener CC: gcc-patches Subject: Re: [patch] consolidate some includes into coretypes.h References: <556CC87F.2090305@redhat.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------000903050406080408000600" X-IsSubscribed: yes X-SW-Source: 2015-06/txt/msg00191.txt.bz2 This is a multi-part message in MIME format. --------------000903050406080408000600 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1810 On 06/02/2015 04:26 AM, Richard Biener wrote: > On Mon, Jun 1, 2015 at 11:02 PM, Andrew MacLeod wrote: >> >> Bootstraps from scratch on x86_64-unknown-linux-gnu with no new test >> regressions. I also built it on all the config-list.mk targets with no >> additional compilation errors. >> >> OK for trunk? > Generally the idea is sound (amend coretypes.h), but I don't like the > GCC_CONFIG_H guard, why does !GENERATOR_FILE not work? Target files also use coretypes.h. In particular, libgcc includes it and does not have GENERATOR_FILE set. Rather than checking for GCC_CONFIG_H we could check #if !defined (GENERATOR_FILE) && !defined (USED_FOR_TARGET) I think that should work OK. > Furthermore I don't like the special-casing in rtl.h, instead have > coretypes.h contain sth like > > #ifdef GENERATOR_FILE > ... rtl.h special-case > #else > ... GCC_CONFIG_H stuff > #endif > > Thanks, > Richard. This one is harder. I don't like the special case either, but you cant really figure it out in coretypes.h. The problem comes from some generator files which compile rtl.c and and a couple of other files, and thus have GENERATOR_FILE set... These run after the initial set of generators so insn-modes.h and friends have been created, and these includes are now required. the presence of rtl.h seems to be the the litmus test and if it occurs in the include chain after coretypes.h, then we'll need these files. I suppose you could just include those files in rtl.h directly without the guard... it is probably the cleanest solution. Otherwise we'd either have to add a new identifying macro to a dozen generator files, or include these headers there, or some other such thing. The following tweak to the 2 files address both issues. how does that seem? Andrew --------------000903050406080408000600 Content-Type: text/x-patch; name="num3.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="num3.diff" Content-length: 1306 Index: coretypes.h =================================================================== --- coretypes.h (revision 223875) +++ coretypes.h (working copy) @@ -299,4 +299,14 @@ typedef unsigned char uchar; #endif +/* Most host source files will require the following headers. */ +#if !defined (GENERATOR_FILE) && !defined (USED_FOR_TARGET) +#include "machmode.h" +#include "signop.h" +#include "wide-int.h" +#include "double-int.h" +#include "real.h" +#include "fixed-value.h" +#endif + #endif /* coretypes.h */ Index: rtl.h =================================================================== --- rtl.h (revision 223875) +++ rtl.h (working copy) @@ -20,15 +20,21 @@ #ifndef GCC_RTL_H #define GCC_RTL_H +/* coretypes.h normally includes these header files, but does not for generator + files. This file is included by some late running generator files which + also requires them, so always include them here. */ +#include "machmode.h" +#include "signop.h" +#include "wide-int.h" +#include "double-int.h" +#include "real.h" +#include "fixed-value.h" + #include "statistics.h" -#include "machmode.h" #include "input.h" -#include "real.h" #include "vec.h" -#include "fixed-value.h" #include "alias.h" #include "hashtab.h" -#include "wide-int.h" #include "flags.h" #include "is-a.h" --------------000903050406080408000600--