>From be21e1a1d3ffa0b3baa073bdb4b04c80af7f7bee
From: Ori Bernstein <ori@eigenstate.org>
Date: Sun, 22 Mar 2020 18:08:23 -0700
Subject: [PATCH] portability fixes for plan9
this fixes 3 issues:
- First off, the plan 9 C compilers don't handle GNU style varargs,
so we switch over to c99 style.
- Second, the __attribute((format, printf) is a GNU C extension,
so we only define it for GNU C. For plan 9, we use the varargck
pragma to do the same thing.
- Third, 0 length arrays aren't portable, so we use C99 flexible
array members.
diff -urN a/include/nslog/nslog.h b/include/nslog/nslog.h
--- a/include/nslog/nslog.h Sun Feb 23 01:49:32 2020
+++ b/include/nslog/nslog.h Sun Mar 22 18:08:23 2020
@@ -17,6 +17,13 @@
#include <stdarg.h>
+#if defined(__GNUC__)
+# define PRINTF(fmt, args) __attribute__ ((format (printf, 2, 3)))
+#elif defined(_PLAN9)
+# pragma varargck nslog__log argpos 2
+# define PRINTF(pos, args)
+
No comments:
Post a Comment