Project file - suggestions/help needed.

This is a discussion on Project file - suggestions/help needed. within the ADA forums in Programming Languages category; 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 ...

Go Back   Application Development Forum > Programming Languages > ADA

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-03-2008, 04:00 AM
Thomas
Guest
 
Default Project file - suggestions/help needed.

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. )

--
/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.
Reply With Quote
  #2  
Old 08-03-2008, 06:41 AM
Simon Wright
Guest
 
Default Re: Project file - suggestions/help needed.

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
Reply With Quote
  #3  
Old 08-03-2008, 07:03 AM
Stephen Leake
Guest
 
Default Re: Project file - suggestions/help needed.

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
Reply With Quote
  #4  
Old 08-03-2008, 11:22 AM
Gautier
Guest
 
Default Re: Project file - suggestions/help needed.

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
Reply With Quote
  #5  
Old 08-03-2008, 01:13 PM
Jeffrey R. Carter
Guest
 
Default Re: Project file - suggestions/help needed.

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
Reply With Quote
  #6  
Old 08-03-2008, 02:43 PM
Gene
Guest
 
Default Re: Project file - suggestions/help needed.

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. *)
>
> --
> /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.


Reply With Quote
  #7  
Old 08-03-2008, 06:09 PM
Simon Wright
Guest
 
Default Re: Project file - suggestions/help needed.

"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!)
Reply With Quote
  #8  
Old 08-04-2008, 05:17 AM
Samuel Tardieu
Guest
 
Default Re: Project file - suggestions/help needed.

>>>>> "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;
Reply With Quote
  #9  
Old 08-04-2008, 10:24 AM
Thomas Locke
Guest
 
Default Re: Project file - suggestions/help needed.

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
Reply With Quote
  #10  
Old 08-04-2008, 04:54 PM
Colin_Paul_Gloster@ACM.org
Guest
 
Default Re: Project file - suggestions/help needed.

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. )"|
|------------------------------------------------------|

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

Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 07:28 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.