public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Fix for compile time warning in binutils/nlmconv.c
@ 2005-02-15 18:17 Nick Clifton
  2005-02-15 18:33 ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2005-02-15 18:17 UTC (permalink / raw)
  To: binutils

Hi Guys,

  I am going to apply the patch below to fix a compile time warning
  when building nlmconv.c, although I am not sure if this is the
  proper way to fix the problem.  The reason is that I am not sure why
  the parameterless prototype for localtime() is included at all.
  Presumably there are build environments out there where this
  function is not prototyped, or the header containing the prototype
  is not pulled in.  To me this sounds like a configure problem, but
  for now I am keeping things simple.

Cheers
  Nick

binutils/ChangeLog
2005-02-15  Nick Clifton  <nickc@redhat.com>

	* nlmconv.c: Provide a full prototype for the localtime() function
	in order to avoid a compile time warning.  

Index: binutils/nlmconv.c
===================================================================
RCS file: /cvs/src/src/binutils/nlmconv.c,v
retrieving revision 1.21
diff -c -3 -p -r1.21 nlmconv.c
*** binutils/nlmconv.c	4 Jan 2005 15:51:47 -0000	1.21
--- binutils/nlmconv.c	15 Feb 2005 14:20:18 -0000
***************
*** 59,65 ****
  extern char *strerror (int);
  
  #ifndef localtime
! extern struct tm *localtime ();
  #endif
  
  #ifndef SEEK_SET
--- 59,65 ----
  extern char *strerror (int);
  
  #ifndef localtime
! extern struct tm *localtime (const time_t *);
  #endif
  
  #ifndef SEEK_SET

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

* Re: Fix for compile time warning in binutils/nlmconv.c
  2005-02-15 18:17 Fix for compile time warning in binutils/nlmconv.c Nick Clifton
@ 2005-02-15 18:33 ` Ian Lance Taylor
  2005-02-16 19:22   ` Nick Clifton
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2005-02-15 18:33 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

Nick Clifton <nickc@redhat.com> writes:

>   I am going to apply the patch below to fix a compile time warning
>   when building nlmconv.c, although I am not sure if this is the
>   proper way to fix the problem.  The reason is that I am not sure why
>   the parameterless prototype for localtime() is included at all.
>   Presumably there are build environments out there where this
>   function is not prototyped, or the header containing the prototype
>   is not pulled in.  To me this sounds like a configure problem, but
>   for now I am keeping things simple.

The declaration is there because some systems did not declare
localtime, but an implicit declaration is undesirable because the
function does not return int.  I agree that this is something which
can be fixed using an autoconf test.

However, your patch is not a good idea.  There are undoubtedly systems
out there which declare localtime with different parameter types--in
particular omitting the const--so your patch will change those
systems from a warning to an error.

Better to remove the declaration entirely.  Modern systems don't need
the declaration, and older systems will most likely be OK with the
warning.

Ian

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

* Re: Fix for compile time warning in binutils/nlmconv.c
  2005-02-15 18:33 ` Ian Lance Taylor
@ 2005-02-16 19:22   ` Nick Clifton
  0 siblings, 0 replies; 3+ messages in thread
From: Nick Clifton @ 2005-02-16 19:22 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: binutils

Hi Ian,

> However, your patch is not a good idea.  There are undoubtedly systems
> out there which declare localtime with different parameter types--in
> particular omitting the const--so your patch will change those
> systems from a warning to an error.
> 
> Better to remove the declaration entirely.  Modern systems don't need
> the declaration, and older systems will most likely be OK with the
> warning.

Thanks for the explanation - I agree that removing the prototype is the 
simplest solution for now, so I have checked in the obvious patch to do 
this.

Cheers
   Nick

binutils/ChangeLog
2005-02-16  Nick Clifton  <nickc@redhat.com>

	* nlmconv.c: Remove prototype for localetime altogether.  It
	should not be needed on modern systems and older systems can live
	with the warning.

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

end of thread, other threads:[~2005-02-16 12:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-15 18:17 Fix for compile time warning in binutils/nlmconv.c Nick Clifton
2005-02-15 18:33 ` Ian Lance Taylor
2005-02-16 19:22   ` Nick Clifton

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