comp.lang.ada
 help / color / mirror / Atom feed
* Project file - suggestions/help needed.
@ 2008-08-03  8:00 Thomas
  2008-08-03 10:41 ` Simon Wright
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Thomas @ 2008-08-03  8:00 UTC (permalink / raw)


Hey all,

I'm trying to learn how to setup project files. This is what I'm 
currently using:

http://pastebin.ca/1091592

It seems to work as intended, but I would really like some comments from 
the more experienced Ada crowd. Are there redundant settings in there? 
Are there important settings missing? Are there downright "dangerous" 
mistakes?

The posted project file has been build by combining settings found on 
various Ada/gnatmake related websites.

The goals of the file is:

1. A fairly well optimized executable
2. Generate as many style warnings as possible
3. Enable Ada 2005 extensions
4. It should work for basic Ada projects, coded by two beginners

Also, it looks as if I will be needing XML/Ada for the project I'm 
currently working on. How would I go about adding the XML/Ada stuff to 
my project file? Would I just move all the XML/Ada source files to my 
source/ directory, and that would be it?

Any and all advice would be greatly appreciated.  :o)

-- 
/Thomas L�cke

-- The major difference between a thing that might go wrong
-- and a thing that cannot possibly go wrong is that when a
-- thing that cannot possibly go wrong goes wrong it usually
-- turns out to be impossible to get at or repair.



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

* Re: Project file - suggestions/help needed.
  2008-08-03  8:00 Project file - suggestions/help needed Thomas
@ 2008-08-03 10:41 ` Simon Wright
  2008-08-03 11:03 ` Stephen Leake
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 19+ messages in thread
From: Simon Wright @ 2008-08-03 10:41 UTC (permalink / raw)


Thomas <me@pancon.dk> writes:

> Hey all,
>
> I'm trying to learn how to setup project files. This is what I'm
> currently using:
>
> http://pastebin.ca/1091592

I suppose we ought to say why each setting is in our GPRs! We can use
Ada-style comments (advice I'm not very good at taking myself).

You have a lot of settings there that I don't recognise.

For the Compiler, I set all standard warnings (except elaboration-order)
and styles, with normal optimisation:

  -gnatwaL -gnatqQafoy -O2

though I'm not sure about qQ.

I think -E belongs with the Binder, not the Builder. I specify debug
symbols with -g on the Builder.

> 1. A fairly well optimized executable
> 2. Generate as many style warnings as possible
> 3. Enable Ada 2005 extensions
> 4. It should work for basic Ada projects, coded by two beginners
>
> Also, it looks as if I will be needing XML/Ada for the project I'm
> currently working on. How would I go about adding the XML/Ada stuff to
> my project file? Would I just move all the XML/Ada source files to my
> source/ directory, and that would be it?

XML/Ada is meant to be installed, which would I suppose create an
xmlada.gpr, then you'd either ensure that that was on your
ADA_PROJECT_PATH and say eg 
  with "XMLAda.gpr";
or
  with "/full/path/to/XMLAda.gpr";

(I don't know the actual file name!)

However, I see that for my XML/Ada-using project I've just said

  Home := external ("HOME");

  for Source_Dirs use
    (
     ".",
     Home & "/xmlada/**",
     Home & "/bc"
    );

ie all Ada source under ~/xmlada. Might have to be careful if there is
test source under there (this was with 2.1).

--S



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

* Re: Project file - suggestions/help needed.
  2008-08-03  8:00 Project file - suggestions/help needed Thomas
  2008-08-03 10:41 ` Simon Wright
@ 2008-08-03 11:03 ` Stephen Leake
  2008-08-03 15:22 ` Gautier
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 19+ messages in thread
From: Stephen Leake @ 2008-08-03 11:03 UTC (permalink / raw)


Thomas <me@pancon.dk> writes:

> http://pastebin.ca/1091592
>
> It seems to work as intended, but I would really like some comments
> from the more experienced Ada crowd. Are there redundant settings in
> there? Are there important settings missing? 

-gnato

> Are there downright "dangerous" mistakes?

AdaCore recommends against -O3; it contains dangerous optimizations.
Stick with -O2.

> The posted project file has been build by combining settings found on
> various Ada/gnatmake related websites.

It also be good to read the GNAT User Guide and GNAT Reference.

What is the rationale for not using -gnatwa?

> The goals of the file is:
>
> 1. A fairly well optimized executable
> 2. Generate as many style warnings as possible
> 3. Enable Ada 2005 extensions
> 4. It should work for basic Ada projects, coded by two beginners
>
> Also, it looks as if I will be needing XML/Ada for the project I'm
> currently working on. How would I go about adding the XML/Ada stuff to
> my project file? 

