[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reducing duplication of bit operation code.
From: |
Bruno Haible |
Subject: |
Re: Reducing duplication of bit operation code. |
Date: |
Fri, 20 Dec 2024 09:48:04 +0100 |
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 <bruno@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