public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [Patch] Fix build warnings for GAS on mips-linux-gnu
@ 2012-06-12 18:40 Iain Sandoe
  2012-06-18  4:22 ` Alan Modra
  0 siblings, 1 reply; 9+ messages in thread
From: Iain Sandoe @ 2012-06-12 18:40 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 1246 bytes --]

Hi,

The recent change introducing the itbl-lex-wrapper, produces the following build warnings for a cross from x86-linux-gnu -> mips-linux-gnu:

in file included from ../../src/binutils-mainline/gas/itbl-lex-wrapper.c:4:
../../src/binutils-mainline/gas/../bfd/sysdep.h:123: warning: function declaration isn't a prototype
../../src/binutils-mainline/gas/../bfd/sysdep.h:127: warning: function declaration isn't a prototype
../../src/binutils-mainline/gas/../bfd/sysdep.h:131: warning: function declaration isn't a prototype
../../src/binutils-mainline/gas/../bfd/sysdep.h:135: warning: function declaration isn't a prototype
../../src/binutils-mainline/gas/../bfd/sysdep.h:143: warning: function declaration isn't a prototype
In file included from ../../src/binutils-mainline/gas/as.h:187,

This is because the newly included bfd/sysdep.h tests several HAVE_DECL_xxx which are not provided by the configury in GAS.

The attached patch resolves that.

OK for trunk?
Iain

P.S.   As an aside, is it intentional that the fall-back specifications are not proper prototypes? 

===

gas/
	* configure.in:  Check DECLS for free, getenv, malloc, realloc,
	stpcpy and strstr.
	* configure: Regenerate.
	* config.in: Likewise.

[-- Attachment #2: gas-config-func-checks.txt --]
[-- Type: text/plain, Size: 601 bytes --]

Index: gas/configure.in
===================================================================
RCS file: /cvs/src/src/gas/configure.in,v
retrieving revision 1.230
diff -u -p -r1.230 configure.in
--- gas/configure.in	17 May 2012 15:13:16 -0000	1.230
+++ gas/configure.in	12 Jun 2012 07:35:42 -0000
@@ -667,6 +667,13 @@ AC_CHECK_FUNCS(unlink remove, break)
 # Some systems don't have sbrk().
 AC_CHECK_FUNCS(sbrk)
 
+AC_CHECK_DECLS(free)
+AC_CHECK_DECLS(getenv)
+AC_CHECK_DECLS(malloc)
+AC_CHECK_DECLS(realloc)
+AC_CHECK_DECLS(stpcpy)
+AC_CHECK_DECLS(strstr)
+
 AC_CHECK_FUNCS(setlocale)
 AM_LC_MESSAGES
 

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

* Re: [Patch] Fix build warnings for GAS on mips-linux-gnu
  2012-06-12 18:40 [Patch] Fix build warnings for GAS on mips-linux-gnu Iain Sandoe
@ 2012-06-18  4:22 ` Alan Modra
  2012-06-18  4:42   ` Alan Modra
  2012-07-09 18:34   ` Maciej W. Rozycki
  0 siblings, 2 replies; 9+ messages in thread
From: Alan Modra @ 2012-06-18  4:22 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: binutils

On Tue, Jun 12, 2012 at 07:39:58PM +0100, Iain Sandoe wrote:
> P.S.   As an aside, is it intentional that the fall-back specifications are not proper prototypes? 

Yes.  It saves trouble with "const char *" vs. "char *", "unsigned
long" vs. "unsigned int" and the like differences when we provide a
declaration that doesn't match some system header declaration.

> 	* configure.in:  Check DECLS for free, getenv, malloc, realloc,
> 	stpcpy and strstr.
> 	* configure: Regenerate.
> 	* config.in: Likewise.

I'm applying this one instead as it saves a few lines in the generated
configure.

Index: gas/configure.in
===================================================================
RCS file: /cvs/src/src/gas/configure.in,v
retrieving revision 1.230
diff -u -p -r1.230 configure.in
--- gas/configure.in	17 May 2012 15:13:16 -0000	1.230
+++ gas/configure.in	18 Jun 2012 03:27:08 -0000
@@ -663,11 +663,8 @@ AC_C_INLINE
 
 # VMS doesn't have unlink.
 AC_CHECK_FUNCS(unlink remove, break)