I assume XML/Ada has a gpr file intended to be included in your
project file; let's assume it's /stuff/xml_ada/xml_ada.gpr. Declare an
environment variable ADA_PROJECT_PATH containing "/stuff/xml_ada".
Then add to your project file: "with xml_ada;", before the 'project' keyword.

> Would I just move all the XML/Ada source files to my source/
> directory, and that would be it?

No.

This is all explained in the GNAT Reference.

-- 
-- Stephe



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

* Re: Project file - suggestions/help needed.
  2008-08-03  8:00 Project file - suggestions/help needed Thomas
  2008-08-03 10:41 ` Simon Wright
  2008-08-03 11:03 ` Stephen Leake
@ 2008-08-03 15:22 ` Gautier
  2008-08-04 20:59   ` Colin_Paul_Gloster
  2008-08-03 17:13 ` Jeffrey R. Carter
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 19+ messages in thread
From: Gautier @ 2008-08-03 15:22 UTC (permalink / raw)


I'd recommend two modes, like "Debug" and "Release" or even three: 
"Debug", "Fast", "Small" like in .demo/GLOBE_3D_GPS_Win32.gpr
from the project there: http://globe3d.sf.net/ .
NB: The mentioned project file is generated by GPS.
HTH
Gautier



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

* Re: Project file - suggestions/help needed.
  2008-08-03  8:00 Project file - suggestions/help needed Thomas
                   ` (2 preceding siblings ...)
  2008-08-03 15:22 ` Gautier
@ 2008-08-03 17:13 ` Jeffrey R. Carter
  2008-08-03 22:09   ` Simon Wright
  2008-08-04 21:05   ` Colin_Paul_Gloster
  2008-08-03 18:43 ` Gene
  2008-08-04 20:54 ` Colin_Paul_Gloster
  5 siblings, 2 replies; 19+ messages in thread
From: Jeffrey R. Carter @ 2008-08-03 17:13 UTC (permalink / raw)


Thomas wrote:
> 
> The goals of the file is:
> 
> 1. A fairly well optimized executable

-O2 is probably a better choice than -O3, which applies possibly dangerous 
experimental optimizations.

> 2. Generate as many style warnings as possible

-gnatwa

> 3. Enable Ada 2005 extensions
> 4. It should work for basic Ada projects, coded by two beginners

Ada, as described in the ARM, requires integer overflow checking (-gnato), 
raising Storage_Error if you bust the stack (-fstack-check), and dynamic 
elaboration checks (-gnatE). If you want cross-unit inlining, you need -gnatn.

GNAT does static elaboration checking, which is fine for most situations, but 
will reject some valid Ada code, so leaving off -gnatE is usually not a problem. 
But I would recommend that you use -gnato and -fstack-check.

-- 
Jeff Carter
"You've got the brain of a four-year-old boy,
and I bet he was glad to get rid of it."
Horse Feathers
47



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

* Re: Project file - suggestions/help needed.
  2008-08-03  8:00 Project file - suggestions/help needed Thomas
                   ` (3 preceding siblings ...)
  2008-08-03 17:13 ` Jeffrey R. Carter
@ 2008-08-03 18:43 ` Gene
  2008-08-04 14:24   ` Thomas Locke
  2008-08-04 20:54 ` Colin_Paul_Gloster
  5 siblings, 1 reply; 19+ messages in thread
From: Gene @ 2008-08-03 18:43 UTC (permalink / raw)


On Aug 3, 4:00 am, Thomas <m...@pancon.dk> wrote:
> Hey all,
>
> I'm trying to learn how to setup project files. This is what I'm
> currently using:
>
> http://pastebin.ca/1091592
>
> It seems to work as intended, but I would really like some comments from
> the more experienced Ada crowd. Are there redundant settings in there?
> Are there important settings missing? Are there downright "dangerous"
> mistakes?
>
> The posted project file has been build by combining settings found on
> various Ada/gnatmake related websites.
>
> The goals of the file is:
>
> 1. A fairly well optimized executable
> 2. Generate as many style warnings as possible
> 3. Enable Ada 2005 extensions
> 4. It should work for basic Ada projects, coded by two beginners
>
> Also, it looks as if I will be needing XML/Ada for the project I'm
> currently working on. How would I go about adding the XML/Ada stuff to
> my project file? Would I just move all the XML/Ada source files to my
> source/ directory, and that would be it?
>
> Any and all advice would be greatly appreciated.  :o)
>
> --
> /Thomas Løcke

I'm not an expert on project files...rather the reverse, as it sounds
you are.  I've found it instructive to load GPS and fiddle with the
Project wizard to see how it builds project files for both development
and production compilations, with and for libraries, with included
projects, etc.





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

* Re: Project file - suggestions/help needed.
  2008-08-03 17:13 ` Jeffrey R. Carter
