comp.lang.ada
 help / color / mirror / Atom feed
* astyle/cindent for Ada?
@ 2012-07-27 15:56 awdorrin
  2012-07-27 17:45 ` Ludovic Brenta
  2012-07-29 14:37 ` Oliver Kellogg
  0 siblings, 2 replies; 18+ messages in thread
From: awdorrin @ 2012-07-27 15:56 UTC (permalink / raw)


Are there any code reformatters for Ada, such as 'astyle' or 'cindent' that are available for Linux?

I have tried using the 'gnatpp' program - but under Debian Linux it keeps telling me that my files aren't valid Ada source (even though they compile fine)

Thanks!



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

* Re: astyle/cindent for Ada?
  2012-07-27 15:56 astyle/cindent for Ada? awdorrin
@ 2012-07-27 17:45 ` Ludovic Brenta
  2012-07-27 18:00   ` Patrick
  2012-07-31 14:27   ` awdorrin
  2012-07-29 14:37 ` Oliver Kellogg
  1 sibling, 2 replies; 18+ messages in thread
From: Ludovic Brenta @ 2012-07-27 17:45 UTC (permalink / raw)


awdorrin writes:
> I have tried using the 'gnatpp' program - but under Debian Linux it
> keeps telling me that my files aren't valid Ada source (even though
> they compile fine)

Please report this immediately to the Debian bug tracking system.  If
this bug is serious enough I might be able to correct it before the next
stable release is made; it is currently frozen and only release-critical
bugs can be solved at this point.

-- 
Ludovic Brenta.



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

* Re: astyle/cindent for Ada?
  2012-07-27 17:45 ` Ludovic Brenta
@ 2012-07-27 18:00   ` Patrick
  2012-07-27 21:40     ` Patrick
  2012-07-28 18:14     ` it.marks.info
  2012-07-31 14:27   ` awdorrin
  1 sibling, 2 replies; 18+ messages in thread
From: Patrick @ 2012-07-27 18:00 UTC (permalink / raw)


I would like to confirm that I experienced the same issue with gnatpp



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

* Re: astyle/cindent for Ada?
  2012-07-27 18:00   ` Patrick
@ 2012-07-27 21:40     ` Patrick
  2012-07-27 22:46       ` Ludovic Brenta
  2012-07-28 18:14     ` it.marks.info
  1 sibling, 1 reply; 18+ messages in thread
From: Patrick @ 2012-07-27 21:40 UTC (permalink / raw)


Hi Ludovic

I would be the one to post the bug report only I have switch distros so many times I can't be sure what the set up was when I observed this.

I am having problems as well  with fsf gnat.

I have a simple ada file I ran with this on Xubuntu:

gnatpp first_procedure.adb 

I got this result:
gnatpp: No rule to check specified
gnatcheck: the GNAT rule checking tool
usage: gnatcheck [options] {filename} {-files=filename} [-cargs gcc_switches] -rules rule_switches
options:
 -a   - process RTL units
 -d   - debug mode
 -dd  - progress indicator mode (for use in GPS)
 -h   - print out the list of the currently implemented rules
 -mn  - n is the maximum number of diagnoses in Stdout
        (n in 0 .. 1000, 0 means no limit)
 -q   - quiet mode (do not report detections in Stdout)
 -t   - report execution time in Stderr
 -v   - verbose mode
 -log - duplicate all the messages sent to Stderr in log file
        gnatpp.log
 -s   - short form of the report file

 --include-file=filename - add the content of filename into generated report
 -o filename             - specify the name of the report file

filename                 - the name of the Ada source file to be analyzed.
                           Wildcards are allowed
-files=filemane          - the name of the text file containing a list of Ada
                           source filesto analyze

gcc_switches  - a list of switches that are valid switches for gcc

rule_switches          - a list of the following switches
   -from=filename      - read rule options from filename
   +ALL                - turn all the rules ON
   -ALL                - turn all the rules OFF
   +R<rule_id>[:param] - turn ON a given rule [with given parameter]
   -R<rule_id>         - turn OFF a given rule
   -R<rule_id>:param   - turn OFF some of the checkS for a given  rule,
                         depending on the specified parameter
where <rule_id> - ID of one of the currently implemented
                  rules, use '-h' for the full list
      param     - string representing parameter(s) of a given rule, more than 
                  one parameter can be set separated by ','


I did the same with the GNAT binary from Adacore and it formatted the code differently.

Have I done something stupid or is gnatpp not enabled in my gnat version?

I can post this bug if it is helpful-Patrick



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

* Re: astyle/cindent for Ada?
  2012-07-27 21:40     ` Patrick
@ 2012-07-27 22:46       ` Ludovic Brenta
  2012-07-28  0:06         ` Patrick
  0 siblings, 1 reply; 18+ messages in thread
