summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/wolf/port/stdio.h18
-rw-r--r--src/GNUmakefile9
-rw-r--r--tests/port/GNUmakefile7
3 files changed, 21 insertions, 13 deletions
diff --git a/include/wolf/port/stdio.h b/include/wolf/port/stdio.h
index bcf8d29..03e4d77 100644
--- a/include/wolf/port/stdio.h
+++ b/include/wolf/port/stdio.h
@@ -33,34 +33,32 @@
#include <stdio.h>
-#if defined HAVE_STDARG_H
-#include <stdarg.h> /* for va_list */
-#endif
-
-#if defined HAVE_SYS_TYPES_H
-#include <sys/types.h> /* for size_t */
-#endif
-
/* TODO: check which features we need in snprintf, make sure the platform one supports it,
* otherwise we take the stub */
/* TODO: also clean up mess here with autoconf relicts! */
#if defined _WIN32
/* secure snprintf on Wndows is called differently */
#define snprintf sprintf_s
+
#else
+#include <stdarg.h> /* for va_list */
+
+#include <sys/types.h> /* for size_t */
+
#if !defined HAVE_SNPRINTF || defined WOLF_TEST_SNPRINTF
extern int rpl_snprintf( char *str, size_t size, const char *format, ... );
#endif /* !defined HAVE_SNPRINTF || defined TEST_SNPRINTF */
#if !defined HAVE_SNPRINTF
-#define snprintf( s1, s2, n ) rpl_snprintf( s1, s2, n )
+/* TODO: with variadic macros, we can define a much better macro here! */
+#define snprintf rpl_snprintf
#endif /* !defined HAVE_SNPRINTF */
#if !defined HAVE_VSNPRINTF || defined WOLF_TEST_VSNPRINTF
extern int rpl_vsnprintf( char *str, size_t size, const char *format, va_list args );
#endif /* !defined HAVE_VSNPRINTF || defined TEST_VSNPRINTF */
#if !defined HAVE_VSNPRINTF
-#define vsnprintf rpl_vsnprintf
+#define vsnprintf( str, size, format, ap ) rpl_vsnprintf( str, size, format, ap )
#endif /* !defined HAVE_VSNPRINTF */
#endif /* defined _WIN32 */
diff --git a/src/GNUmakefile b/src/GNUmakefile
index 5d9417d..ff38bd0 100644
--- a/src/GNUmakefile
+++ b/src/GNUmakefile
@@ -31,9 +31,12 @@ local_all: $(LIBS)
-include $(TOPDIR)/makefiles/gmake/sub.mk
-# snprintf has some quirks, compile relaxed
-#port/snprintf.o : port/snprintf.c $(TOPDIR)/include/wolf/port/snprintf.h
-# $(CC) -c -o $@ $(INCLUDE_DIRS) $<
+# snprintf has some quirks, mainly -Wfloat-equal doesn't allow the
+# definition of ISNAN, ISINF, the C99 versions use math.h, ieee.h
+# libmath and more, which is maybe not really acceptable for a core
+# port (on the other hand so isn't NLS support!)
+port/stdio.o : port/stdio.c $(TOPDIR)/include/wolf/port/stdio.h port/snprintf.h port/snprintf.c
+ $(CC) -c -o $@ $(INCLUDE_DIRS) $<
libwolf.a: $(OBJS)
$(AR) cr $@ $?
diff --git a/tests/port/GNUmakefile b/tests/port/GNUmakefile
index af58e2f..0bb9f3d 100644
--- a/tests/port/GNUmakefile
+++ b/tests/port/GNUmakefile
@@ -16,6 +16,13 @@ TEST_BINS = \
-include $(TOPDIR)/makefiles/gmake/sub.mk
+# snprintf has some quirks, mainly -Wfloat-equal doesn't allow the
+# definition of ISNAN, ISINF, the C99 versions use math.h, ieee.h
+# libmath and more, which is maybe not really acceptable for a core
+# port (on the other hand so isn't NLS support!)
+test_snprintf.o : test_snprintf.c $(TOPDIR)/include/wolf/port/stdio.h $(TOPDIR)/src/port/snprintf.h $(TOPDIR)/src/port/snprintf.c
+ $(CC) -c -o $@ $(INCLUDE_DIRS) $<
+
local_all:
local_clean: