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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: How to check syntax with GNAT? Date: Thu, 13 Jul 2017 06:47:43 +0100 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="e067077027e00849a00e33f09368d9b7"; logging-data="27306"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/F0Hnba6w3LIrhJ6hNc/xkO2jZ7m8nfSM=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (darwin) Cancel-Lock: sha1:AHTW3sF5ZjWsV7LWBKMCKxXkM/U= sha1:TA8L0ghjNbbxsPzF8ipFlGtg/R8= Xref: news.eternal-september.org comp.lang.ada:47392 Date: 2017-07-13T06:47:43+01:00 List-Id: Victor Porton 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 .