Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] Compile fix for 64-bit HPUX
@ 2006-03-26 10:16 Randolph Chung
  2006-03-28 22:27 ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Randolph Chung @ 2006-03-26 10:16 UTC (permalink / raw)
  To: gdb-patches

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

On 64-bit HPUX, gdb fails to compile with -Werror because of an 
incorrect iconv() prototype. gdb's configure script checks for this, but 
because the configure script test is compiled without -Werror even when 
-Werror is enabled, the test doesn't detect the condition properly. The 
attached patch forces this test to use the value of WERROR_CFLAGS so 
that the check uses the same flags that will be used to build gdb.

tbh I think this is really a hack and we should somehow make all the 
autoconf test use the -Werror flag when running the compile tests, but 
it's not obvious to me how I can do this without redoing a lot of the 
Makefile logic (for example, why do we use a separate WERROR_CFLAGS and 
not just append the -Werror into CFLAGS?)...

Anyway, is this ok? Tested on hppa64-hp-hpux11.11; may also help other 
archs that need ICONV_CONST to be defined.

randolph

[-- Attachment #2: hp64comp.diff --]
[-- Type: text/x-patch, Size: 1096 bytes --]

2006-03-26  Randolph Chung  <tausq@debian.org>

	* acinclude.m4 (ICONV_CONST): Compile test with -Werror if enabled.

Index: acinclude.m4
===================================================================
RCS file: /cvs/src/src/gdb/acinclude.m4,v
retrieving revision 1.13
diff -u -p -r1.13 acinclude.m4
--- acinclude.m4	17 Dec 2005 22:33:59 -0000	1.13
+++ acinclude.m4	26 Mar 2006 08:07:55 -0000
@@ -892,6 +892,8 @@ AC_DEFUN([AM_ICONV],
   if test "$am_cv_func_iconv" = yes; then
     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
     AC_MSG_CHECKING([for iconv declaration])
+    oldcflags="${CFLAGS-}"
+    CFLAGS="${CFLAGS-} $WERROR_CFLAGS"
     AC_CACHE_VAL(am_cv_proto_iconv, [
       AC_TRY_COMPILE([
 #include <stdlib.h>
@@ -910,6 +912,7 @@ size_t iconv();
     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
     AC_MSG_RESULT([$]{ac_t:-
          }[$]am_cv_proto_iconv)
+    CFLAGS=$oldcflags
     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
       [Define as const if the declaration of iconv() needs const.])
   fi

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

* Re: [patch] Compile fix for 64-bit HPUX
  2006-03-26 10:16 [patch] Compile fix for 64-bit HPUX Randolph Chung
@ 2006-03-28 22:27 ` Daniel Jacobowitz
  2006-03-29  0:18   ` Andreas Schwab
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2006-03-28 22:27 UTC (permalink / raw)
  To: Randolph Chung; +Cc: gdb-patches

On Sun, Mar 26, 2006 at 04:15:25PM +0800, Randolph Chung wrote:
> On 64-bit HPUX, gdb fails to compile with -Werror because of an 
> incorrect iconv() prototype. gdb's configure script checks for this, but 
> because the configure script test is compiled without -Werror even when 
> -Werror is enabled, the test doesn't detect the condition properly. The 
> attached patch forces this test to use the value of WERROR_CFLAGS so 
> that the check uses the same flags that will be used to build gdb.
> 
> tbh I think this is really a hack and we should somehow make all the 
> autoconf test use the -Werror flag when running the compile tests, but 
> it's not obvious to me how I can do this without redoing a lot of the 
> Makefile logic (for example, why do we use a separate WERROR_CFLAGS and 
> not just append the -Werror into CFLAGS?)...

So that we can turn off -Werror without turning off warnings, I
presume.  I thought I'd touched this code recently but I don't see
where...

Don't most autoconf checks fail if they produce a warning, anyway?
Oh, that's got a separate knob: AC_LANG_WERROR.  Maybe that would help
you.  And AC_PROG_CPP_WERROR.  I don't know why no one uses
AC_LANG_WERROR in src yet; maybe there's a good reason.

> +    oldcflags="${CFLAGS-}"

What's ${foo-}?  I don't see it in my bash or dash docs.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: [patch] Compile fix for 64-bit HPUX
  2006-03-28 22:27 ` Daniel Jacobowitz
@ 2006-03-29  0:18   ` Andreas Schwab
  2006-03-30  0:05     ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2006-03-29  0:18 UTC (permalink / raw)
  To: Randolph Chung; +Cc: gdb-patches

Daniel Jacobowitz <drow@false.org> writes:

>> +    oldcflags="${CFLAGS-}"
>
> What's ${foo-}?  I don't see it in my bash or dash docs.

In (bash)Shell Parameter Expansion, the paragraph before the table:

       When not performing substring expansion, Bash tests for a parameter
    that is unset or null; omitting the colon results in a test only for a
                           ^^^^^^^^^^^^^^^^^^
    parameter that is unset.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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

* Re: [patch] Compile fix for 64-bit HPUX
  2006-03-29  0:18   ` Andreas Schwab
@ 2006-03-30  0:05     ` Daniel Jacobowitz
  2006-03-30 13:05       ` Andreas Schwab
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2006-03-30  0:05 UTC (permalink / raw)
  To: gdb-patches

On Wed, Mar 29, 2006 at 01:13:15AM +0200, Andreas Schwab wrote:
> Daniel Jacobowitz <drow@false.org> writes:
> 
> >> +    oldcflags="${CFLAGS-}"
> >
> > What's ${foo-}?  I don't see it in my bash or dash docs.
> 
> In (bash)Shell Parameter Expansion, the paragraph before the table:
> 
>        When not performing substring expansion, Bash tests for a parameter
>     that is unset or null; omitting the colon results in a test only for a
>                            ^^^^^^^^^^^^^^^^^^
>     parameter that is unset.

Thanks.  I see this in the dash documentation too, and pdksh, so it is
presumably portable.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: [patch] Compile fix for 64-bit HPUX
  2006-03-30  0:05     ` Daniel Jacobowitz
@ 2006-03-30 13:05       ` Andreas Schwab
  2006-03-30 13:37         ` Randolph Chung
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2006-03-30 13:05 UTC (permalink / raw)
  To: gdb-patches

Daniel Jacobowitz <drow@false.org> writes:

> On Wed, Mar 29, 2006 at 01:13:15AM +0200, Andreas Schwab wrote:
>> Daniel Jacobowitz <drow@false.org> writes:
>> 
>> >> +    oldcflags="${CFLAGS-}"
>> >
>> > What's ${foo-}?  I don't see it in my bash or dash docs.
>> 
>> In (bash)Shell Parameter Expansion, the paragraph before the table:
>> 
>>        When not performing substring expansion, Bash tests for a parameter
>>     that is unset or null; omitting the colon results in a test only for a
>>                            ^^^^^^^^^^^^^^^^^^
>>     parameter that is unset.
>
> Thanks.  I see this in the dash documentation too, and pdksh, so it is
> presumably portable.

The autoconf manual says:

`${VAR:-VALUE}'
     Old BSD shells, including the Ultrix `sh', don't accept the colon
     for any shell substitution, and complain and die.

Thus in fact, omitting the colon is more portable.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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

* Re: [patch] Compile fix for 64-bit HPUX
  2006-03-30 13:05       ` Andreas Schwab
@ 2006-03-30 13:37         ` Randolph Chung
  0 siblings, 0 replies; 6+ messages in thread
From: Randolph Chung @ 2006-03-30 13:37 UTC (permalink / raw)
  To: gdb-patches

> The autoconf manual says:
> 
> `${VAR:-VALUE}'
>      Old BSD shells, including the Ultrix `sh', don't accept the colon
>      for any shell substitution, and complain and die.
> 
> Thus in fact, omitting the colon is more portable.

Thanks for all the good in depth explanation; I have to confess that I
just copied that construct from another part of the autoconf script :-P

randolph


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

end of thread, other threads:[~2006-03-30  9:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-26 10:16 [patch] Compile fix for 64-bit HPUX Randolph Chung
2006-03-28 22:27 ` Daniel Jacobowitz
2006-03-29  0:18   ` Andreas Schwab
2006-03-30  0:05     ` Daniel Jacobowitz
2006-03-30 13:05       ` Andreas Schwab
2006-03-30 13:37         ` Randolph Chung

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