Fix 'implicit declaration of vsnprintf' GCC warning (if strict ANSI mode)
authorIvan Maidanski <ivmai@mail.ru>
Sun, 22 Jun 2014 08:40:10 +0000 (12:40 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Sun, 22 Jun 2014 08:40:10 +0000 (12:40 +0400)
* cord/tests/cordtest.c (GC_SNPRINTF): Redirect to sprintf also in
case of __STRICT_ANSI__ (i.e., if -ansi compiler option specified).
* misc.c (GC_VSNPRINTF): Redirect to vsprintf also in case of
__STRICT_ANSI__.

cord/tests/cordtest.c
misc.c

index a5a0c30..6f14bc0 100644 (file)
@@ -204,7 +204,7 @@ void test_extras(void)
     }
 }
 
-#ifdef __DJGPP__
+#if defined(__DJGPP__) || defined(__STRICT_ANSI__)
   /* snprintf is missing in DJGPP (v2.0.3) */
 # define GC_SNPRINTF sprintf
 # define GC_SNPRINTF_BUFSZ_ARG(bufsz) /* empty */
diff --git a/misc.c b/misc.c
index 01a7d84..68667ee 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -1505,7 +1505,7 @@ GC_API void GC_CALL GC_enable_incremental(void)
 
 #define BUFSZ 1024
 
-#ifdef DJGPP
+#if defined(DJGPP) || defined(__STRICT_ANSI__)
   /* vsnprintf is missing in DJGPP (v2.0.3) */
 # define GC_VSNPRINTF(buf, bufsz, format, args) vsprintf(buf, format, args)
 #elif defined(_MSC_VER)