From patchwork Fri Aug 24 16:33:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Quinot X-Patchwork-Id: 179873 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]) by ozlabs.org (Postfix) with SMTP id 4E8E72C0100 for ; Sat, 25 Aug 2012 02:34:01 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1346430842; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=nu6NbzoJDJ7Ag620X0p0RG31IB8=; b=su6wB4+PEXGa1Ic dnAJRjiJCjhcd6FWFFa2PfZ7CPTVNAw9qt8nG+uCnAyPJ3NNDEYOsZ7NaTJJu1t3 nfxbK3d+ltXt0CNbkmHy+IDY+BXZ5Uvf2WtorLDp6UGgN9TdA8avxVVkF6mLf8Ai NwCZTARRC1+LM2szVWjzH2uh7Dro= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=kszXXGYjkA1rZLDvDwriv/B4x6bPn/1hgYP1Q8H05aLanGDRgvjugQUJ89D/bp rJltsXA5porNLqD3RtxzgI/x9RHD8lhuNiR/WqEfVE1hlrAIUgqsDbw8Q13bYFZI jW3Ym1tHL06src1nyVcf5rMwy4AzzmfwQz2S3pOS0uu8Q=; Received: (qmail 28899 invoked by alias); 24 Aug 2012 16:33:56 -0000 Received: (qmail 28889 invoked by uid 22791); 24 Aug 2012 16:33:54 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00 X-Spam-Check-By: sourceware.org Received: from houdart.cuivre.fr.eu.org (HELO melamine.cuivre.fr.eu.org) (81.57.40.110) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 24 Aug 2012 16:33:38 +0000 Received: by melamine.cuivre.fr.eu.org (Postfix, from userid 1000) id 429032973; Fri, 24 Aug 2012 18:33:35 +0200 (CEST) Date: Fri, 24 Aug 2012 18:33:35 +0200 From: Thomas Quinot To: gcc-patches@gcc.gnu.org, joseph@codesourcery.com Cc: charlet@adacore.com Subject: [PATCH] New command line switch -fada-spec-parent Message-ID: <20120824163335.GI7525@melamine.cuivre.fr.eu.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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 The following proposed change adds a new command line switch -fada-spec-parent allowing the user to specify a parent unit for all units generated by -fdump-ada-spec. * common.opt (-fada-spec-parent): Define new command line switch. * c-family/c-ada-spec.c (get_ada_package): When -fada-spec-parent is specified, generate binding spec as a child of the specified unit. * doc/invoke.texi: Document -fada-spec-parent. Tested on x86_64-linux. diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c index d18e78d..250078c 100644 --- a/gcc/c-family/c-ada-spec.c +++ b/gcc/c-family/c-ada-spec.c @@ -945,15 +945,26 @@ get_ada_package (const char *file) char *res; const char *s; int i; + int plen; s = strstr (file, "/include/"); if (s) base = s + 9; else base = lbasename (file); - res = XNEWVEC (char, strlen (base) + 1); - for (i = 0; *base; base++, i++) + if (ada_specs_parent == NULL) + plen = 0; + else + plen = strlen(ada_specs_parent) + 1; + + res = XNEWVEC (char, plen + strlen (base) + 1); + if (ada_specs_parent != NULL) { + strcpy(res, ada_specs_parent); + res [plen - 1] = '.'; + } + + for (i = plen; *base; base++, i++) switch (*base) { case '+': @@ -965,7 +976,7 @@ get_ada_package (const char *file) case '_': case '/': case '\\': - res [i] = (i == 0 || res [i - 1] == '_') ? 'u' : '_'; + res [i] = (i == 0 || res [i - 1] == '.' || res [i - 1] == '_') ? 'u' : '_'; break; default: @@ -3365,7 +3376,10 @@ dump_ads (const char *source_file, ads_name = xstrdup (pkg_name); for (s = ads_name; *s; s++) - *s = TOLOWER (*s); + if (*s == '.') + *s = '-'; + else + *s = TOLOWER (*s); ads_name = reconcat (ads_name, ads_name, ".ads", NULL); diff --git a/gcc/common.opt b/gcc/common.opt index 1c7c4c6..f0fcf5e 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -1031,6 +1031,10 @@ fdump- Common Joined RejectNegative Var(common_deferred_options) Defer -fdump- Dump various compiler internals to a file +fada-spec-parent= +Common RejectNegative Joined Var(ada_specs_parent) +-fada-spec-parent=unit Dump Ada specs as child units of given parent + fdump-final-insns Driver RejectNegative diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 5725f7b..97ac5c3 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -166,7 +166,7 @@ in the following sections. -pipe -pass-exit-codes @gol -x @var{language} -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help @gol --version -wrapper @@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol --fdump-ada-spec@r{[}-slim@r{]} -fdump-go-spec=@var{file}} +-fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{arg} -fdump-go-spec=@var{file}} @item C Language Options @xref{C Dialect Options,,Options Controlling C Dialect}.