This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: Cast in c-pretty-print.c causes warning


On Thu, Sep 3, 2009 at 9:08 AM, Kai Tietz<ktietz70@googlemail.com> wrote:
> 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?

I do not see the corresponding hunk for c-pretty-print.c -- or is my mailer
playing tricks with me?

Where is what should happen

  (1) check for uintptr_t; use it if available;
  (2) otherwise; check for 'long long'; use it if available;
  (3) otherwise; if 32-bit build; use 'unsigned long';
  (4) otherwise; if 64-bit build, check for __int64 and use it;
       otherwise moan. (this would happens only for curious w64-based builds).

You should introduce uintptr_t as a typedef for cases 2 through 4.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]