From: Ludovic Brenta @ 2012-07-27 22:46 UTC (permalink / raw)


Patrick writes on comp.lang.ada:
> Hi Ludovic
>
> I would be the one to post the bug report only I have switch distros
> so many times I can't be sure what the set up was when I observed
> this.

A critical piece of information in any bug report is the *exact* version
of the gnatpp (i.e. of the package asis-programs, which contains gnatpp)
that produced the unexpected output.  So, please try to reproduce the
problem and use the Debian bug-reporting tools (i.e. reportbug) so it
gathers the critical information automatically and exactly.  Without
exact and complete information I cannot do anything.

The symptoms you describe remind me of http://bugs.debian.org/676338
(which BTW is an example of how properly to report a bug) but I cannot
be sure.

This bug is, of course, corrected in Debian.

-- 
Ludovic Brenta.



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

* Re: astyle/cindent for Ada?
  2012-07-27 22:46       ` Ludovic Brenta
@ 2012-07-28  0:06         ` Patrick
  2012-07-28  1:25           ` Nasser M. Abbasi
  0 siblings, 1 reply; 18+ messages in thread
From: Patrick @ 2012-07-28  0:06 UTC (permalink / raw)


Hi Again

installed via synaptic on xubuntu 11.10
GNAT 4.6.0
Copyright 1996-2010, Free Software Foundation, Inc.

gnatpp first_procedure.adb

gnatpp: No rule to check specified
gnatcheck: the GNAT rule checking tool etc..................

Adacore binary
GNAT GPL 2011 (20110419)
Copyright 1996-2011, Free Software Foundation, Inc.
works correctly

Should I file a bug through the ubuntu system?



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

* Re: astyle/cindent for Ada?
  2012-07-28  0:06         ` Patrick
@ 2012-07-28  1:25           ` Nasser M. Abbasi
  2012-07-28 13:04             ` Patrick
  0 siblings, 1 reply; 18+ messages in thread
From: Nasser M. Abbasi @ 2012-07-28  1:25 UTC (permalink / raw)


On 7/27/2012 7:06 PM, Patrick wrote:
> Hi Again
>
> installed via synaptic on xubuntu 11.10
> GNAT 4.6.0
> Copyright 1996-2010, Free Software Foundation, Inc.
>
> gnatpp first_procedure.adb
>
> gnatpp: No rule to check specified
> gnatcheck: the GNAT rule checking tool etc..................
>
> Adacore binary
> GNAT GPL 2011 (20110419)
> Copyright 1996-2011, Free Software Foundation, Inc.
> works correctly
>

fyi;

I also just checked gnatpp on GNAT GPL 2012 on Linux 32 bit.
It works fine there.

--Nasser




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

* Re: astyle/cindent for Ada?
  2012-07-28  1:25           ` Nasser M. Abbasi
@ 2012-07-28 13:04             ` Patrick
  2012-07-28 18:14               ` Ludovic Brenta
  0 siblings, 1 reply; 18+ messages in thread
From: Patrick @ 2012-07-28 13:04 UTC (permalink / raw)
  Cc: nma

I compiled gcc 4.6 from source and gave it the name ,gcc-Ada_C_X86_64.

Anyone happen to know how to call gnatpp from gcc ? I could test for the bug in the manually compiled version.



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

* Re: astyle/cindent for Ada?
  2012-07-27 18:00   ` Patrick
  2012-07-27 21:40     ` Patrick
@ 2012-07-28 18:14     ` it.marks.info
  1 sibling, 0 replies; 18+ messages in thread
From: it.marks.info @ 2012-07-28 18:14 UTC (permalink / raw)


Am Freitag, 27. Juli 2012 20:00:43 UTC+2 schrieb Patrick:
> I would like to confirm that I experienced the same issue with gnatpp

There is also a problem with the Windows version of gnatpp GPL 2012 (20120509). It rejects Ada 2012 source. The is -gnat12 flag is not supported (as in gcc).

Ingo



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

* Re: astyle/cindent for Ada?
  2012-07-28 13:04             ` Patrick
@ 2012-07-28 18:14               ` Ludovic Brenta
  0 siblings, 0 replies; 18+ messages in thread
From: Ludovic Brenta @ 2012-07-28 18:14 UTC (permalink / raw)


Patrick <patrick@spellingbeewinnars.org> writes:
> I compiled gcc 4.6 from source and gave it the name ,gcc-Ada_C_X86_64.
>
> Anyone happen to know how to call gnatpp from gcc ? I could test for
> the bug in the manually compiled version.

Please re-read my answer of 28 Jul 2012 00:46:21 +0200 carefully, the
information you need is in there.  Among other things, my message states
that gnatpp is not part of gcc.

-- 
Ludovic Brenta.



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

