From 3ecfeb340eea0d15a0c7f4c88387a7ded2d5e022 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 7 Jul 2026 13:21:04 +0800 Subject: [PATCH 1/2] Avoid duplicate signed char generic association with MSVC --- lib/nghttp3_macro.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/nghttp3_macro.h b/lib/nghttp3_macro.h index 2b03dc53..522b7095 100644 --- a/lib/nghttp3_macro.h +++ b/lib/nghttp3_macro.h @@ -68,6 +68,13 @@ nghttp3_max_def(unsigned_int, unsigned int) nghttp3_max_def(unsigned_short_int, unsigned short int) nghttp3_max_def(unsigned_char, unsigned char) +#ifdef _MSC_VER +# define nghttp3_max_signed_char_assoc +#else /* !defined(_MSC_VER) */ +# define nghttp3_max_signed_char_assoc \ + signed char: nghttp3_max_signed_char, +#endif /* !defined(_MSC_VER) */ + #define nghttp3_max(A, B) \ _Generic((A), \ long long int: nghttp3_max_long_long_int, \ @@ -77,7 +84,7 @@ nghttp3_max_def(unsigned_char, unsigned char) long int: nghttp3_max_long_int, \ int: nghttp3_max_int, \ short int: nghttp3_max_short_int, \ - signed char: nghttp3_max_signed_char, \ + nghttp3_max_signed_char_assoc \ char: nghttp3_max_char, \ unsigned long long int: nghttp3_max_unsigned_long_long_int, \ unsigned long int: nghttp3_max_unsigned_long_int, \ @@ -85,7 +92,7 @@ nghttp3_max_def(unsigned_char, unsigned char) unsigned short int: nghttp3_max_unsigned_short_int, \ unsigned char: nghttp3_max_unsigned_char), \ short int: nghttp3_max_short_int, \ - signed char: nghttp3_max_signed_char, \ + nghttp3_max_signed_char_assoc \ char: nghttp3_max_char, \ unsigned long long int: nghttp3_max_unsigned_long_long_int, \ unsigned long int: nghttp3_max_unsigned_long_int, \ @@ -108,6 +115,13 @@ nghttp3_min_def(unsigned_int, unsigned int) nghttp3_min_def(unsigned_short_int, unsigned short int) nghttp3_min_def(unsigned_char, unsigned char) +#ifdef _MSC_VER +# define nghttp3_min_signed_char_assoc +#else /* !defined(_MSC_VER) */ +# define nghttp3_min_signed_char_assoc \ + signed char: nghttp3_min_signed_char, +#endif /* !defined(_MSC_VER) */ + #define nghttp3_min(A, B) \ _Generic((A), \ long long int: nghttp3_min_long_long_int, \ @@ -117,7 +131,7 @@ nghttp3_min_def(unsigned_char, unsigned char) long int: nghttp3_min_long_int, \ int: nghttp3_min_int, \ short int: nghttp3_min_short_int, \ - signed char: nghttp3_min_signed_char, \ + nghttp3_min_signed_char_assoc \ char: nghttp3_min_char, \ unsigned long long int: nghttp3_min_unsigned_long_long_int, \ unsigned long int: nghttp3_min_unsigned_long_int, \ @@ -125,7 +139,7 @@ nghttp3_min_def(unsigned_char, unsigned char) unsigned short int: nghttp3_min_unsigned_short_int, \ unsigned char: nghttp3_min_unsigned_char), \ short int: nghttp3_min_short_int, \ - signed char: nghttp3_min_signed_char, \ + nghttp3_min_signed_char_assoc \ char: nghttp3_min_char, \ unsigned long long int: nghttp3_min_unsigned_long_long_int, \ unsigned long int: nghttp3_min_unsigned_long_int, \ From db9f39fc6aa263fe6d2f03c0ca395c42be25b4a1 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Tue, 7 Jul 2026 13:36:15 +0800 Subject: [PATCH 2/2] Limit MSVC generic workaround to affected versions --- lib/nghttp3_macro.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/nghttp3_macro.h b/lib/nghttp3_macro.h index 522b7095..dc30bb7e 100644 --- a/lib/nghttp3_macro.h +++ b/lib/nghttp3_macro.h @@ -68,12 +68,12 @@ nghttp3_max_def(unsigned_int, unsigned int) nghttp3_max_def(unsigned_short_int, unsigned short int) nghttp3_max_def(unsigned_char, unsigned char) -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__) && _MSC_VER < 1944 # define nghttp3_max_signed_char_assoc -#else /* !defined(_MSC_VER) */ +#else /* !(defined(_MSC_VER) && !defined(__clang__) && _MSC_VER < 1944) */ # define nghttp3_max_signed_char_assoc \ signed char: nghttp3_max_signed_char, -#endif /* !defined(_MSC_VER) */ +#endif /* !(defined(_MSC_VER) && !defined(__clang__) && _MSC_VER < 1944) */ #define nghttp3_max(A, B) \ _Generic((A), \ @@ -115,12 +115,12 @@ nghttp3_min_def(unsigned_int, unsigned int) nghttp3_min_def(unsigned_short_int, unsigned short int) nghttp3_min_def(unsigned_char, unsigned char) -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__) && _MSC_VER < 1944 # define nghttp3_min_signed_char_assoc -#else /* !defined(_MSC_VER) */ +#else /* !(defined(_MSC_VER) && !defined(__clang__) && _MSC_VER < 1944) */ # define nghttp3_min_signed_char_assoc \ signed char: nghttp3_min_signed_char, -#endif /* !defined(_MSC_VER) */ +#endif /* !(defined(_MSC_VER) && !defined(__clang__) && _MSC_VER < 1944) */ #define nghttp3_min(A, B) \ _Generic((A), \