@ 2008-08-03 22:09   ` Simon Wright
  2008-08-04  9:17     ` Samuel Tardieu
  2008-08-04 21:05   ` Colin_Paul_Gloster
  1 sibling, 1 reply; 19+ messages in thread
From: Simon Wright @ 2008-08-03 22:09 UTC (permalink / raw)


"Jeffrey R. Carter" <spam.jrcarter.not@spam.acm.org> writes:

> Ada, as described in the ARM, requires integer overflow checking
> (-gnato), raising Storage_Error if you bust the stack (-fstack-check),
> and dynamic elaboration checks (-gnatE). If you want cross-unit
> inlining, you need -gnatn.

I wasn't able to see where the RM requires stack checking? 8.5.4(8.1/1),
for example, mentions infinite recursion as a possibility (well, not
possible really of course!)



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

* Re: Project file - suggestions/help needed.
  2008-08-03 22:09   ` Simon Wright
@ 2008-08-04  9:17     ` Samuel Tardieu
  0 siblings, 0 replies; 19+ messages in thread
From: Samuel Tardieu @ 2008-08-04  9:17 UTC (permalink / raw)


>>>>> "Simon" == Simon Wright <simon.j.wright@mac.com> writes:

Simon> I wasn't able to see where the RM requires stack checking?
Simon> 8.5.4(8.1/1), for example, mentions infinite recursion as a
Simon> possibility (well, not possible really of course!)

Of course it is possible. Infinite recursion doesn't necessarily imply
infinite stack usage (think recursive tail calls and sibling tail calls).

You may want to try the program attached at the end of this post. If
you compile it with GNAT using

  gnatmake -gnato -fstack-check -O2 recurse

you will see that it executes forever. Well, you might not be able to
guarantee that it executes forever of course, but you will see using
"top" or any other system monitor that its memory usage is not
increasing over time.

The recursive call in Infinite_Recursion is a tail call, meaning the
Infinite_Recursion subprogram has been transformed into its
semantically equivalent

  loop
    Display (X'Img);
    X := X + 1;
  end loop;

--  Program starts here

with Infinite_Recursion;

procedure Recurse is
begin
  Infinite_Recursion (0);
end Recurse;

with Display;
with Interfaces; use Interfaces;

procedure Infinite_Recursion (X : Unsigned_32) is
begin
   Display (X);
   Infinite_Recursion (X+1);
end Infinite_Recursion;

with Ada.Text_IO; use Ada.Text_IO;
With Interfaces;  use Interfaces;
procedure Display (X : Unsigned_32) is
begin
   Put_Line (X'Img);
end Display;



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

* Re: Project file - suggestions/help needed.
  2008-08-03 18:43 ` Gene
@ 2008-08-04 14:24   ` Thomas Locke
  2008-08-13 21:58     ` DScott
  0 siblings, 1 reply; 19+ messages in thread
From: Thomas Locke @ 2008-08-04 14:24 UTC (permalink / raw)


Gene wrote:
> I'm not an expert on project files...rather the reverse, as it sounds
> you are.  I've found it instructive to load GPS and fiddle with the
> Project wizard to see how it builds project files for both development
> and production compilations, with and for libraries, with included
> projects, etc.

I've only just started using GPS, and I had no idea it had such 
extensive settings for project files. Thank you for pointing it out.

:)
/Thomas



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

* Re: Project file - suggestions/help needed.
  2008-08-03  8:00 Project file - suggestions/help needed Thomas
                   ` (4 preceding siblings ...)
  2008-08-03 18:43 ` Gene
@ 2008-08-04 20:54 ` Colin_Paul_Gloster
  2008-08-05  5:26   ` Thomas Locke
  5 siblings, 1 reply; 19+ messages in thread
From: Colin_Paul_Gloster @ 2008-08-04 20:54 UTC (permalink / raw)


References: <4895659d$0$15880$edfadb0f@dtext01.news.tele.dk>

Thomas posted:
|------------------------------------------------------|
|"[..]                                                 |                                         
|                                                      |                                         
|[..]                                                  |                                         
|2. Generate as many style warnings as possible        |                                         
|[..]                                                  |                                         
|                                                      |                                         
|[..]                                                  |                                         
|                                                      |                                         
|Any and all advice would be greatly appreciated.  :o)"|
|------------------------------------------------------|

