| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| 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. |
|
#2
| |||
| |||
| 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 |
|
#3
| |||
| |||
| 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 |
|
#4
| |||
| |||
| 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 |
|
#5
| |||
| |||
| 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 |
|
#6
| |||
| |||
| 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. |
|
#7
| |||
| |||
| "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!) |
|
#8
| |||
| |||
| >>>>> "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; |
|
#9
| |||
| |||
| 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 |
|
#10
| |||
| |||
| 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 |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.