* GNAT: Weird Style Warnings
@ 2008-10-26 12:17 jacob.m.h.smith
2008-10-26 15:22 ` anon
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: jacob.m.h.smith @ 2008-10-26 12:17 UTC (permalink / raw)
Hello.
I am pretty new to Ada and I have a problem I'm not able to solve.
I compile my files with the following GNAT style switch: -
gnaty2acefhiklmM78nprt
When compiling this one adb file I always get the following message:
s-expuns.ads:42:04: (style) bad indentation
s-expuns.ads:44:04: (style) bad indentation
I have no idea why. This file "s-expuns.ads" is not one of mine, it
must be part of
some library. Does anyone know the meaning of this?
Here's the program text (It's no important project, I was just
experimenting):
-----------------------------------------------------------------------------
with Ada.Integer_Text_IO, Interfaces;
use Ada.Integer_Text_IO, Interfaces;
procedure Bit_Extraction is
subtype Byte is Unsigned_8;
function Get_Bits (The_Byte, Mask : Byte) return Byte is
Position : Natural := 0;
begin
while ((2**Position and Mask) = 0) loop
Position := Position + 1;
end loop;
return Shift_Right ((The_Byte and Mask), Position);
end Get_Bits;
Test_Byte, Test_Result : Byte;
begin
-- Test_Byte: 247 => 11110111
Test_Byte := 247;
-- Test_Result: 7 => 111
Test_Result := Get_Bits (Test_Byte, 224);
Put (Integer (Test_Result), 0);
end Bit_Extraction;
-----------------------------------------------------------------------------
Greetings,
Jacob M. H. Smith
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: GNAT: Weird Style Warnings
2008-10-26 12:17 GNAT: Weird Style Warnings jacob.m.h.smith
@ 2008-10-26 15:22 ` anon
2008-10-26 18:11 ` Georg Bauhaus
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: anon @ 2008-10-26 15:22 UTC (permalink / raw)
GNAT uses an Indentation value of 3, so when you reassign the indentation to 2
some system files may report this error when scanned.
The best solution is to either use indentation of 3 in your program or skip
the indentation style check.
In <6078a089-927b-4756-81a8-7c344df1ee16@u65g2000hsc.googlegroups.com>, jacob.m.h.smith@googlemail.com writes:
>Hello.
>
>I am pretty new to Ada and I have a problem I'm not able to solve.
>I compile my files with the following GNAT style switch: -
>gnaty2acefhiklmM78nprt
>When compiling this one adb file I always get the following message:
>s-expuns.ads:42:04: (style) bad indentation
>s-expuns.ads:44:04: (style) bad indentation
>I have no idea why. This file "s-expuns.ads" is not one of mine, it
>must be part of
>some library. Does anyone know the meaning of this?
>
>Here's the program text (It's no important project, I was just
>experimenting):
>
>-----------------------------------------------------------------------------
>with Ada.Integer_Text_IO, Interfaces;
>use Ada.Integer_Text_IO, Interfaces;
>
>procedure Bit_Extraction is
>
> subtype Byte is Unsigned_8;
>
> function Get_Bits (The_Byte, Mask : Byte) return Byte is
> Position : Natural := 0;
> begin
> while ((2**Position and Mask) = 0) loop
> Position := Position + 1;
> end loop;
> return Shift_Right ((The_Byte and Mask), Position);
> end Get_Bits;
>
> Test_Byte, Test_Result : Byte;
>
>begin
>
> -- Test_Byte: 247 => 11110111
> Test_Byte := 247;
>
> -- Test_Result: 7 => 111
> Test_Result := Get_Bits (Test_Byte, 224);
>
> Put (Integer (Test_Result), 0);
>
>end Bit_Extraction;
>-----------------------------------------------------------------------------
>
>Greetings,
>Jacob M. H. Smith
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: GNAT: Weird Style Warnings
2008-10-26 12:17 GNAT: Weird Style Warnings jacob.m.h.smith
2008-10-26 15:22 ` anon
@ 2008-10-26 18:11 ` Georg Bauhaus
2008-10-26 20:41 ` Jeffrey R. Carter
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Georg Bauhaus @ 2008-10-26 18:11 UTC (permalink / raw)
jacob.m.h.smith@googlemail.com wrote:
> Hello.
>
> I am pretty new to Ada and I have a problem I'm not able to solve.
> I compile my files with the following GNAT style switch: -
> gnaty2acefhiklmM78nprt
> When compiling this one adb file I always get the following message:
> s-expuns.ads:42:04: (style) bad indentation
> s-expuns.ads:44:04: (style) bad indentation
> I have no idea why. This file "s-expuns.ads" is not one of mine, it
> must be part of
> some library.
It is. Try compiling your unit and then run
$ gnatls -v -a -d bit_extraction.ali
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: GNAT: Weird Style Warnings
2008-10-26 12:17 GNAT: Weird Style Warnings jacob.m.h.smith
2008-10-26 15:22 ` anon
2008-10-26 18:11 ` Georg Bauhaus
@ 2008-10-26 20:41 ` Jeffrey R. Carter
2008-11-01 21:07 ` sjw
2008-11-05 19:09 ` jacob.m.h.smith
4 siblings, 0 replies; 8+ messages in thread
From: Jeffrey R. Carter @ 2008-10-26 20:41 UTC (permalink / raw)
jacob.m.h.smith@googlemail.com wrote:
>
> When compiling this one adb file I always get the following message:
> s-expuns.ads:42:04: (style) bad indentation
> s-expuns.ads:44:04: (style) bad indentation
> I have no idea why. This file "s-expuns.ads" is not one of mine, it
> must be part of
> some library. Does anyone know the meaning of this?
This is part of the GNAT run-time, and usually should not be subjected to your
style checks. This may indicate an installation issue. You might try reinstalling.
--
Jeff Carter
"Death awaits you all, with nasty, big, pointy teeth!"
Monty Python & the Holy Grail
20
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: GNAT: Weird Style Warnings
2008-10-26 12:17 GNAT: Weird Style Warnings jacob.m.h.smith
` (2 preceding siblings ...)
2008-10-26 20:41 ` Jeffrey R. Carter
@ 2008-11-01 21:07 ` sjw
2008-11-05 19:09 ` jacob.m.h.smith
4 siblings, 0 replies; 8+ messages in thread
From: sjw @ 2008-11-01 21:07 UTC (permalink / raw)
On Oct 26, 12:17 pm, jacob.m.h.sm...@googlemail.com wrote:
> I am pretty new to Ada and I have a problem I'm not able to solve.
> I compile my files with the following GNAT style switch: -
> gnaty2acefhiklmM78nprt
Being lazy I just use -gnaty == equivalent to -gnaty3abcefhiklmnprst.
I use Emacs ada-mode for editing, which makes it easy to get the 3-
character indentation; so does GPS.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: GNAT: Weird Style Warnings
2008-10-26 12:17 GNAT: Weird Style Warnings jacob.m.h.smith
` (3 preceding siblings ...)
2008-11-01 21:07 ` sjw
@ 2008-11-05 19:09 ` jacob.m.h.smith
2008-11-05 20:40 ` John B. Matthews
4 siblings, 1 reply; 8+ messages in thread
From: jacob.m.h.smith @ 2008-11-05 19:09 UTC (permalink / raw)
The style guide I'm working with dictates a 2 space indentation, so I
can't just change that. I left out the option for now, since my editor
is configured to indent 2 spaces, so a 3 space indentation is unlikely
to happen. But still, I'd prefer to let gnat check it for me.
I tried reinstalling. It didn't solve the problem. I also checked on
someone else's computer that has gnat installed. I get the same
warnings.
Jacob M. H. Smith
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-11-06 20:30 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-26 12:17 GNAT: Weird Style Warnings jacob.m.h.smith
2008-10-26 15:22 ` anon
2008-10-26 18:11 ` Georg Bauhaus
2008-10-26 20:41 ` Jeffrey R. Carter
2008-11-01 21:07 ` sjw
2008-11-05 19:09 ` jacob.m.h.smith
2008-11-05 20:40 ` John B. Matthews
2008-11-06 20:30 ` jacob.m.h.smith
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox