unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Unnecessary warnings
@ 2006-09-24 15:42 Bruce Korb
  2006-09-25  8:19 ` Ludovic Courtès
  2006-09-25 22:33 ` Kevin Ryde
  0 siblings, 2 replies; 6+ messages in thread
From: Bruce Korb @ 2006-09-24 15:42 UTC (permalink / raw)
  Cc: Harlan Stenn

/usr/local/gnu/include/libguile/smob.h:149: warning: declaration of 'free' shadows a global declaration
/usr/local/gnu/include/libguile/filesys.h:75: warning: declaration of 'dirname' shadows a global declaration
/usr/local/gnu/include/libguile/ports.h:233: warning: declaration of 'write' shadows a global declaration
/usr/local/gnu/include/libguile/ports.h:254: warning: declaration of 'truncate' shadows a global declaration
/usr/local/gnu/include/libguile/numbers.h:258: warning: declaration of 'div' shadows a global declaration
/usr/local/gnu/include/libguile/stime.h:55: warning: declaration of 'time' shadows a global declaration
/usr/include/iso/time_iso.h:91: warning: shadowed declaration is here
/usr/local/gnu/include/libguile/stime.h:56: warning: declaration of 'time' shadows a global declaration
/usr/include/iso/time_iso.h:91: warning: shadowed declaration is here
/usr/local/gnu/include/libguile/stime.h:60: warning: declaration of 'stime' shadows a global declaration

These are all due to argument names in prototype declarations.
Please suffix the names with "_arg" or something.
Meanwhile, compilations will choke with -Wshadow.


/usr/local/gnu/include/libguile/gsubr.h:65: warning: function declaration isn't a prototype
/usr/local/gnu/include/libguile/gsubr.h:68: warning: function declaration isn't a prototype
/usr/local/gnu/include/libguile/gsubr.h:70: warning: function declaration isn't a prototype
/usr/local/gnu/include/libguile/gsubr.h:73: warning: function declaration isn't a prototype
/usr/local/gnu/include/libguile/gsubr.h:81: warning: function declaration isn't a prototype
/usr/local/gnu/include/libguile/gsubr.h:86: warning: function declaration isn't a prototype

Here, the complaint is about stuff like this:

extern SCM scm_c_make_gsubr (const char *name, 
			     int req, int opt, int rst, SCM (*fcn) ());

where "fcn" does not look like a prototype.  It needs "(void)" as the
argument list.  Better is to:

   typedef SCM (scm_gsubr_callout_t) __P((void));

and use "scm_gsubr_callout_t *" in the argument list.  This works with
K&R, by the way.

Thanks - Bruce



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


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

* Re: Unnecessary warnings
  2006-09-24 15:42 Unnecessary warnings Bruce Korb
@ 2006-09-25  8:19 ` Ludovic Courtès
  2006-09-25 14:43   ` Bruce Korb
  2006-09-25 22:33 ` Kevin Ryde
  1 sibling, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2006-09-25  8:19 UTC (permalink / raw)
  Cc: Harlan Stenn, guile-devel

Hi,

Bruce Korb <bkorb@gnu.org> writes:

> /usr/local/gnu/include/libguile/smob.h:149: warning: declaration of 'free' shadows a global declaration
> /usr/local/gnu/include/libguile/filesys.h:75: warning: declaration of 'dirname' shadows a global declaration
> /usr/local/gnu/include/libguile/ports.h:233: warning: declaration of 'write' shadows a global declaration
> /usr/local/gnu/include/libguile/ports.h:254: warning: declaration of 'truncate' shadows a global declaration
> /usr/local/gnu/include/libguile/numbers.h:258: warning: declaration of 'div' shadows a global declaration
> /usr/local/gnu/include/libguile/stime.h:55: warning: declaration of 'time' shadows a global declaration
> /usr/include/iso/time_iso.h:91: warning: shadowed declaration is here
> /usr/local/gnu/include/libguile/stime.h:56: warning: declaration of 'time' shadows a global declaration
> /usr/include/iso/time_iso.h:91: warning: shadowed declaration is here
> /usr/local/gnu/include/libguile/stime.h:60: warning: declaration of 'stime' shadows a global declaration
>
> These are all due to argument names in prototype declarations.

What compiler issues those messages?  To me, it looks like the compiler
is kind of broken, because there's no reason (AFAIK) there can be name
clashes between argument names and global declarations.

Thanks,
Ludovic.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


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

* Re: Unnecessary warnings
  2006-09-25  8:19 ` Ludovic Courtès
