From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,6458d1ee91b224ec X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.66.76.201 with SMTP id m9mr811780paw.33.1360469025730; Sat, 09 Feb 2013 20:03:45 -0800 (PST) Path: oq8ni1866pbb.0!nntp.google.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!nrc-news.nrc.ca!goblin2!goblin.stu.neva.ru!news.teledata-fn.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Wed, 06 Feb 2013 13:00:36 +0100 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: chopping Ada source that have preprocessor symbols in them References: <5111a9d5$0$6567$9b4e6d93@newsspool3.arcor-online.net> In-Reply-To: Message-ID: <511245e5$0$6579$9b4e6d93@newsspool3.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 06 Feb 2013 13:00:37 CET NNTP-Posting-Host: 2867d462.newsspool3.arcor-online.net X-Trace: DXC=DXMbJGE1ZJJlU`@c^jLCbJMcF=Q^Z^V3H4Fo<]lROoRA8kFjeYMIEOPCY\c7>ejVH@A4eRa2\aVB[3m8a]MA:hL X-Complaints-To: usenet-abuse@arcor.de Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2013-02-06T13:00:37+01:00 List-Id: 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?