+AC_CHECK_FUNCS(free getenv malloc realloc sbrk setlocale stpcpy strstr)
 
-# Some systems don't have sbrk().
-AC_CHECK_FUNCS(sbrk)
-
-AC_CHECK_FUNCS(setlocale)
 AM_LC_MESSAGES
 
 # do we need the math library?

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: [Patch] Fix build warnings for GAS on mips-linux-gnu
  2012-06-18  4:22 ` Alan Modra
@ 2012-06-18  4:42   ` Alan Modra
  2012-07-09 18:34   ` Maciej W. Rozycki
  1 sibling, 0 replies; 9+ messages in thread
From: Alan Modra @ 2012-06-18  4:42 UTC (permalink / raw)
  To: Iain Sandoe, binutils

On Mon, Jun 18, 2012 at 01:52:18PM +0930, Alan Modra wrote:
> On Tue, Jun 12, 2012 at 07:39:58PM +0100, Iain Sandoe wrote:
> > P.S.   As an aside, is it intentional that the fall-back specifications are not proper prototypes? 
> 
> Yes.  It saves trouble with "const char *" vs. "char *", "unsigned
> long" vs. "unsigned int" and the like differences when we provide a
> declaration that doesn't match some system header declaration.
> 
> > 	* configure.in:  Check DECLS for free, getenv, malloc, realloc,
> > 	stpcpy and strstr.
> > 	* configure: Regenerate.
> > 	* config.in: Likewise.
> 
> I'm applying this one instead as it saves a few lines in the generated
> configure.

Having thus demonstrated conclusively that I'm a complete idiot..
Fix the breakage with the following.

Index: gas/configure.in
===================================================================
RCS file: /cvs/src/src/gas/configure.in,v
retrieving revision 1.231
diff -u -p -r1.231 configure.in
--- gas/configure.in	18 Jun 2012 04:23:11 -0000	1.231
+++ gas/configure.in	18 Jun 2012 04:36:16 -0000
@@ -663,7 +663,7 @@ AC_C_INLINE
 
 # VMS doesn't have unlink.
 AC_CHECK_FUNCS(unlink remove, break)
-AC_CHECK_FUNCS(free getenv malloc realloc sbrk setlocale stpcpy strstr)
+AC_CHECK_FUNCS(sbrk setlocale)
 
 AM_LC_MESSAGES
 
@@ -727,8 +727,7 @@ GAS_CHECK_DECL_NEEDED(malloc, f, char *(
 GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers)
 GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers)
 
-AC_CHECK_DECLS([mempcpy])
-AC_CHECK_DECLS([vsnprintf])
+AC_CHECK_DECLS([free, getenv, malloc, mempcpy, realloc, stpcpy, strstr, vsnprintf])
 
 BFD_BINARY_FOPEN
 


-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: [Patch] Fix build warnings for GAS on mips-linux-gnu
  2012-06-18  4:22 ` Alan Modra
  2012-06-18  4:42   ` Alan Modra
@ 2012-07-09 18:34   ` Maciej W. Rozycki
  2012-07-10  6:25     ` Alan Modra
  1 sibling, 1 reply; 9+ messages in thread
From: Maciej W. Rozycki @ 2012-07-09 18:34 UTC (permalink / raw)
  To: Alan Modra; +Cc: Iain Sandoe, binutils

On Mon, 18 Jun 2012, Alan Modra wrote:

> > P.S.   As an aside, is it intentional that the fall-back specifications are not proper prototypes? 
> 
> Yes.  It saves trouble with "const char *" vs. "char *", "unsigned
> long" vs. "unsigned int" and the like differences when we provide a
> declaration that doesn't match some system header declaration.

 Hmm, two issues here:

1. Does it really matter given that the actual purpose of these fallback 
   declarations is to address the case where there are no respective 
   system-header declarations or prototypes in the first place (assuming 
   of course that e.g. sizeof (unsigned long) equals sizeof (unsigned 
   int) where applicable)?

2. How does it play with -Werror that we use? -- these "function
   declaration isn't a prototype" warnings will be turned into errors 
   defeating the purpose of these fallback declarations.

  Maciej

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

* Re: [Patch] Fix build warnings for GAS on mips-linux-gnu
  2012-07-09 18:34   ` Maciej W. Rozycki
