aboutsummaryrefslogtreecommitdiff
path: root/include/c99_snprintf.h
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2024-05-10 15:15:56 +0000
committerCy Schubert <cy@FreeBSD.org>2024-05-26 22:55:52 +0000
commit1f833b3fc9968c3dd7ed79ccf0525ebf16c891ad (patch)
tree85801af20e3b694584668aeb39ecec75ee71f72c /include/c99_snprintf.h
parentab1f1aa8333369a83ff284848fc3fc2e52d5f29f (diff)
Diffstat (limited to 'include/c99_snprintf.h')
-rw-r--r--include/c99_snprintf.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/c99_snprintf.h b/include/c99_snprintf.h
new file mode 100644
index 000000000000..f5c1bf0e117c
--- /dev/null
+++ b/include/c99_snprintf.h
@@ -0,0 +1,28 @@
+/*
+ * ntp_c99_snprintf.h
+ *
+ * Included from config.h to deal with replacing [v]snprintf() on older
+ * systems. The #undef lines below cannot be directly in config.h as
+ * config.status modifies each #undef in config.h.in to either be a
+ * commented-out #undef or a functional #define. Here they are used
+ * to avoid redefinition warnings on systems such as macos ca. 2024
+ * where system headers define [v]snprintf as preprocessor macros.
+ *
+ * Do not include this file directly, leave it to config.h.
+ */
+
+#if !defined(_KERNEL) && !defined(PARSESTREAM)
+/*
+ * stdio.h must be included in config.h after _GNU_SOURCE is defined
+ * but before #define snprintf rpl_snprintf
+ */
+# include <stdio.h>
+#endif
+
+#ifdef HW_WANT_RPL_SNPRINTF
+# undef snprintf
+#endif
+#ifdef HW_WANT_RPL_VSNPRINTF
+# undef vsnprintf
+#endif
+