diff mbox

[bootstrap] Tentative fix for PR 54281

Message ID 502E5C11.1090403@google.com
State New
Headers show

Commit Message

Diego Novillo Aug. 17, 2012, 2:58 p.m. UTC
On 12-08-17 08:32 , Jakub Jelinek wrote:
> Hi!
>
> On Fri, Aug 17, 2012 at 08:23:02AM -0400, Diego Novillo wrote:
>
>> --- a/gcc/intl.h
>> +++ b/gcc/intl.h
>> @@ -27,8 +27,16 @@
>>   # define setlocale(category, locale) (locale)
>>   #endif
>>
>> +/* If libintl.h is available, include it before testing for NLS. If we
>> +   are building with --disable-nls and another header file includes
>> +   libintl.h, the stubs defined down below will cause syntax errors
>> +   when parsing libintl.h. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54281
>> +   for details.  */
>> +#ifdef HAVE_LIBINTL_H
>> +# include <libintl.h>
>> +#endif
>> +
>>   #ifdef ENABLE_NLS
>> -#include <libintl.h>
>>   extern void gcc_init_libintl (void);
>>   extern size_t gcc_gettext_width (const char *);
>>   #else
>
> Will that handle even the case where without --disable-nls intl/
> creates its own libintl.h?  Dunno which targets need that, but
> I'd guess configury wouldn't find it in that case.  So perhaps
> it should be #if defined(HAVE_LIBINTL_H) || defined(ENABLE_NLS) ?

Sounds reasonable.  Amended patch attached.

Re-tested with --disable-nls.


OK for trunk?

Comments

Jakub Jelinek Aug. 17, 2012, 3:05 p.m. UTC | #1
On Fri, Aug 17, 2012 at 10:58:25AM -0400, Diego Novillo wrote:
> Sounds reasonable.  Amended patch attached.

> OK for trunk?

Yes, except for:

> diff --git a/gcc/ChangeLog b/gcc/ChangeLog
> index c9a81d1..43b0af7 100644
> --- a/gcc/ChangeLog
> +++ b/gcc/ChangeLog
> @@ -213,7 +222,7 @@
>  	* config/tilegx/feedback.h: New file.
>  	* config/tilepro/feedback.h: New file.
>  
> -2012-08-16  Diego Novillo  <dnovillo@google.com>
> +2012-08-16   Diego Novillo  <dnovillo@google.com>
>  
>  	Revert
>  

the above hunk.

	Jakub
Diego Novillo Aug. 17, 2012, 3:39 p.m. UTC | #2
On Fri, Aug 17, 2012 at 11:05 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Fri, Aug 17, 2012 at 10:58:25AM -0400, Diego Novillo wrote:
>> Sounds reasonable.  Amended patch attached.
>
>> OK for trunk?
>
> Yes, except for:
>
>> diff --git a/gcc/ChangeLog b/gcc/ChangeLog
>> index c9a81d1..43b0af7 100644
>> --- a/gcc/ChangeLog
>> +++ b/gcc/ChangeLog
>> @@ -213,7 +222,7 @@
>>       * config/tilegx/feedback.h: New file.
>>       * config/tilepro/feedback.h: New file.
>>
>> -2012-08-16  Diego Novillo  <dnovillo@google.com>
>> +2012-08-16   Diego Novillo  <dnovillo@google.com>
>>
>>       Revert
>>
>
> the above hunk.

Done.  Committed.


Thanks.  Diego.
diff mbox

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c9a81d1..43b0af7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@ 
+2012-08-17  Diego Novillo  <dnovillo@google.com>
+
+	PR bootstrap/54281
+	* configure.ac: Add libintl.h to AC_CHECK_HEADERS list.
+	* config.in: Regenerate.
+	* configure: Regenerate.
+	* intl.h: Always include libintl.h if HAVE_LIBINTL_H is
+	set.
+
 2012-08-17  Richard Guenther  <rguenther@suse.de>
 
 	* bitmap.h (struct bitmap_element_def): GTY annotate next/prev.
@@ -213,7 +222,7 @@ 
 	* config/tilegx/feedback.h: New file.
 	* config/tilepro/feedback.h: New file.
 
-2012-08-16  Diego Novillo  <dnovillo@google.com>
+2012-08-16   Diego Novillo  <dnovillo@google.com>
 
 	Revert
 
diff --git a/gcc/config.in b/gcc/config.in
index 6d986be..a9417df 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -1260,6 +1260,12 @@ 
 #endif
 
 
+/* Define to 1 if you have the <libintl.h> header file. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_LIBINTL_H
+#endif
+
+
 /* Define to 1 if you have the <limits.h> header file. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_LIMITS_H
diff --git a/gcc/configure b/gcc/configure
index 1585bae..7f3489d 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -8248,7 +8248,7 @@  fi
 for ac_header in limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \
 		 fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \
 		 sys/resource.h sys/param.h sys/times.h sys/stat.h \
-		 direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h
+		 direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h libintl.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_preproc "$LINENO" "$ac_header" "$as_ac_Header"
@@ -17742,7 +17742,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17744 "configure"
+#line 17745 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17848,7 +17848,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17850 "configure"
+#line 17851 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 579d9a8..6bfbf35 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -912,7 +912,7 @@  AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \
 		 fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \
 		 sys/resource.h sys/param.h sys/times.h sys/stat.h \
-		 direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h)
+		 direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h libintl.h)
 
 # Check for thread headers.
 AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
diff --git a/gcc/intl.h b/gcc/intl.h
index c4db354..03be420 100644
--- a/gcc/intl.h
+++ b/gcc/intl.h
@@ -27,8 +27,16 @@ 
 # define setlocale(category, locale) (locale)
 #endif
 
+/* If libintl.h is available, include it before testing for NLS. If we
+   are building with --disable-nls and another header file includes
+   libintl.h, the stubs defined down below will cause syntax errors
+   when parsing libintl.h. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54281
+   for details.  */
+#if defined(HAVE_LIBINTL_H) || defined(ENABLE_NLS)
+# include <libintl.h>
+#endif
+
 #ifdef ENABLE_NLS
-#include <libintl.h>
 extern void gcc_init_libintl (void);
 extern size_t gcc_gettext_width (const char *);
 #else