comp.lang.ada
 help / color / mirror / Atom feed
* [GNAT] Option for chasing some uninitialized variables ?
@ 2003-04-29 10:17 Gautier direct_replies_not_read
  2003-04-29 10:32 ` Vinzent Hoefler
  2003-04-29 10:41 ` Samuel Tardieu
  0 siblings, 2 replies; 7+ messages in thread
From: Gautier direct_replies_not_read @ 2003-04-29 10:17 UTC (permalink / raw)
  To: comp.lang.ada

Hello!
I faintly remember that there is a debug option or pragma
that gives an out-of-range value to uninitialized variables
or record fields, when possible, so that the range check always
raises Constraint_Error when such a value is used before it has
been initialized. Can someone recall its name - if it exists ?
I didn't find it in the docs. TIA!
________________________________________________________
Gautier  --  http://www.mysunrise.ch/users/gdm/gsoft.htm

NB: For a direct answer, e-mail address on the Web site!


_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
http://join.msn.com/?page=features/virus




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

* Re: [GNAT] Option for chasing some uninitialized variables ?
  2003-04-29 10:17 Gautier direct_replies_not_read
@ 2003-04-29 10:32 ` Vinzent Hoefler
  2003-04-29 10:41 ` Samuel Tardieu
  1 sibling, 0 replies; 7+ messages in thread
From: Vinzent Hoefler @ 2003-04-29 10:32 UTC (permalink / raw)


"Gautier direct_replies_not_read" <gautier_niouzes@hotmail.com> wrote:

>I faintly remember that there is a debug option or pragma
>that gives an out-of-range value to uninitialized variables
>or record fields, when possible, so that the range check always
>raises Constraint_Error when such a value is used before it has
>been initialized. Can someone recall its name - if it exists ?

You probably mean one of "pragma Normalize_Scalars", "pragma
Initialize_Scalars" and "-gnatv" (both GNAT-specific).


Vinzent.



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

* Re: [GNAT] Option for chasing some uninitialized variables ?
  2003-04-29 10:17 Gautier direct_replies_not_read
  2003-04-29 10:32 ` Vinzent Hoefler
@ 2003-04-29 10:41 ` Samuel Tardieu
  1 sibling, 0 replies; 7+ messages in thread
From: Samuel Tardieu @ 2003-04-29 10:41 UTC (permalink / raw)


>>>>> "Gautier" == Gautier direct replies not read <Gautier> writes:

Gautier> I faintly remember that there is a debug option or
Gautier> pragma that gives an out-of-range value to uninitialized
Gautier> variables or record fields, when possible, so that the range
Gautier> check always raises Constraint_Error when such a value is
Gautier> used before it has been initialized. Can someone recall its
Gautier> name - if it exists ?  I didn't find it in the docs. TIA!

You must be looking for "pragma Initialize_Scalars".

  Sam
-- 
Samuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/sam



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

* Re: [GNAT] Option for chasing some uninitialized variables ?
@ 2003-04-29 10:47 Gautier direct_replies_not_read
  2003-04-29 11:27 ` Vinzent Hoefler
  0 siblings, 1 reply; 7+ messages in thread
From: Gautier direct_replies_not_read @ 2003-04-29 10:47 UTC (permalink / raw)
  To: comp.lang.ada

Vinzent Hoefler:

>You probably mean one of "pragma Normalize_Scalars", "pragma
>Initialize_Scalars" and "-gnatv" (both GNAT-specific).

Thank you very much!
Interesting that "pragma Normalize_Scalars" is standard.

Don't you mean rather "-gnatVa" (validity checking) instead
of "-gnatv" (verbose) ?
BTW, is there a way to set one of these pragmata with a command_line
switch ? I wouldn't like to make two versions (debug/release)
of my sources for a pragma. TIA - Gautier


_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail




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

* Re: [GNAT] Option for chasing some uninitialized variables ?
  2003-04-29 10:47 Gautier direct_replies_not_read
@ 2003-04-29 11:27 ` Vinzent Hoefler
  0 siblings, 0 replies; 7+ messages in thread
