autoconf-patches
[Top][All Lists]
Advanced

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

[PATCH 2/3] MSVC doesn't define __STDC__ by default


From: Antonin Décimo
Subject: [PATCH 2/3] MSVC doesn't define __STDC__ by default
Date: Wed, 24 Apr 2024 15:59:24 -0300

MSVC *never* defines __STDC__ by default. It currently supports a
dialect of C99 by default. This macro can be defined if MSVC's C11 or
C17 mode is used (with /std:c11 or /std:c17), with the /Zc:__STDC__
compiler flag. Defining this macro would have unfortunate
consequences:

> This option is a source breaking change. Due to the behavior of the
> UCRT, which doesn't expose POSIX functions when __STDC__ is 1, it
> isn't possible to define this macro for C by default without
> introducing breaking changes to the stable language versions.

https://learn.microsoft.com/en-us/cpp/build/reference/zc-stdc?view=msvc-170

So avoid testing __STDC__ when MSVC is used.
---
 lib/autoconf/c.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index 0058c2f2..306ee63e 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -1123,7 +1123,7 @@ ac_c_conftest_c89_globals='
 /* Does the compiler advertise C89 conformance?
    Do not test the value of __STDC__, because some compilers set it to 0
    while being otherwise adequately conformant. */
-#if !defined __STDC__
+#if !defined __STDC__ && !defined _MSC_VER
 # error "Compiler does not advertise C89 conformance"
 #endif
 
-- 
2.44.0




reply via email to

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