Are you using AdaControl?
WWW.Adalog.Fr/adacontrol2.htm




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

* Re: Project file - suggestions/help needed.
  2008-08-03 15:22 ` Gautier
@ 2008-08-04 20:59   ` Colin_Paul_Gloster
  0 siblings, 0 replies; 19+ messages in thread
From: Colin_Paul_Gloster @ 2008-08-04 20:59 UTC (permalink / raw)


References: <4895659d$0$15880$edfadb0f@dtext01.news.tele.dk> <4895cd2d$1_5@news.bluewin.ch
>

Gautier posted:
|-------------------------------------------------------------------|
|"I'd recommend two modes, like "Debug" and "Release" or even three:|                            
|"Debug", "Fast", "Small" [..]"                                     |
|-------------------------------------------------------------------|

It would be better to not have a difference between a debuggable
version and the deployed version.




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

* Re: Project file - suggestions/help needed.
  2008-08-03 17:13 ` Jeffrey R. Carter
  2008-08-03 22:09   ` Simon Wright
@ 2008-08-04 21:05   ` Colin_Paul_Gloster
  2008-08-05  5:27     ` Thomas Locke
  1 sibling, 1 reply; 19+ messages in thread
From: Colin_Paul_Gloster @ 2008-08-04 21:05 UTC (permalink / raw)


References: <4895659d$0$15880$edfadb0f@dtext01.news.tele.dk> <2Hllk.282253$yE1.253487@attbi_s21>

Similarly to Stephe A. Leake, Jeffrey R. Carter warned:
|--------------------------------------------------------------------------|
|"Thomas wrote:                                                            |                     
|>                                                                         |                     
|> The goals of the file is:                                               |                     
|>                                                                         |                     
|> 1. A fairly well optimized executable                                   |                     
|                                                                          |                     
|-O2 is probably a better choice than -O3, which applies possibly dangerous|                     
|experimental optimizations.                                               |                     
|                                                                          |                     
|[..]"                                                                     |
|--------------------------------------------------------------------------|

For the sake clarity, I point out that the supposed -O3 optimization
setting is not merely seriously flawed for GNAT, but for all of the
GNU Compiler Collection.




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

* Re: Project file - suggestions/help needed.
  2008-08-04 20:54 ` Colin_Paul_Gloster
@ 2008-08-05  5:26   ` Thomas Locke
  2008-08-05  8:00     ` Pascal Obry
  2008-08-05  8:05     ` Jean-Pierre Rosen
  0 siblings, 2 replies; 19+ messages in thread
From: Thomas Locke @ 2008-08-05  5:26 UTC (permalink / raw)


Colin_Paul_Gloster@ACM.org wrote:
> Are you using AdaControl?
> WWW.Adalog.Fr/adacontrol2.htm
> 

I didn't even know something like AdaControl existed, so it's safe to 
say that I'm not knowingly using it.

The webpage though says that AdaControl is integrated with GPS, and as 
I've just recently started using GPS, perhaps I am already using 
AdaControl, without knowing it?

/Thomas



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

* Re: Project file - suggestions/help needed.
  2008-08-04 21:05   ` Colin_Paul_Gloster
@ 2008-08-05  5:27     ` Thomas Locke
  2008-08-13 21:56       ` DScott
  0 siblings, 1 reply; 19+ messages in thread
From: Thomas Locke @ 2008-08-05  5:27 UTC (permalink / raw)


Colin_Paul_Gloster@ACM.org wrote:
> For the sake clarity, I point out that the supposed -O3 optimization
> setting is not merely seriously flawed for GNAT, but for all of the
> GNU Compiler Collection.


Well, that's the first change then. Gone is -O3, and back is -O2

:o)
/Thomas




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

* Re: Project file - suggestions/help needed.
  2008-08-05  5:26   ` Thomas Locke
@ 2008-08-05  8:00     ` Pascal Obry
  2008-08-05  8:10       ` Thomas Locke
  2008-08-05  8:05     ` Jean-Pierre Rosen
  1 sibling, 1 reply; 19+ messages in thread
From: Pascal Obry @ 2008-08-05  8:00 UTC (permalink / raw)
  To: Thomas Locke

Thomas Locke a �crit :
> The webpage though says that AdaControl is integrated with GPS, and as 
> I've just recently started using GPS, perhaps I am already using 
> AdaControl, without knowing it?

No as AdaControl is not distributed with GPS. It means that when 
AdaControl is installed properly it provides nice integration with GPS.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



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

* Re: Project file - suggestions/help needed.
  2008-08-05  5:26   ` Thomas Locke
  2008-08-05  8:00     ` Pascal Obry
@ 2008-08-05  8:05     ` Jean-Pierre Rosen
  1 sibling, 0 replies; 19+ messages in thread