From: Vinzent Hoefler @ 2003-04-29 11:27 UTC (permalink / raw)


"Gautier direct_replies_not_read" <gautier_niouzes@hotmail.com> wrote:

>Vinzent Hoefler:
>
>>You probably mean one of "pragma Normalize_Scalars", "pragma
>>Initialize_Scalars" and "-gnatv" (both GNAT-specific).
>
[...]
>Don't you mean rather "-gnatVa" (validity checking) instead
>of "-gnatv" (verbose) ?

Yes, of course.

>BTW, is there a way to set one of these pragmata with a command_line
>switch ?

No, not directly.

But if I understood that correctly, "pragma Normalize_Scalars" applies
to the whole program (partition), so it should be possible to set up
some package either from a "release/" and a "debug/" directory that
ex-/includes that pragma. The only thing you'd have to change then
would be the search path for the package. Well, it would require a
complete remake of the project each time then...

Another (perhaps easier but compiler specific und thus less portable)
solution would be to use GNAT's preprocessor gnatprep.


Vinzent.

-- 
Parents strongly cautioned  --  this  posting  is  intended for mature
audiences  over  18.  It  may  contain some material that many parents
would not find suitable for children and may include intense violence,
sexual situations, coarse language and suggestive dialogue.



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

* Re: [GNAT] Option for chasing some uninitialized variables ?
@ 2003-04-29 11:40 Gautier direct_replies_not_read
  2003-04-29 11:49 ` Vinzent Hoefler
  0 siblings, 1 reply; 7+ messages in thread
From: Gautier direct_replies_not_read @ 2003-04-29 11:40 UTC (permalink / raw)
  To: comp.lang.ada

> >BTW, is there a way to set one of these pragmata with a command_line
> >switch ?
>
>No, not directly.

Meanwhile I found an appropriate compiler option:
  -gnatec?  Specify configuration pragmas file, e.g. -gnatec/x/f.adc
Putting "pragma Initialize_Scalars;" into debug.pra and
adding "-gnatecdebug.pra" besides "-gnatVa" it functions
well. (I also tested with wrong file and pragma names to
see if GNAT reacts, and it does - where did I have this idea ;-) ?).
Thanks again!
________________________________________________________
Gautier  --  http://www.mysunrise.ch/users/gdm/gsoft.htm

NB: For a direct answer, e-mail address on the Web site!


_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail




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

* Re: [GNAT] Option for chasing some uninitialized variables ?
  2003-04-29 11:40 [GNAT] Option for chasing some uninitialized variables ? Gautier direct_replies_not_read
@ 2003-04-29 11:49 ` Vinzent Hoefler
  0 siblings, 0 replies; 7+ messages in thread
From: Vinzent Hoefler @ 2003-04-29 11:49 UTC (permalink / raw)


"Gautier direct_replies_not_read" <gautier_niouzes@hotmail.com> wrote:

>> >BTW, is there a way to set one of these pragmata with a command_line
>> >switch ?
>>
>>No, not directly.
>
>Meanwhile I found an appropriate compiler option:
>  -gnatec?  Specify configuration pragmas file, e.g. -gnatec/x/f.adc

Damn. ;-)

I should have taken a look into the GNAT User's Guide, not only into
the Reference Manual.


Vinzent.



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

end of thread, other threads:[~2003-04-29 11:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-29 11:40 [GNAT] Option for chasing some uninitialized variables ? Gautier direct_replies_not_read
2003-04-29 11:49 ` Vinzent Hoefler
  -- strict thread matches above, loose matches on Subject: below --
2003-04-29 10:47 Gautier direct_replies_not_read
2003-04-29 11:27 ` Vinzent Hoefler
2003-04-29 10:17 Gautier direct_replies_not_read
2003-04-29 10:32 ` Vinzent Hoefler
2003-04-29 10:41 ` Samuel Tardieu

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