From patchwork Wed Sep 13 13:16:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 813428 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-462032-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="rJtqk02o"; 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 3xsj1k2Vdwz9s4s for ; Wed, 13 Sep 2017 23:19:37 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=JTU76b4LlvI5uPZKGIDi6nqkzm8Z+vXE4SNMXuyiggAJrtuhzK YWrHb7oTgy21tykXZhTzVRVQZCHPGMn3zGf0UR+fYvIbeVtLur/O3sPRftRIFIWz BoOwktDnwTLlj89gGEZXx2s++9RTdUyl3ZRc23+ylIg5MUv8r1uEttqlQ= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=Bu91Q6coSCvxnOIVYYNED5txiOg=; b=rJtqk02oq7LSLO6tuOJj ZLZBispu/VUWjtUKTAeJ96FceaT4LI2wBNp7vTd67V9DesfbIkJ9S1AlmzA2H5Iv tvCc4U49WkCFpSLdBtV58dXcD1Tn2wlereb2dDqkeplLs6aMbHfnbLga0XrvlhML eGJyr6349jkXiI3a4UluUdc= Received: (qmail 16270 invoked by alias); 13 Sep 2017 13:19:29 -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 16253 invoked by uid 89); 13 Sep 2017 13:19:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Po, 015, po, 12111 X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Sep 2017 13:19:26 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 3764F822B6; Wed, 13 Sep 2017 15:19:24 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id la1ytsNu6Z2Y; Wed, 13 Sep 2017 15:19:24 +0200 (CEST) Received: from [IPv6:2a02:2ab8:224:1:1adb:f2ff:fe3d:1472] (perdrix.act-europe.fr [IPv6:2a02:2ab8:224:1:1adb:f2ff:fe3d:1472]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 1728B8220C; Wed, 13 Sep 2017 15:19:24 +0200 (CEST) To: GCC Patches Cc: Nicolas Roche , Arnaud Charlet From: Pierre-Marie de Rodat Subject: [Ada] Review dependency tracking for Ada sources without -gnatd.n support Message-ID: Date: Wed, 13 Sep 2017 15:16:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 X-IsSubscribed: yes This patch will fix build glitches for parallelized Ada builds, which started to appear after the Makefile changes that came with the recent libgnat/libgnarl reorganization. Specifically, it fixes the detection of dependencies between Ada units for builds based on Ada compilers that don’t support the -gnatd.n flag. Tested on x86_64-pc-linux-gnu, committed on trunk. 2017-09-13 Nicolas Roche * Make-lang.in: In the fallback mechanim, parse the associated .ali file and try to guess the locations of dependencies. Index: gcc/ada/gcc-interface/Make-lang.in =================================================================== --- gcc/ada/gcc-interface/Make-lang.in (revision 252081) +++ gcc/ada/gcc-interface/Make-lang.in (working copy) @@ -106,14 +106,20 @@ # Function that dumps the dependencies of an Ada object. Dependency only work # fully if the compiler support -gnatd.n. Otherwise a fallback mechanism is -# used. The fallback mechanism add dependency on all ada sources in the same -# directory as the original source. +# used. The fallback mechanism parse the ali files to get the list of +# dependencies and try to guess their location. If the location cannot be found +# then the dependency is ignored. ifeq ($(findstring -gnatd.n,$(ALL_ADAFLAGS)),) ADA_DEPS=\ mkdir -p $(dir $@)/$(DEPDIR); \ (o="$@: $<"; \ - for d in $(dir $<)/*.ad[sb]; do \ - o="$$o $$d"; \ + a="`echo $@ | sed -e 's/.o$$/.ali/'`"; \ + for d in `cat $$a | sed -ne 's;^D \([a-z0-9_\.-]*\).*;\1;gp'`; do \ + for l in ada $(srcdir)/ada ada/libgnat $(srcdir)/ada/libgnat; do \ + if test -f $$l/$$d; then \ + o="$$o $$l/$$d"; \ + fi; \ + done; \ done; \ echo "$$o"; echo) \ >$(dir $@)/$(DEPDIR)/$(patsubst %.o,%.Po,$(notdir $@)) @@ -121,11 +127,9 @@ else ADA_DEPS=\ mkdir -p $(dir $@)/$(DEPDIR); \ - (o="$@: $<"; \ - for d in `cat $@.gnatd.n`; do \ - o="$$o $$d"; \ - done; \ - echo "$$o"; echo) \ + (echo "$@: $< " | tr -d '\015' | tr -d '\n'; \ + cat $@.gnatd.n | tr -d '\015' | tr '\n' ' '; \ + echo; echo) \ >$(dir $@)/$(DEPDIR)/$(patsubst %.o,%.Po,$(notdir $@)) ADA_OUTPUT_OPTION = $(OUTPUT_OPTION) > $@.gnatd.n endif @@ -861,9 +865,11 @@ ada.mostlyclean: -$(RM) ada/*$(objext) ada/*.ali ada/b_gnat*.ads ada/b_gnat*.adb + -$(RM) ada/*$(objext).gnatd.n -$(RM) ada/*$(coverageexts) -$(RM) ada/sdefault.adb ada/stamp-sdefault ada/stamp-snames -$(RMDIR) ada/tools + -$(RMDIR) ada/libgnat -$(RM) gnatbind$(exeext) gnat1$(exeext) ada.clean: ada.distclean: