bug-gnulib
[Top][All Lists]
Advanced

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

MSVC and __STDC__


From: Bruno Haible
Subject: MSVC and __STDC__
Date: Sat, 10 Sep 2011 22:34:27 +0200
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

The MSVC 9 compiler does not define __STDC__. And we cannot define __STDC__,
because then many declarations will be hidden in the system header files.
So the workaround is either to test for _MSC_VER explicitly (this is what the
GNU standards recommend [1]), or to assume an ANSI C compiler outright.

[1] http://www.gnu.org/prep/standards/html_node/Standard-C.html


2011-09-10  Bruno Haible  <address@hidden>

        iconv, unsetenv: Add support for MSVC compiler.
        * m4/iconv.m4 (AM_ICONV): Use ISO C declaration syntax on MSVC.
        * m4/setenv.m4 (gl_FUNC_UNSETENV): Drop support for K&R C compilers.

--- m4/iconv.m4.orig    Sat Sep 10 22:15:51 2011
+++ m4/iconv.m4 Sat Sep 10 16:07:21 2011
@@ -1,4 +1,4 @@
-# iconv.m4 serial 17 (gettext-0.18.2)
+# iconv.m4 serial 18 (gettext-0.18.2)
 dnl Copyright (C) 2000-2002, 2007-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -242,7 +242,7 @@
 #ifdef __cplusplus
 "C"
 #endif
-#if defined(__STDC__) || defined(__cplusplus)
+#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, 
size_t *outbytesleft);
 #else
 size_t iconv();
--- m4/setenv.m4.orig   Sat Sep 10 22:15:51 2011
+++ m4/setenv.m4        Sat Sep 10 16:06:45 2011
@@ -1,4 +1,4 @@
-# setenv.m4 serial 24
+# setenv.m4 serial 25
 dnl Copyright (C) 2001-2004, 2006-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -77,11 +77,7 @@
 #ifdef __cplusplus
 "C"
 #endif
-#if defined(__STDC__) || defined(__cplusplus)
 int unsetenv (const char *name);
-#else
-int unsetenv();
-#endif
             ]],
             [[]])],
          [gt_cv_func_unsetenv_ret='int'],

-- 
In memoriam Sergei Tretyakov <http://en.wikipedia.org/wiki/Sergei_Tretyakov>



reply via email to

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