From patchwork Mon Nov 24 23:35:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 414173 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 72BDA140185 for ; Tue, 25 Nov 2014 10:35:25 +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:date :from:to:subject:message-id:reply-to:mime-version:content-type; q=dns; s=default; b=oLYTh/GZ9r0PqaONXA8CzE8SBF36zzeQadf+S5kEaGb 0VKuv/qzKmshdIVs0CVuhEnfcRB1UkaFJRygoL4bhK4e4ARX8RMNpB0zy5lixwZ/ QZVZxJu8BmyWbArFSLcESVajTbq7zZ0M5PBI7E5a4iJ0gA2xQADHQiWZnBM80sBI = 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:date :from:to:subject:message-id:reply-to:mime-version:content-type; s=default; bh=87mANJ1FT9mVVd0G9nmfaYeIxAE=; b=n6q7mIKAgT2nHA2ut ZIRkEU+NDjaIrEQUqRos9t4McfSascbh127ugyOYUSg5lCGqpSS3risEFeoWG/nk izBqUF50mpOYJaoyCen4EZn3Y5m+VVzC7uAKEFJAfeQcJ3RJmXLN6nk8ox431tvp zc6eqEwExdveVHzEN7856eD+Ew= Received: (qmail 8660 invoked by alias); 24 Nov 2014 23:35:18 -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 8649 invoked by uid 89); 24 Nov 2014 23:35:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham 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; Mon, 24 Nov 2014 23:35:16 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAONZEZI013570 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 24 Nov 2014 18:35:14 -0500 Received: from tucnak.zalov.cz (ovpn-116-39.ams2.redhat.com [10.36.116.39]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sAONZC9T013344 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO) for ; Mon, 24 Nov 2014 18:35:13 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.9/8.14.9) with ESMTP id sAONZAnC016872 for ; Tue, 25 Nov 2014 00:35:11 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.9/8.14.9/Submit) id sAONZ98P016871 for gcc-patches@gcc.gnu.org; Tue, 25 Nov 2014 00:35:09 +0100 Date: Tue, 25 Nov 2014 00:35:09 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix building of gengtype Message-ID: <20141124233509.GN1674@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Hi! My last 2 bootstraps failed, both because of a race while building host gengtype (each time different gengtype*.o). Looking at the history, we have two versions of gengtype, one in build/, another one in . (host one). Initially, the copy in build/ was built with -DGENERATOR_FILE, included bconfig.h, the other did not and included config.h. Then, Steven noticed that eventhough gengtype is built for host, it really for many reasons need GENERATOR_FILE define and defined it in the Makefile. Except that change resulted in always including bconfig.h even in host gengtype, which is presumably undesirable. After another half a year Marcus probably hit similar race like I did tonight, make trying to build host gengtype*.o when bconfig.h has not been generated yet, and added for gengtype-lex.o $(BCONFIG_H) dependency (but not to any other of the gengtype*.o files). Note, config.h has an #error for #ifdef GENERATOR_FILE, to prevent people from including config.h in build/gen* stuff by mistake. So, this patch fixes this by just using a different define and defines GENERATOR_FILE only after including config.h in the host gengtype* object files. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2014-11-25 Jakub Jelinek * Makefile.in (gengtype-lex.o): Drop dependency on $(BCONFIG_H). (CFLAGS-gengtype-lex.o, CFLAGS-gengtype-parse.o, CFLAGS-gengtype-state.o, CFLAGS-gengtype.o): Add -DHOST_GENGTYPE instead of -DGENERATOR_FILE. * gengtype.c: Instead of testing GENERATOR_FILE define, test HOST_GENGTYPE. If defined, include config.h and define GENERATOR_FILE afterwards, otherwise include bconfig.h. * gengtype-parse.c, gengtype-state.c, gengtype-lex.l): Likewise. Jakub --- gcc/Makefile.in.jj 2014-11-18 18:17:53.000000000 +0100 +++ gcc/Makefile.in 2014-11-24 21:43:47.960196848 +0100 @@ -2485,27 +2485,27 @@ build/gengenrtl.o : gengenrtl.c $(BCONFI # the build-%: rule doesn't apply to them. gengtype-lex.o build/gengtype-lex.o : gengtype-lex.c gengtype.h $(SYSTEM_H) -gengtype-lex.o: $(CONFIG_H) $(BCONFIG_H) -CFLAGS-gengtype-lex.o += -DGENERATOR_FILE +gengtype-lex.o: $(CONFIG_H) +CFLAGS-gengtype-lex.o += -DHOST_GENGTYPE build/gengtype-lex.o: $(BCONFIG_H) gengtype-parse.o build/gengtype-parse.o : gengtype-parse.c gengtype.h \ $(SYSTEM_H) gengtype-parse.o: $(CONFIG_H) -CFLAGS-gengtype-parse.o += -DGENERATOR_FILE +CFLAGS-gengtype-parse.o += -DHOST_GENGTYPE build/gengtype-parse.o: $(BCONFIG_H) gengtype-state.o build/gengtype-state.o: gengtype-state.c $(SYSTEM_H) \ gengtype.h errors.h double-int.h version.h $(HASHTAB_H) $(OBSTACK_H) \ $(XREGEX_H) gengtype-state.o: $(CONFIG_H) -CFLAGS-gengtype-state.o += -DGENERATOR_FILE +CFLAGS-gengtype-state.o += -DHOST_GENGTYPE build/gengtype-state.o: $(BCONFIG_H) gengtype.o build/gengtype.o : gengtype.c $(SYSTEM_H) gengtype.h \ rtl.def insn-notes.def errors.h double-int.h version.h \ $(HASHTAB_H) $(OBSTACK_H) $(XREGEX_H) gengtype.o: $(CONFIG_H) -CFLAGS-gengtype.o += -DGENERATOR_FILE +CFLAGS-gengtype.o += -DHOST_GENGTYPE build/gengtype.o: $(BCONFIG_H) build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \ --- gcc/gengtype.c.jj 2014-11-20 17:06:24.000000000 +0100 +++ gcc/gengtype.c 2014-11-24 21:44:30.746446814 +0100 @@ -17,10 +17,11 @@ along with GCC; see the file COPYING3. If not see . */ -#ifdef GENERATOR_FILE -#include "bconfig.h" -#else +#ifdef HOST_GENGTYPE #include "config.h" +#define GENERATOR_FILE 1 +#else +#include "bconfig.h" #endif #include "system.h" #include "errors.h" /* for fatal */ --- gcc/gengtype-parse.c.jj 2014-09-25 15:03:05.000000000 +0200 +++ gcc/gengtype-parse.c 2014-11-24 21:45:19.905585065 +0100 @@ -17,10 +17,11 @@ along with GCC; see the file COPYING3. If not see . */ -#ifdef GENERATOR_FILE -#include "bconfig.h" -#else +#ifdef HOST_GENGTYPE #include "config.h" +#define GENERATOR_FILE 1 +#else +#include "bconfig.h" #endif #include "system.h" #include "gengtype.h" --- gcc/gengtype-state.c.jj 2014-09-25 15:01:57.000000000 +0200 +++ gcc/gengtype-state.c 2014-11-24 21:44:59.293946382 +0100 @@ -23,10 +23,11 @@ and Basile Starynkevitch */ -#ifdef GENERATOR_FILE -#include "bconfig.h" -#else +#ifdef HOST_GENGTYPE #include "config.h" +#define GENERATOR_FILE 1 +#else +#include "bconfig.h" #endif #include "system.h" #include "errors.h" /* For fatal. */ --- gcc/gengtype-lex.l.jj 2014-09-25 15:02:45.000000000 +0200 +++ gcc/gengtype-lex.l 2014-11-24 21:45:41.486206761 +0100 @@ -21,10 +21,11 @@ along with GCC; see the file COPYING3. %option noinput %{ -#ifdef GENERATOR_FILE -#include "bconfig.h" -#else +#ifdef HOST_GENGTYPE #include "config.h" +#define GENERATOR_FILE 1 +#else +#include "bconfig.h" #endif #include "system.h"