On Sat, Feb 18, 2023 at 08:22:56AM +0000, Miod Vallat wrote:
> libexpat assumes the compiler might not know of the C99 format
> specifiers for ptrdiff_t and size_t, and tries to guess alternative
> format strings.
> 
> The following diff relieves it of this misery (but can't be sent
> up??tream, as it is too aggressive).

This means a diff I have to merge with every libexpat update.  I
am quite happy that I got rid of them.

Does this actually change something on any of our architectures?

If not, I would prefer to stick to upstream #ifdef hell.  This
avoids possible merge errors in every expat release.

bluhm

> Index: lib/internal.h
> ===================================================================
> RCS file: /OpenBSD/src/lib/libexpat/lib/internal.h,v
> retrieving revision 1.10
> diff -u -p -r1.10 internal.h
> --- lib/internal.h    20 Sep 2022 23:00:53 -0000      1.10
> +++ lib/internal.h    18 Feb 2023 08:16:19 -0000
> @@ -105,31 +105,9 @@
>  #  endif
>  #endif
>  
> -#include <limits.h> // ULONG_MAX
> -
> -#if defined(_WIN32)                                                          
>   \
> -    && (! defined(__USE_MINGW_ANSI_STDIO)                                    
>   \
> -        || (1 - __USE_MINGW_ANSI_STDIO - 1 == 0))
> -#  define EXPAT_FMT_ULL(midpart) "%" midpart "I64u"
> -#  if defined(_WIN64) // Note: modifiers "td" and "zu" do not work for MinGW
> -#    define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "I64d"
> -#    define EXPAT_FMT_SIZE_T(midpart) "%" midpart "I64u"
> -#  else
> -#    define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "d"
> -#    define EXPAT_FMT_SIZE_T(midpart) "%" midpart "u"
> -#  endif
> -#else
> -#  define EXPAT_FMT_ULL(midpart) "%" midpart "llu"
> -#  if ! defined(ULONG_MAX)
> -#    error Compiler did not define ULONG_MAX for us
> -#  elif ULONG_MAX == 18446744073709551615u // 2^64-1
> -#    define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "ld"
> -#    define EXPAT_FMT_SIZE_T(midpart) "%" midpart "lu"
> -#  else
> -#    define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "d"
> -#    define EXPAT_FMT_SIZE_T(midpart) "%" midpart "u"
> -#  endif
> -#endif
> +#define EXPAT_FMT_ULL(midpart) "%" midpart "llu"
> +#define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "td"
> +#define EXPAT_FMT_SIZE_T(midpart) "%" midpart "zu"
>  
>  #ifndef UNUSED_P
>  #  define UNUSED_P(p) (void)p
> 

Reply via email to