@ 2012-07-10  6:25     ` Alan Modra
  2012-07-10 17:33       ` Maciej W. Rozycki
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Modra @ 2012-07-10  6:25 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: Iain Sandoe, binutils

On Mon, Jul 09, 2012 at 07:33:47PM +0100, Maciej W. Rozycki wrote:
> On Mon, 18 Jun 2012, Alan Modra wrote:
> 
> > > P.S.   As an aside, is it intentional that the fall-back specifications are not proper prototypes? 
> > 
> > Yes.  It saves trouble with "const char *" vs. "char *", "unsigned
> > long" vs. "unsigned int" and the like differences when we provide a
> > declaration that doesn't match some system header declaration.
> 
>  Hmm, two issues here:
> 
> 1. Does it really matter given that the actual purpose of these fallback 
>    declarations is to address the case where there are no respective 
>    system-header declarations or prototypes in the first place (assuming 
>    of course that e.g. sizeof (unsigned long) equals sizeof (unsigned 
>    int) where applicable)?

I think the failure mode was in cases where the HAVE_* macros were not
defined for some reason even though the system headers have a
declaration.

> 2. How does it play with -Werror that we use? -- these "function
>    declaration isn't a prototype" warnings will be turned into errors 
>    defeating the purpose of these fallback declarations.

Yes, --disable-werror will need to be used.

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: [Patch] Fix build warnings for GAS on mips-linux-gnu
  2012-07-10  6:25     ` Alan Modra
@ 2012-07-10 17:33       ` Maciej W. Rozycki
  2012-07-11  1:42         ` Alan Modra
  0 siblings, 1 reply; 9+ messages in thread
From: Maciej W. Rozycki @ 2012-07-10 17:33 UTC (permalink / raw)
  To: Alan Modra; +Cc: Iain Sandoe, binutils

On Tue, 10 Jul 2012, Alan Modra wrote:

> > > > P.S.   As an aside, is it intentional that the fall-back specifications are not proper prototypes? 
> > > 
> > > Yes.  It saves trouble with "const char *" vs. "char *", "unsigned
> > > long" vs. "unsigned int" and the like differences when we provide a
> > > declaration that doesn't match some system header declaration.
> > 
> >  Hmm, two issues here:
> > 
> > 1. Does it really matter given that the actual purpose of these fallback 
> >    declarations is to address the case where there are no respective 
> >    system-header declarations or prototypes in the first place (assuming 
> >    of course that e.g. sizeof (unsigned long) equals sizeof (unsigned 
> >    int) where applicable)?
> 
> I think the failure mode was in cases where the HAVE_* macros were not
> defined for some reason even though the system headers have a
> declaration.

 But that would be a bug in our configury then (such as one observed by 
Iain), and there is no guarantee that the implicit types are going to be 
compatible with ones actually used by the system in question.  So unless 
I'm missing something I think that papering over this problem so that code 
builds at all (presumably in the interest of the unfortunate user to hit 
it) is questionable.

> > 2. How does it play with -Werror that we use? -- these "function
> >    declaration isn't a prototype" warnings will be turned into errors 
> >    defeating the purpose of these fallback declarations.
> 
> Yes, --disable-werror will need to be used.

 Fair enough here.

  Maciej

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

* Re: [Patch] Fix build warnings for GAS on mips-linux-gnu
  2012-07-10 17:33       ` Maciej W. Rozycki
