bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] stdint: port intptr_t to more-recent MinGW


From: Paul Eggert
Subject: Re: [PATCH] stdint: port intptr_t to more-recent MinGW
Date: Wed, 12 Aug 2020 11:49:16 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Following up on this patch, here's a brief explanation. In <https://bugs.gnu.org/36597> we were battling with a problem building Emacs under 32-bit MinGW. The problem was that Gnulib stdint.in.h did this:

  # if !((defined __KLIBC__ && defined _INTPTR_T_DECLARED) \
|| (defined __MINGW32__ && defined _INTPTR_T_DEFINED && defined _UINTPTR_T_DEFINED))
  #  undef intptr_t
  #  undef uintptr_t
  #  ifdef _WIN64
  typedef long long int gl_intptr_t;
  typedef unsigned long long int gl_uintptr_t;
  #  else
  typedef long int gl_intptr_t;
  typedef unsigned long int gl_uintptr_t;
  #  endif
  #  define intptr_t gl_intptr_t
  #  define uintptr_t gl_uintptr_t
  # endif

which makes intptr_t 'long', whereas Gnulib inttypes.in.h did this:

  #if !defined PRIdPTR
  # ifdef INTPTR_MAX
  #  define PRIdPTR @PRIPTR_PREFIX@ "d"
  # endif
  #endif

and since MinGW's PRIdPTR is already "d" this leaves it "d". Later when Emacs code did something like this:

  intptr_t ip; ...
  printf ("%PRIdPTR, ip);

GCC complained:

warning: format '%d' expects argument of type 'int', but argument 2 has type 'gl_intptr_t' {aka 'long int'} [-Wformat=]

The code ran OK since 'int' and 'long' are the same, but we wanted to squelch the warning.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]