From: Jean-Pierre Rosen @ 2008-08-05  8:05 UTC (permalink / raw)


Thomas Locke a �crit :
> I didn't even know something like AdaControl existed, so it's safe to 
> say that I'm not knowingly using it.
> 
> The webpage though says that AdaControl is integrated with GPS, and as 
> I've just recently started using GPS, perhaps I am already using 
> AdaControl, without knowing it?
> 
No, AdaControl is an independent tool, and you can run it from the 
command line. "Integrated with GPS" means that once you have installed 
it, you have extra buttons, menus, etc. that make it easy to use 
directly from within GPS.

-- 
---------------------------------------------------------
            J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr



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

* Re: Project file - suggestions/help needed.
  2008-08-05  8:00     ` Pascal Obry
@ 2008-08-05  8:10       ` Thomas Locke
  0 siblings, 0 replies; 19+ messages in thread
From: Thomas Locke @ 2008-08-05  8:10 UTC (permalink / raw)


Pascal Obry wrote:
> Thomas Locke a �crit :
>> The webpage though says that AdaControl is integrated with GPS, and as 
>> I've just recently started using GPS, perhaps I am already using 
>> AdaControl, without knowing it?
> 
> No as AdaControl is not distributed with GPS. It means that when 
> AdaControl is installed properly it provides nice integration with GPS.
> 
> Pascal.

That is good to know. Thank you.

So much to learn, so little time.  :o)

/Thomas




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

* Re: Project file - suggestions/help needed.
  2008-08-05  5:27     ` Thomas Locke
@ 2008-08-13 21:56       ` DScott
  0 siblings, 0 replies; 19+ messages in thread
From: DScott @ 2008-08-13 21:56 UTC (permalink / raw)


Thomas Locke wrote:
> Colin_Paul_Gloster@ACM.org wrote:
>> For the sake clarity, I point out that the supposed -O3 optimization
>> setting is not merely seriously flawed for GNAT, but for all of the
>> GNU Compiler Collection.
> 
> 
> Well, that's the first change then. Gone is -O3, and back is -O2
> 
> :o)
> /Thomas
> 
Changed here, too. (Although that may make my next merge complain! :)

-- 
Fui et vidi experiri.
=DSM=



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

* Re: Project file - suggestions/help needed.
  2008-08-04 14:24   ` Thomas Locke
@ 2008-08-13 21:58     ` DScott
  0 siblings, 0 replies; 19+ messages in thread
From: DScott @ 2008-08-13 21:58 UTC (permalink / raw)


Thomas Locke wrote:
> Gene wrote:
>> I'm not an expert on project files...rather the reverse, as it sounds
>> you are.  I've found it instructive to load GPS and fiddle with the
>> Project wizard to see how it builds project files for both development
>> and production compilations, with and for libraries, with included
>> projects, etc.
> 
> I've only just started using GPS, and I had no idea it had such 
> extensive settings for project files. Thank you for pointing it out.
> 
> :)
> /Thomas
That could account for the duplicate parameter that I emailed you about: I was working 
through GPS settings.

-- 
Fui et vidi experiri.
=DSM=



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

end of thread, other threads:[~2008-08-13 21:58 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-03  8:00 Project file - suggestions/help needed Thomas
2008-08-03 10:41 ` Simon Wright
2008-08-03 11:03 ` Stephen Leake
2008-08-03 15:22 ` Gautier
2008-08-04 20:59   ` Colin_Paul_Gloster
2008-08-03 17:13 ` Jeffrey R. Carter
2008-08-03 22:09   ` Simon Wright
2008-08-04  9:17     ` Samuel Tardieu
2008-08-04 21:05   ` Colin_Paul_Gloster
2008-08-05  5:27     ` Thomas Locke
2008-08-13 21:56       ` DScott
2008-08-03 18:43 ` Gene
2008-08-04 14:24   ` Thomas Locke
2008-08-13 21:58     ` DScott
2008-08-04 20:54 ` Colin_Paul_Gloster
2008-08-05  5:26   ` Thomas Locke
2008-08-05  8:00     ` Pascal Obry
2008-08-05  8:10       ` Thomas Locke
2008-08-05  8:05     ` Jean-Pierre Rosen

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