comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: chopping Ada source that have preprocessor symbols in them
Date: Wed, 06 Feb 2013 13:00:36 +0100
Date: 2013-02-06T13:00:37+01:00	[thread overview]
Message-ID: <511245e5$0$6579$9b4e6d93@newsspool3.arcor-online.net> (raw)
In-Reply-To: <e6cb2d64-132a-4989-ab4f-9866e36482cf@googlegroups.com>

On 06.02.13 06:29, codeallergy wrote:
> Hi Georg,
>
> gnatchop call gcc with the -gnatu flag to generates the unit separation offsets.

Interesting switch.

> the problem is that the offsets are for the preprocessed file but gnatchop separates the non preprocessed one.
> you could use gnatchop without any preprocessor flags (you will get errors but the file should be cut rightly).

Some parse errors will stop gnatchop, depending on where
the preprocessor symbols are, so I cannot ignore the errors,
unfortunately. I noticed that gnatchop accepts -gnatep
(but not -P, o.K.). Using -gnatep makes the problems appear
exactly as you indicated. Gnatchop cuts the Ada source program
at the wrong offsets. Test case:

$ gnatchop -w -gnatep=multiple_units.ep multiple_units.ada Source
splitting multiple_units.ada into:
    Source/unit_1.ads
    Source/unit_2.ads
    Source/unit_3.ads
$ ls Source/unit_?.ads | while read f ; do cat $f ; echo "<<<*>>>" ; done
package Unit_1 is
    type T is tagged null record;
    procedure Op (Item : T);
end Unit_1;
<<<*>>>

with Unit_1;
$prv with Ada.Containers.Vectors;
package Unit_2 is
    type T is new Unit_1.T with null record;
    $ovr
    procedure Op (Item : T);
private
    package Foo is new Ada.Containers.Vectors (Positive, Character);
end Unit_2;

with Uni<<<*>>>
t_1;
package Unit_3 is
end Unit_3;
<<<*>>>

$ cat multiple_units.ep
* "multiple_units.prep"
$ cat multiple_units.prep
ovr := overriding
prv := private
$ cat multiple_units.ada
package Unit_1 is
    type T is tagged null record;
    procedure Op (Item : T);
end Unit_1;

with Unit_1;
$prv with Ada.Containers.Vectors;
package Unit_2 is
    type T is new Unit_1.T with null record;
    $ovr
    procedure Op (Item : T);
private
    package Foo is new Ada.Containers.Vectors (Positive, Character);
end Unit_2;

with Unit_1;
package Unit_3 is
end Unit_3;
$

Thanks for the pointers. I wonder if this is a bug or a feature?




  reply	other threads:[~2013-02-06 12:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-06  0:54 chopping Ada source that have preprocessor symbols in them Georg Bauhaus
2013-02-06  5:29 ` codeallergy
2013-02-06 12:00   ` Georg Bauhaus [this message]
2013-02-08 12:22 ` Stephen Leake
2013-02-08 13:19   ` Georg Bauhaus
2013-02-09  2:51     ` Stephen Leake
2013-02-09 17:59       ` Georg Bauhaus
2013-02-09 20:15         ` Simon Wright
2013-02-11 23:13           ` Georg Bauhaus
2013-02-12 16:04             ` Björn Persson
2013-02-12 19:18               ` Georg Bauhaus
2013-02-15 10:40         ` Stephen Leake
2013-02-15 11:11           ` Georg Bauhaus
2013-02-15 16:39             ` Pascal Obry
2013-02-16  1:10               ` Randy Brukardt
2013-02-17  8:46                 ` Jacob Sparre Andersen
2013-02-18 23:18                   ` Randy Brukardt
2013-02-19 10:05                     ` Version control and multiple implementation variants (Was: chopping Ada source that have preprocessor symbols in them) Jacob Sparre Andersen
2013-02-19 11:41                       ` Thomas Løcke
2013-02-19 16:42                       ` chopping Ada source that have preprocessor symbols in them Pascal Obry
2013-02-19 21:07                       ` Version control and multiple implementation variants (Was: chopping Ada source that have preprocessor symbols in them) Randy Brukardt
2013-02-19 23:20                         ` Georg Bauhaus
2013-02-16  8:22             ` chopping Ada source that have preprocessor symbols in them Stephen Leake
2013-02-16 15:12               ` Georg Bauhaus
2013-02-17 11:51                 ` Stephen Leake
2013-02-18 12:51               ` Björn Persson
2013-02-08 20:27 ` Florian Weimer
2013-02-08 21:09   ` Georg Bauhaus
2013-02-10  9:01 ` Björn Persson
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox