comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: How to check syntax with GNAT?
Date: Thu, 13 Jul 2017 06:47:43 +0100
Date: 2017-07-13T06:47:43+01:00	[thread overview]
Message-ID: <ly37a0sxa8.fsf@pushface.org> (raw)
In-Reply-To: ojsjvj$acp$1@gioia.aioe.org

Victor Porton <porton@narod.ru> writes:

> $ make my-check 
> gnatmake -p -Plibrdf.gpr \
>                  -XLIBRARY_KIND=static -XOBJ_DIR=./obj-static -
> Xsoversion=librdf-ada.so.2.0.14 -XMODE=Install -XDEBUG_MODE=check
> gnatgcc -c -gnatc -gnat2012 -gnatc rdf-raptor-bnode.adb
> ...
> gprlib rdf-ada.lexch
> ar cr /home/porton/Projects/redland-bindings/ada/lib/librdf-ada.a 
> /home/porton/Projects/redland-bindings/ada/obj-static/rdf-raptor-bnode.o 
> /home/porton/Projects/redland-bindings/ada/obj-static/rdf-raptor-iostream.o 
> ...
> /usr//bin/ar: /home/porton/Projects/redland-bindings/ada/obj-static/rdf-
> raptor-bnode.o: No such file or directory
> gprlib: call to archive builder /usr//bin/ar failed
> gprbuild: could not build library for project librdf
> gnatmake: objects up to date.
>
> Why does it attempt to build object files and the library despite of -gnatc 
> switch and how to make it not to attempt build object files?

It doesn't attempt to build object files; that's why the gprlib call
fails. It does build .ali files, though.

You can get gnatmake (actually, gprbuild) to stop after the compilation
by using its -c flag:

   lockheed:test-stm32f4 simon$ gnatmake -p -P testbed -c -cargs -gnatc
   Setup
      [mkdir]        object directory for project Testbed
   Compile
      [Ada]          testbed.adb
      [Ada]          containing.adb
      [Ada]          dispatching.adb
      [Ada]          floating_point.adb
      [Ada]          heartbeat.adb
      [Ada]          interrupts.adb
   interrupts.adb:44:09: (style) bad casing of "Handler" declared at line 41
      [Ada]          iteration.adb
      [Ada]          last_chance_handler.adb
      [Ada]          so.adb
      [Ada]          streams.adb
      [Ada]          strings.adb
      [Ada]          memory_streams.adb
   lockheed:test-stm32f4 simon$ ls .build/*.o
   ls: .build/*.o: No such file or directory

(the style warning is a compiler bug that I haven't reported yet!)

I say above "gnatmake (actually, gprbuild)" because nowadays (GCC 7, not
GCC 6) gnatmake checks whether gprbuild is available and execs it if so.

I do checks like this in the editor, because why wait to check the
closure rather than checking the change you just made? (of course this
isn't totally effective for spec changes). But, I have it (Emacs
ada-mode) set up to actually compile the unit being edited, by

 '(ada-prj-default-check-cmd
   "gprbuild -c -u -f -gnatc -p -P ${gpr_file} ${full_current}")

because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66162#c3 .

      parent reply	other threads:[~2017-07-13  5:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-09  6:54 How to check syntax with GNAT? Victor Porton
2017-07-12 16:08 ` Stephen Leake
2017-07-12 17:31   ` Victor Porton
2017-07-13  5:47 ` Simon Wright [this message]
replies disabled

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