comp.lang.ada
 help / color / mirror / Atom feed
* How to check syntax with GNAT?
@ 2017-07-09  6:54 Victor Porton
  2017-07-12 16:08 ` Stephen Leake
  2017-07-13  5:47 ` Simon Wright
  0 siblings, 2 replies; 4+ messages in thread
From: Victor Porton @ 2017-07-09  6:54 UTC (permalink / raw)


From https://github.com/vporton/redland-bindings/blob/ada2012/ada/librdf.gpr

   package Builder is
      case Debug_Mode is
          when "check" =>
             for Default_Switches ("Ada") use ("-gnatc");
          when others =>
             null;
      end case;
   end Builder;

But when I run `make my-check`, I get:

$ 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?

I want to make it just test the syntax.

-- 
Victor Porton - http://portonvictor.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to check syntax with GNAT?
  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
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Leake @ 2017-07-12 16:08 UTC (permalink / raw)


On Sunday, July 9, 2017 at 1:54:46 AM UTC-5, Victor Porton wrote:
> From https://github.com/vporton/redland-bindings/blob/ada2012/ada/librdf.gpr
> 
>    package Builder is
>       case Debug_Mode is
>           when "check" =>
>              for Default_Switches ("Ada") use ("-gnatc");
>           when others =>
>              null;
>       end case;
>    end Builder;
> 
> But when I run `make my-check`, I get:
> 
> $ 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

We need to see your makefile to answer this. 

In addition, what version of GNAT are you using? 

You should probably be using gprbuild, not gnatmake.

To find out how to do a syntax only compile, execute "gnatmake --help" or "gprbuild --help" in a shell window under an editor and search for "syntax".


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to check syntax with GNAT?
  2017-07-12 16:08 ` Stephen Leake
@ 2017-07-12 17:31   ` Victor Porton
  0 siblings, 0 replies; 4+ messages in thread
From: Victor Porton @ 2017-07-12 17:31 UTC (permalink / raw)


Stephen Leake wrote:

> On Sunday, July 9, 2017 at 1:54:46 AM UTC-5, Victor Porton wrote:
>> From
>> https://github.com/vporton/redland-bindings/blob/ada2012/ada/librdf.gpr
>> 
>>    package Builder is
>>       case Debug_Mode is
>>           when "check" =>
>>              for Default_Switches ("Ada") use ("-gnatc");
>>           when others =>
>>              null;
>>       end case;
>>    end Builder;
>> 
>> But when I run `make my-check`, I get:
>> 
>> $ 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
> 
> We need to see your makefile to answer this.

https://github.com/vporton/redland-bindings/blob/ada2012/ada/Makefile.am

> In addition, what version of GNAT are you using?

GCC 7.1.0 on Debian Linux.

> You should probably be using gprbuild, not gnatmake.

What is the difference? Is gprbuild a newer version of gnatmake? What are 
their differences?

> To find out how to do a syntax only compile, execute "gnatmake --help" or
> "gprbuild --help" in a shell window under an editor and search for
> "syntax".

I want to do it through .gpr file not through command line options.

Moreover, I already know that it is -gnatc switch.

-- 
Victor Porton - http://portonvictor.org


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to check syntax with GNAT?
  2017-07-09  6:54 How to check syntax with GNAT? Victor Porton
  2017-07-12 16:08 ` Stephen Leake
@ 2017-07-13  5:47 ` Simon Wright
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Wright @ 2017-07-13  5:47 UTC (permalink / raw)


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 .

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-07-13  5:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox