This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: Cast in c-pretty-print.c causes warning
2009/9/3 Richard Guenther <richard.guenther@gmail.com>:
> On Thu, Sep 3, 2009 at 3:30 PM, Kai Tietz<ktietz70@googlemail.com> wrote:
>> 2009/9/3 Richard Guenther <richard.guenther@gmail.com>:
>>> On Thu, Sep 3, 2009 at 12:17 AM, Richard Henderson<rth@redhat.com> wrote:
>>>> On 09/02/2009 02:21 PM, Kai Tietz wrote:
>>>>>
>>>>> Ok, I can file a patch to add gstdint.h to system.h, or is it better
>>>>> to use here just a config.h check for existing stdint.h and otherwise
>>>>> fall back to long type for intptr_t?
>>>>
>>>> It's best to have a configure check.
>>>> See the standard autoconf macro AC_TYPE_UINTPTR_T.
>>>
>>> The LTO branch also makes use of uintptr_t and adds
>>>
>>> AC_CHECK_TYPE(intptr_t, long)
>>>
>>> which is obviously wrong for LLP64 hosts ;) ?But see config/stdint.m4
>>> and config/stdint_h.m4.
>>>
>>> Richard.
>>
>> So here is the revised patch using gstdint.h. Seems to work nice AFAIT.
>
> The check fro stdint.h is redundant I believe, thus
>
> ?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 stdint.h langinfo.h ldfcn.h \
> + ? ? ? ? ? ? ? ?locale.h wchar.h)
>
> can be omitted.
>
> The rest of the patch looks fine though I cannot approve it.
>
> Thanks,
> Richard.
Thanks for point to this. Indeed it is not necessary to add stdint.h
check in AC_HEADERS.
Here the adjusted patch
2009-09-03 Kai Tietz <kai.tietz@onevision.com>
* config.in (HAVE_STDINT_H): New.
* configure.ac (GCC_HEADER_STDINT): Generated gstdint.h.
* configure: Regenerated.
* system.h (gstdint.h): Add include.
* Makefile.in (aclocal): Add config/stdint.m4.
* aclocal.m4: Regenerated.
Ok for apply to trunk?
Cheers,
Kai
--
| (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination
Index: gcc/gcc/config.in
===================================================================
--- gcc.orig/gcc/config.in 2009-08-24 08:11:35.000000000 +0200
+++ gcc/gcc/config.in 2009-09-03 14:52:19.123369700 +0200
@@ -1144,6 +1144,9 @@
#undef HAVE_MALLOC_H
#endif
+#ifndef USED_FOR_TARGET
+#undef HAVE_STDINT_H
+#endif
/* Define to 1 if you have the `mbstowcs' function. */
#ifndef USED_FOR_TARGET
Index: gcc/gcc/configure.ac
===================================================================
--- gcc.orig/gcc/configure.ac 2009-08-28 21:28:51.000000000 +0200
+++ gcc/gcc/configure.ac 2009-09-03 15:58:19.281369700 +0200
@@ -939,6 +939,8 @@
AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
+GCC_HEADER_STDINT(gstdint.h)
+
# These tests can't be done till we know if we have limits.h.
gcc_AC_C_CHAR_BIT
AC_C_BIGENDIAN
Index: gcc/gcc/system.h
===================================================================
--- gcc.orig/gcc/system.h 2009-08-27 15:04:09.000000000 +0200
+++ gcc/gcc/system.h 2009-09-03 14:52:38.046369700 +0200
@@ -414,6 +414,8 @@
extern void *realloc (void *, size_t);
#endif
+#include "gstdint.h"
+
/* If the system doesn't provide strsignal, we get it defined in
libiberty but no declaration is supplied. */
#if !defined (HAVE_STRSIGNAL) \
Index: gcc/gcc/Makefile.in
===================================================================
--- gcc.orig/gcc/Makefile.in 2009-09-02 23:52:30.000000000 +0200
+++ gcc/gcc/Makefile.in 2009-09-03 13:40:53.469369700 +0200
@@ -1621,6 +1621,7 @@
$(srcdir)/../config/lib-prefix.m4 \
$(srcdir)/../config/override.m4 \
$(srcdir)/../config/progtest.m4 \
+ $(srcdir)/../config/stdint.m4 \
$(srcdir)/../config/unwind_ipinfo.m4 \
$(srcdir)/../config/warnings.m4 \
$(srcdir)/acinclude.m4
Index: gcc/gcc/aclocal.m4
===================================================================
--- gcc.orig/gcc/aclocal.m4 2009-09-03 01:31:07.000000000 +0200
+++ gcc/gcc/aclocal.m4 2009-09-03 13:36:54.565369700 +0200
@@ -114,6 +114,7 @@
m4_include([../config/lib-prefix.m4])
m4_include([../config/override.m4])
m4_include([../config/progtest.m4])
+m4_include([../config/stdint.m4])
m4_include([../config/unwind_ipinfo.m4])
m4_include([../config/warnings.m4])
m4_include([acinclude.m4])