public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [Ada] Trivial fix for warning in utils.c
@ 2001-11-13 15:03 John David Anglin
  2001-11-13 15:03 ` guerby
  0 siblings, 1 reply; 14+ messages in thread
From: John David Anglin @ 2001-11-13 15:03 UTC (permalink / raw)
  To: gcc-patches; +Cc: guerby

>   void
> ! gnat_init_decl_processing (void)

All the functions in the file use KR style.  The function actually needs
a prototype.  There is one in misc.c but that is rather a strange place
for it.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

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

* Re: [Ada] Trivial fix for warning in utils.c
  2001-11-13 15:03   ` Neil Booth
@ 2001-11-13 15:03     ` Florian Weimer
  0 siblings, 0 replies; 14+ messages in thread
From: Florian Weimer @ 2001-11-13 15:03 UTC (permalink / raw)
  To: Neil Booth; +Cc: guerby, dave, gcc-patches

Neil Booth <neil@daikokuya.demon.co.uk> writes:

> Using PARAMS ((void)) is fine whatever your compiler; on K & R it expands
> to () and for ANSI compilers it becomes (void).

I think for strict C89 compilers, it has to become (), too, because
you cannot mix prototypes and old-style function definitions there.

I'm not sure whether C99 compilers have to reject such code or not, or
may silently generate code which does not work as intended.

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

* Re: [Ada] Trivial fix for warning in utils.c
  2001-11-13 15:03 ` guerby
@ 2001-11-13 15:03   ` Neil Booth
  2001-11-13 15:03     ` Florian Weimer
  0 siblings, 1 reply; 14+ messages in thread
From: Neil Booth @ 2001-11-13 15:03 UTC (permalink / raw)
  To: guerby; +Cc: dave, gcc-patches

guerby@acm.org wrote:-


> Looking in other ada/*.c files both style are used (PARAMS((void)) vs
> (void))

Using PARAMS ((void)) is fine whatever your compiler; on K & R it expands
to () and for ANSI compilers it becomes (void).

It's in the function definition that it really matters what you do.

Sorry for not putting the declaration in gigi.h; I never noticed that.
I assumed GNAT pulled it all in from tree.h like other front ends do.
I'll get it right in future.

Neil.

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

* Re: [Ada] Trivial fix for warning in utils.c
  2001-11-13 15:03 [Ada] Trivial fix for warning in utils.c John David Anglin
@ 2001-11-13 15:03 ` guerby
  2001-11-13 15:03   ` Neil Booth
  0 siblings, 1 reply; 14+ messages in thread
From: guerby @ 2001-11-13 15:03 UTC (permalink / raw)
  To: dave; +Cc: gcc-patches

> All the functions in the file use KR style.  The function actually needs
> a prototype.  There is one in misc.c but that is rather a strange place
> for it.

Not true, I checked to see wether void was already used and found:

void
end_subprog_body (void)

Looking in other ada/*.c files both style are used (PARAMS((void)) vs (void)).
It would be trivial to move to one or another. Richard, should I test and submit
a patch moving to one of those style (and which one)?

BTW, do the ada/*.c file use C features not supported by your average
K&R compiler? (Giving a false sense of K&R'ness makes no good IMHO.)

-- 
Laurent Guerby <guerby@acm.org>

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

* Re: [Ada] Trivial fix for warning in utils.c
@ 2001-11-13 15:03 Richard Kenner
  0 siblings, 0 replies; 14+ messages in thread
From: Richard Kenner @ 2001-11-13 15:03 UTC (permalink / raw)
  To: guerby; +Cc: gcc-patches

    This does not apply to GNAT files since we already need GNAT + GCC
    installed to start with so we do have an ANSI compiler around :).

But I still try to follow the K&R rules in GNAT C sources for
consistency.

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

* Re:  [Ada] Trivial fix for warning in utils.c
@ 2001-11-13 15:03 Richard Kenner
  0 siblings, 0 replies; 14+ messages in thread
From: Richard Kenner @ 2001-11-13 15:03 UTC (permalink / raw)
  To: guerby; +Cc: gcc-patches

    Untested but obvious, ok to commit?
 
Oh, that's right: this is not OK.  I misread it and thought you were
changing the name.  This looks like a missing declaration somewhere.

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

* Re: [Ada] Trivial fix for warning in utils.c
  2001-11-13 15:03   ` guerby
@ 2001-11-13 15:03     ` Florian Weimer
  2001-11-13 15:03     ` Mark Mitchell
  1 sibling, 0 replies; 14+ messages in thread
From: Florian Weimer @ 2001-11-13 15:03 UTC (permalink / raw)
  To: guerby; +Cc: grahams, gcc-patches

<guerby@acm.org> writes:

D>> I think is is wrong it needs to be buildable with a K&R compiler.
>
> This does not apply to GNAT files since we already need GNAT + GCC
> installed to start with so we do have an ANSI compiler around :).

Of course, you could always bootstrap the C compiler first, and then
the Ada frontend, but I don't think it's correct to assume that the
preinstalled C compiler can deal with prototypes and new-style
function definitions.

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

* Re: [Ada] Trivial fix for warning in utils.c
  2001-11-13 15:03 guerby
@ 2001-11-13 15:03 ` Graham Stott
  2001-11-13 15:03   ` guerby
  0 siblings, 1 reply; 14+ messages in thread
From: Graham Stott @ 2001-11-13 15:03 UTC (permalink / raw)
  To: guerby; +Cc: gcc-patches

guerby@acm.org wrote:
> 
> Fixes:
> 
> stage1/xgcc -Bstage1/ -B/home/guerby/work/gcc/install-2001-11-16-19-21-56/i686-pc-linux-gnu/bin/ -c  -DIN_GCC    `echo -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long |sed -e 's/-pedantic//g' -e 's/-Wtraditional//g'`  -g -O2    -I- -I. -I.. -I../../../gcc/gcc/ada -I../../../gcc/gcc/ada/.. -I../../../gcc/gcc/ada/../config -I../../../gcc/gcc/ada/../../include ../../../gcc/gcc/ada/utils.c
> ../../../gcc/gcc/ada/utils.c:482: warning: function declaration isn't a prototype
> 
> Untested but obvious, ok to commit?
> 
I think is is wrong it needs to be buildable with a K&R compiler.

The proper fix is to rename "init_decl_processing" in gigi.h

Graham

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

* [Ada] Trivial fix for warning in utils.c
@ 2001-11-13 15:03 guerby
  2001-11-13 15:03 ` Graham Stott
  0 siblings, 1 reply; 14+ messages in thread
From: guerby @ 2001-11-13 15:03 UTC (permalink / raw)
  To: gcc-patches

Fixes:

stage1/xgcc -Bstage1/ -B/home/guerby/work/gcc/install-2001-11-16-19-21-56/i686-pc-linux-gnu/bin/ -c  -DIN_GCC    `echo -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long |sed -e 's/-pedantic//g' -e 's/-Wtraditional//g'`  -g -O2    -I- -I. -I.. -I../../../gcc/gcc/ada -I../../../gcc/gcc/ada/.. -I../../../gcc/gcc/ada/../config -I../../../gcc/gcc/ada/../../include ../../../gcc/gcc/ada/utils.c
../../../gcc/gcc/ada/utils.c:482: warning: function declaration isn't a prototype

Untested but obvious, ok to commit?

-- 
Laurent Guerby <guerby@acm.org>


2001-11-16  Laurent Guerby  <guerby@acm.org>
	
	* utils.c: Fix warning.

Index: utils.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/utils.c,v
retrieving revision 1.4
diff -c -3 -p -r1.4 utils.c
*** utils.c	2001/11/15 10:00:54	1.4
--- utils.c	2001/11/16 19:04:57
*************** pushdecl (decl)
*** 478,484 ****
     front end has been run.  */
  
  void