@ 2012-07-11  1:42         ` Alan Modra
  2012-07-11  2:07           ` Alan Modra
  2012-07-11 23:33           ` Maciej W. Rozycki
  0 siblings, 2 replies; 9+ messages in thread
From: Alan Modra @ 2012-07-11  1:42 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: Iain Sandoe, binutils

On Tue, Jul 10, 2012 at 06:32:37PM +0100, Maciej W. Rozycki wrote:
> On Tue, 10 Jul 2012, Alan Modra wrote:
> 
> > > > > P.S.   As an aside, is it intentional that the fall-back specifications are not proper prototypes? 
> > > > 
> > > > Yes.  It saves trouble with "const char *" vs. "char *", "unsigned
> > > > long" vs. "unsigned int" and the like differences when we provide a
> > > > declaration that doesn't match some system header declaration.
> > > 
> > >  Hmm, two issues here:
> > > 
> > > 1. Does it really matter given that the actual purpose of these fallback 
> > >    declarations is to address the case where there are no respective 
> > >    system-header declarations or prototypes in the first place (assuming 
> > >    of course that e.g. sizeof (unsigned long) equals sizeof (unsigned 
> > >    int) where applicable)?
> > 
> > I think the failure mode was in cases where the HAVE_* macros were not
> > defined for some reason even though the system headers have a
> > declaration.
> 
>  But that would be a bug in our configury then (such as one observed by 
> Iain), and there is no guarantee that the implicit types are going to be 
> compatible with ones actually used by the system in question.

Yes, it does seem a bit odd.  I'm beginning to wish I hadn't tried to
answer your question about fall-back declarations..  Maybe Nick or Ian
can shed more light on this?

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: [Patch] Fix build warnings for GAS on mips-linux-gnu
  2012-07-11  1:42         ` Alan Modra
@ 2012-07-11  2:07           ` Alan Modra
  2012-07-11 23:33           ` Maciej W. Rozycki
  1 sibling, 0 replies; 9+ messages in thread
From: Alan Modra @ 2012-07-11  2:07 UTC (permalink / raw)
  To: Maciej W. Rozycki, Iain Sandoe, binutils

Come to think of it, the likely reason is that this code was for K&R
compilers.  Now that we require an ISO C compiler, we should prototype
these declarations properly.  Please go ahead and do so, if you're
willing to handle any fallout.

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: [Patch] Fix build warnings for GAS on mips-linux-gnu
  2012-07-11  1:42         ` Alan Modra
  2012-07-11  2:07           ` Alan Modra
@ 2012-07-11 23:33           ` Maciej W. Rozycki
  1 sibling, 0 replies; 9+ messages in thread
From: Maciej W. Rozycki @ 2012-07-11 23:33 UTC (permalink / raw)
  To: Alan Modra; +Cc: Iain Sandoe, binutils

On Wed, 11 Jul 2012, Alan Modra wrote:

> >  But that would be a bug in our configury then (such as one observed by 
> > Iain), and there is no guarantee that the implicit types are going to be 
> > compatible with ones actually used by the system in question.
> 
> Yes, it does seem a bit odd.  I'm beginning to wish I hadn't tried to
> answer your question about fall-back declarations..  Maybe Nick or Ian
> can shed more light on this?

 No worries, I'm harmless. :)

> Come to think of it, the likely reason is that this code was for K&R
> compilers.  Now that we require an ISO C compiler, we should prototype
> these declarations properly.  Please go ahead and do so, if you're
> willing to handle any fallout.

 Thanks, that explanation sounds plausible to me.  I'll see what I can do 
with the next batch of binutils submissions -- hopefully soon -- unless 
Iain beats me to it that is!

  Maciej

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

end of thread, other threads:[~2012-07-11 23:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-12 18:40 [Patch] Fix build warnings for GAS on mips-linux-gnu Iain Sandoe
2012-06-18  4:22 ` Alan Modra
2012-06-18  4:42   ` Alan Modra
2012-07-09 18:34   ` Maciej W. Rozycki
2012-07-10  6:25     ` Alan Modra
2012-07-10 17:33       ` Maciej W. Rozycki
2012-07-11  1:42         ` Alan Modra
2012-07-11  2:07           ` Alan Modra
2012-07-11 23:33           ` Maciej W. Rozycki

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