* Re: astyle/cindent for Ada?
  2012-07-27 15:56 astyle/cindent for Ada? awdorrin
  2012-07-27 17:45 ` Ludovic Brenta
@ 2012-07-29 14:37 ` Oliver Kellogg
  1 sibling, 0 replies; 18+ messages in thread
From: Oliver Kellogg @ 2012-07-29 14:37 UTC (permalink / raw)


On Friday, July 27, 2012 5:56:35 PM UTC+2, awdorrin wrote:
> Are there any code reformatters for Ada, such as 'astyle' or 'cindent' that are available for Linux?

At http://www.okellogg.de/x.html there is indentada.pl which is very simple and was mainly intended as a demo for using UniLexer.pm (at the same URL.)

> I have tried using the 'gnatpp' program - but under Debian Linux it keeps telling me that my files aren't valid Ada source (even though they compile fine)

indentada.pl in no way competes with gnatpp feature-wise, and is just enough to restore some basic formatting on messed up code. OTOH it does not pull in anything as complex as ASIS.

HTH,

 Oliver



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

* Re: astyle/cindent for Ada?
  2012-07-27 17:45 ` Ludovic Brenta
  2012-07-27 18:00   ` Patrick
@ 2012-07-31 14:27   ` awdorrin
  2012-07-31 14:38     ` awdorrin
  1 sibling, 1 reply; 18+ messages in thread
From: awdorrin @ 2012-07-31 14:27 UTC (permalink / raw)


On Friday, July 27, 2012 1:45:35 PM UTC-4, Ludovic Brenta wrote:
> awdorrin writes:
> 
> > I have tried using the 'gnatpp' program - but under Debian Linux it
> > keeps telling me that my files aren't valid Ada source (even though
> > they compile fine)
> 
> Please report this immediately to the Debian bug tracking system.  If
> this bug is serious enough I might be able to correct it before the next
> stable release is made; it is currently frozen and only release-critical
> bugs can be solved at this point.
> 
> -- 
> 
> Ludovic Brenta.

Unfortunately I have been out with a stomach bug the past few days and have not had a chance until today to look at this further.

If I try to run gnatpp against a simple program - it does work. It seems that it is the legacy code that it is having difficulty with.

There are some warnings about a repspec for a Florist/POSIX Mutex variable:

'size of "LOCK_ERROR" with aliased or tagged components not 192 bits'

The related code for the Mutex definition is similar to the following:

type FP_SHARED_BUF_TYPE is 
record
  LOCK_ERROR : POSIX.Mutexes.Mutex;
  <other entries for the record>
end record;

for FP_SHARED_BUF_TYPE use
record
  LOCK_ERROR at 0 range 0 .. 255;
  <other entries for the record>
end record;

I don't know if the warnings are causing 'gnatpp' to respond with: 'is not a legal Ada source' or not.

passing the verbose flag to gnatpp doesn't seem to provide any additional information. Are there any 'hidden' flags that could provide more detail?

I appear to be using:

- asis-programs Version 2008-5
- gnatpp (build with ASIS 2.0.R for gnat 4.4.5)
- gcc version 4.4.5 (Debian 4.4.5-8)

Since gnatpp does appear to work on simple Ada source code, but not my legacy source code, I'm hesitant to post a bug report, without digging into this further. (Since I know I can't provide any copy of the source code files causing the error.)






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

* Re: astyle/cindent for Ada?
  2012-07-31 14:27   ` awdorrin
@ 2012-07-31 14:38     ` awdorrin
  2012-07-31 14:56       ` awdorrin
  0 siblings, 1 reply; 18+ messages in thread
From: awdorrin @ 2012-07-31 14:38 UTC (permalink / raw)


On further investigation, the 'not a legal Ada source' does appear to be directly related to the rep-spec for the record.

If I comment out the rep-spec, gnatpp processes the file fine.

I guess the question is, why am I getting this error from 'gnatpp' but not when I build my application?



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

* Re: astyle/cindent for Ada?
  2012-07-31 14:38     ` awdorrin
@ 2012-07-31 14:56       ` awdorrin
  2012-07-31 20:04         ` Ludovic Brenta
  0 siblings, 1 reply; 18+ messages in thread
From: awdorrin @ 2012-07-31 14:56 UTC (permalink / raw)


Adding '-cargs -gnatI' - to ignore the rep-specs - 'gnatpp' appears to work properly.

Still not sure why 'gnatpp' is seeing the rep-spec as bad, while gnatmake does not see any issues with it...



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

