Collin Funk wrote: > I see that MSVC supports both typeof and __typeof__ since Visual Studio > 17.9. The difference is 'typeof' requires compiling with the latest > language standard, but '__typeof__' can be used with any language > version [1]. > > I've applied the two attached patches to detect them in stdbit-h and > intprops using the _MSC_VER [2].
Nice finding. Nice patches. Thanks! For consistency, let's use it also in stdint.m4. 2024-12-20 Bruno Haible <br...@clisp.org> stdint: Detect MSVC __typeof__ support. * m4/stdint.m4 (gl_STDINT_H): Copy condition from lib/stdbit.in.h. diff --git a/m4/stdint.m4 b/m4/stdint.m4 index 0a078e64d5..1f3062a890 100644 --- a/m4/stdint.m4 +++ b/m4/stdint.m4 @@ -1,5 +1,5 @@ # stdint.m4 -# serial 63 +# serial 64 dnl Copyright (C) 2001-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -158,7 +158,7 @@ AC_DEFUN_ONCE([gl_STDINT_H] || defined __clang__) int k = _Generic (SIZE_MAX, size_t: 0); #elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \ - || (0x5110 <= __SUNPRO_C && !__STDC__)) + || (0x5110 <= __SUNPRO_C && !__STDC__) || 1939 <= _MSC_VER) extern size_t k; extern __typeof__ (SIZE_MAX) k; #endif