@ 2006-09-25 14:43   ` Bruce Korb
  2006-09-25 14:53     ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Bruce Korb @ 2006-09-25 14:43 UTC (permalink / raw)


On 9/25/06, Ludovic Courtès <ludovic.courtes@laas.fr> wrote:
> Hi,
>
> Bruce Korb <bkorb@gnu.org> writes:
>
> > /usr/local/gnu/include/libguile/smob.h:149: warning: declaration of 'free' shadows a global declaration
> > /usr/local/gnu/include/libguile/filesys.h:75: warning: declaration of 'dirname' shadows a global declaration
> > /usr/local/gnu/include/libguile/ports.h:233: warning: declaration of 'write' shadows a global declaration
> > /usr/local/gnu/include/libguile/ports.h:254: warning: declaration of 'truncate' shadows a global declaration
> > /usr/local/gnu/include/libguile/numbers.h:258: warning: declaration of 'div' shadows a global declaration
> > /usr/local/gnu/include/libguile/stime.h:55: warning: declaration of 'time' shadows a global declaration
> > /usr/include/iso/time_iso.h:91: warning: shadowed declaration is here
> > /usr/local/gnu/include/libguile/stime.h:56: warning: declaration of 'time' shadows a global declaration
> > /usr/include/iso/time_iso.h:91: warning: shadowed declaration is here
> > /usr/local/gnu/include/libguile/stime.h:60: warning: declaration of 'stime' shadows a global declaration
> >
> > These are all due to argument names in prototype declarations.
>
> What compiler issues those messages?  To me, it looks like the compiler
> is kind of broken, because there's no reason (AFAIK) there can be name
> clashes between argument names and global declarations.

GCC on Solaris.  I agree that it is just a documentation name and serves
no other purpose, but there it is.  I do like -Wshadow, but it is not so useful
if cluttered up with these spurious messages.  As for the "function is not
a prototype" messages, having a typedef for the particular procedure profile
being passed around allows for better profile matching in the calling code
anyway.  It also cleans up the appearance of your prototype.

Thanks! - Bruce


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


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

* Re: Unnecessary warnings
  2006-09-25 14:43   ` Bruce Korb
@ 2006-09-25 14:53     ` Ludovic Courtès
  2006-09-25 14:59       ` Bruce Korb
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2006-09-25 14:53 UTC (permalink / raw)
  Cc: Harlan Stenn, guile-devel

Hi,

"Bruce Korb" <bkorb@gnu.org> writes:

> GCC on Solaris.  I agree that it is just a documentation name and serves
> no other purpose, but there it is.  I do like -Wshadow, but it is not so useful
> if cluttered up with these spurious messages.

So _all_ these messages were with `-Wshadow'?  Then, it is less serious
than what I initially thought.  Still, I agree that we should fix it.

> As for the "function is not
> a prototype" messages, having a typedef for the particular procedure profile
> being passed around allows for better profile matching in the calling code
> anyway.  It also cleans up the appearance of your prototype.

Agreed.

Thanks,
Ludovic.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


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

* Re: Unnecessary warnings
  2006-09-25 14:53     ` Ludovic Courtès
@ 2006-09-25 14:59       ` Bruce Korb
  0 siblings, 0 replies; 6+ messages in thread
From: Bruce Korb @ 2006-09-25 14:59 UTC (permalink / raw)


Hi Ludovic,

On 9/25/06, Ludovic Courtès <ludovic.courtes@laas.fr> wrote:
> > GCC on Solaris.  I agree that it is just a documentation name and serves
> > no other purpose, but there it is.  I do like -Wshadow, but it is not so useful
> > if cluttered up with these spurious messages.
>
> So _all_ these messages were with `-Wshadow'?

Sorry I wasn't clear about that.  You only get shadowing warnings when
you turn that on.

> Thanks,

Thank _you_!  :)  Cheers - Bruce


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


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

* Re: Unnecessary warnings
  2006-09-24 15:42 Unnecessary warnings Bruce Korb
  2006-09-25  8:19 ` Ludovic Courtès
@ 2006-09-25 22:33 ` Kevin Ryde
  1 sibling, 0 replies; 6+ messages in thread
From: Kevin Ryde @ 2006-09-25 22:33 UTC (permalink / raw)
  Cc: Harlan Stenn, guile-devel

Bruce Korb <bkorb@gnu.org> writes:
>
> These are all due to argument names in prototype declarations.
> Please suffix the names with "_arg" or something.

Or better just drop the names, which avoids any possibility of
clashing with application macros too.

> extern SCM scm_c_make_gsubr (const char *name,
> int req, int opt, int rst, SCM (*fcn) ());
>
> where "fcn" does not look like a prototype.  It needs "(void)" as the
> argument list.

void is not really true, it can be any number of arguments of course.
Dunno if that makes a difference in practice, with enough casts (of
which there's a few already).


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


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

end of thread, other threads:[~2006-09-25 22:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-24 15:42 Unnecessary warnings Bruce Korb
2006-09-25  8:19 ` Ludovic Courtès
2006-09-25 14:43   ` Bruce Korb
2006-09-25 14:53     ` Ludovic Courtès
2006-09-25 14:59       ` Bruce Korb
2006-09-25 22:33 ` Kevin Ryde

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).