* Re: astyle/cindent for Ada?
  2012-07-31 14:56       ` awdorrin
@ 2012-07-31 20:04         ` Ludovic Brenta
  2012-08-02 18:28           ` awdorrin
  0 siblings, 1 reply; 18+ messages in thread
From: Ludovic Brenta @ 2012-07-31 20:04 UTC (permalink / raw)


awdorrin <awdorrin@gmail.com> writes:
> Adding '-cargs -gnatI' - to ignore the rep-specs - 'gnatpp' appears to
> work properly.
>
> Still not sure why 'gnatpp' is seeing the rep-spec as bad, while
> gnatmake does not see any issues with it...

This might be a bug in ASIS or in gnatpp itself and not in the compiler.

Anyway this is not the bug I was thinking of.  Please consider trying
asis-programs 2010-5 (currently in Debian testing) against your sources
before the final release of Debian 7 "Wheezy", so I know whether or not
I should invest time in fixing this bug.

-- 
Ludovic Brenta.



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

* Re: astyle/cindent for Ada?
  2012-07-31 20:04         ` Ludovic Brenta
@ 2012-08-02 18:28           ` awdorrin
  2012-08-02 19:59             ` Ludovic Brenta
  0 siblings, 1 reply; 18+ messages in thread
From: awdorrin @ 2012-08-02 18:28 UTC (permalink / raw)


On Tuesday, July 31, 2012 4:04:45 PM UTC-4, Ludovic Brenta wrote:
> Anyway this is not the bug I was thinking of.  Please consider trying
> asis-programs 2010-5 (currently in Debian testing) against your sources
> before the final release of Debian 7 "Wheezy", so I know whether or not
> I should invest time in fixing this bug.
> 
> -- 
> Ludovic Brenta.

I have been playing around with trying to install the asis-programs 2010-5 from the testing repository, but I haven't been able to get it installed yet due to dependencies that are 'not going to be installed'.

I haven't installed anything from the testing releases yet, so I'm not quite sure what I'm doing yet. :)



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

* Re: astyle/cindent for Ada?
  2012-08-02 18:28           ` awdorrin
@ 2012-08-02 19:59             ` Ludovic Brenta
  2012-08-06 12:36               ` awdorrin
  0 siblings, 1 reply; 18+ messages in thread
From: Ludovic Brenta @ 2012-08-02 19:59 UTC (permalink / raw)


awdorrin writes on comp.lang.ada:
> On Tuesday, July 31, 2012 4:04:45 PM UTC-4, Ludovic Brenta wrote:
>> Anyway this is not the bug I was thinking of.  Please consider trying
>> asis-programs 2010-5 (currently in Debian testing) against your sources
>> before the final release of Debian 7 "Wheezy", so I know whether or not
>> I should invest time in fixing this bug.
>
> I have been playing around with trying to install the asis-programs
> 2010-5 from the testing repository, but I haven't been able to get it
> installed yet due to dependencies that are 'not going to be
> installed'.
>
> I haven't installed anything from the testing releases yet, so I'm not
> quite sure what I'm doing yet. :)

You need Debian testing, possibly in a chroot on your Debian stable.
Recipe here:

http://lists.debian.org/debian-ada/2010/02/msg00003.html

-- 
Ludovic Brenta.



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

* Re: astyle/cindent for Ada?
  2012-08-02 19:59             ` Ludovic Brenta
@ 2012-08-06 12:36               ` awdorrin
  0 siblings, 0 replies; 18+ messages in thread
From: awdorrin @ 2012-08-06 12:36 UTC (permalink / raw)


I spent some time over the weekend setting up a VirtualBox image of Debian-Wheezy's latest Beta up on my home PC. I then installed the updates for GNAT, asis-programs 2010, Florist, etc.

When I ran 'gnatpp' against my source code, I no longer got any exceptions, but I did get some errors about files 'not being legal Ada source.' 

It looked like those errors were tied to 'comment lines too long' - but I have not had a chance to try and update the corresponding source code files yet, to break the comment lines up.

It does look like, whatever the cause of the error in the Debian-6 gnatpp, that it is resolved in the latest asis-programs 2010 available in Wheezy.



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

end of thread, other threads:[~2012-08-07 12:54 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-27 15:56 astyle/cindent for Ada? awdorrin
2012-07-27 17:45 ` Ludovic Brenta
2012-07-27 18:00   ` Patrick
2012-07-27 21:40     ` Patrick
2012-07-27 22:46       ` Ludovic Brenta
2012-07-28  0:06         ` Patrick
2012-07-28  1:25           ` Nasser M. Abbasi
2012-07-28 13:04             ` Patrick
2012-07-28 18:14               ` Ludovic Brenta
2012-07-28 18:14     ` it.marks.info
2012-07-31 14:27   ` awdorrin
2012-07-31 14:38     ` awdorrin
2012-07-31 14:56       ` awdorrin
2012-07-31 20:04         ` Ludovic Brenta
2012-08-02 18:28           ` awdorrin
2012-08-02 19:59             ` Ludovic Brenta
2012-08-06 12:36               ` awdorrin
2012-07-29 14:37 ` Oliver Kellogg

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