! gnat_init_decl_processing ()
  {
    lineno = 0;
  
--- 478,484 ----
     front end has been run.  */
  
  void
! gnat_init_decl_processing (void)
  {
    lineno = 0;

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

* Re: [Ada] Trivial fix for warning in utils.c
  2001-11-13 15:03 Richard Kenner
@ 2001-11-13 15:03 ` guerby
  0 siblings, 0 replies; 14+ messages in thread
From: guerby @ 2001-11-13 15:03 UTC (permalink / raw)
  To: kenner; +Cc: gcc-patches

> Yes, but doesn't this depend on a pending patch?

Neil's stuff has been commited if that's what you're referring to:

2001-11-15  Neil Booth  <neil@daikokuya.demon.co.uk>

	* misc.c (gnat_init): Change prototype.  Include the
	functionality of the old init_parse and init_decl_processing.
	(gnat_init_decl_processing): New prototype.
	(init_parse): Remove.
	* utils.c (init_decl_processing): Rename gnat_init_decl_processing.

-- 
Laurent Guerby <guerby@acm.org>

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

* Re: [Ada] Trivial fix for warning in utils.c
@ 2001-11-13 15:03 Richard Kenner
  0 siblings, 0 replies; 14+ messages in thread
From: Richard Kenner @ 2001-11-13 15:03 UTC (permalink / raw)
  To: guerby; +Cc: gcc-patches

    Not true, I checked to see wether void was already used and found:

    void
    end_subprog_body (void)

That's an error.

    Looking in other ada/*.c files both style are used (PARAMS((void)) vs
    (void)).  It would be trivial to move to one or another. Richard,
    should I test and submit a patch moving to one of those style (and
    which one)?

They should all be the K&R way.  Consider such a patch preapproved.

    BTW, do the ada/*.c file use C features not supported by your average
    K&R compiler? (Giving a false sense of K&R'ness makes no good IMHO.)

They are not supposed to.

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

* Re: [Ada] Trivial fix for warning in utils.c
  2001-11-13 15:03 ` Graham Stott
@ 2001-11-13 15:03   ` guerby
  2001-11-13 15:03     ` Florian Weimer
  2001-11-13 15:03     ` Mark Mitchell
  0 siblings, 2 replies; 14+ messages in thread
From: guerby @ 2001-11-13 15:03 UTC (permalink / raw)
  To: grahams; +Cc: gcc-patches

> I think is is wrong it needs to be buildable with a K&R compiler.

This does not apply to GNAT files since we already need GNAT + GCC
installed to start with so we do have an ANSI compiler around :).

> The proper fix is to rename "init_decl_processing" in gigi.h

I indeed forgot this part of the patch.

-- 
Laurent Guerby <guerby@acm.org>

2001-11-16  Laurent Guerby  <guerby@acm.org>
	
	* gigi.h, utils.c: Fix warning.

Index: utils.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/utils.c,v
retrieving revision 1.4
diff -c -3 -p -r1.4 utils.c
*** utils.c	2001/11/15 10:00:54	1.4
--- utils.c	2001/11/16 19:16:49
*************** pushdecl (decl)
*** 478,484 ****
     front end has been run.  */
  
  void
! gnat_init_decl_processing ()
  {
    lineno = 0;
  
--- 478,484 ----
     front end has been run.  */
  
  void
! gnat_init_decl_processing (void)
  {
    lineno = 0;
  
Index: gigi.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/gigi.h,v
retrieving revision 1.2
diff -c -3 -p -r1.2 gigi.h
*** gigi.h	2001/10/23 22:59:52	1.2
--- gigi.h	2001/11/16 19:16:51
*************** extern tree pushdecl			PARAMS ((tree));
*** 433,439 ****
  
  /* Create the predefined scalar types such as `integer_type_node' needed 
     in the gcc back-end and initialize the global binding level.  */
! extern void init_decl_processing	PARAMS ((void));
  extern void init_gigi_decls		PARAMS ((tree, tree));
  
  /* Return an integer type with the number of bits of precision given by  
--- 433,439 ----
  
  /* Create the predefined scalar types such as `integer_type_node' needed 
     in the gcc back-end and initialize the global binding level.  */
! extern void gnat_init_decl_processing	PARAMS ((void));
  extern void init_gigi_decls		PARAMS ((tree, tree));
  
  /* Return an integer type with the number of bits of precision given by  

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

* Re: [Ada] Trivial fix for warning in utils.c
  2001-11-13 15:03   ` guerby
  2001-11-13 15:03     ` Florian Weimer
@ 2001-11-13 15:03     ` Mark Mitchell
  1 sibling, 0 replies; 14+ messages in thread
From: Mark Mitchell @ 2001-11-13 15:03 UTC (permalink / raw)
  To: guerby, grahams; +Cc: gcc-patches



--On Friday, November 16, 2001 08:16:18 PM +0100 "guerby@acm.org" 
<guerby@acm.org> wrote:

>> I think is is wrong it needs to be buildable with a K&R compiler.
>
> This does not apply to GNAT files since we already need GNAT + GCC
> installed to start with so we do have an ANSI compiler around :).

I see no reason that GNAT should use different coding conventions from
the rest of GCC.  G++ is always built with GCC too, but we still use
the GNU Coding Conventions.  There are two advantages: consistency,
and its much easier to promote things out of G++ into common
code when appropriate.

-- 
Mark Mitchell                mark@codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com

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

* Re:  [Ada] Trivial fix for warning in utils.c
@ 2001-11-13 15:03 Richard Kenner
  2001-11-13 15:03 ` guerby
  0 siblings, 1 reply; 14+ messages in thread
From: Richard Kenner @ 2001-11-13 15:03 UTC (permalink / raw)
  To: guerby; +Cc: gcc-patches

    Untested but obvious, ok to commit?

Yes, but doesn't this depend on a pending patch?

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

end of thread, other threads:[~2001-11-16 23:22 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-13 15:03 [Ada] Trivial fix for warning in utils.c John David Anglin
2001-11-13 15:03 ` guerby
2001-11-13 15:03   ` Neil Booth
2001-11-13 15:03     ` Florian Weimer
  -- strict thread matches above, loose matches on Subject: below --
2001-11-13 15:03 Richard Kenner
2001-11-13 15:03 guerby
2001-11-13 15:03 ` Graham Stott
2001-11-13 15:03   ` guerby
2001-11-13 15:03     ` Florian Weimer
2001-11-13 15:03     ` Mark Mitchell
2001-11-13 15:03 Richard Kenner
2001-11-13 15:03 ` guerby
2001-11-13 15:03 Richard Kenner
2001-11-13 15:03 Richard Kenner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).