]> git.ipfire.org Git - thirdparty/libbsd.git/commitdiff
Add support for new LIBBSD_VIS_OPENBSD selection macro
authorGuillem Jover <guillem@hadrons.org>
Sat, 6 Feb 2021 22:28:42 +0000 (23:28 +0100)
committerGuillem Jover <guillem@hadrons.org>
Sun, 7 Feb 2021 01:03:22 +0000 (02:03 +0100)
This will make it possible to explicitly select the OpenBSD vis
implementation (the current default) for code of OpenBSD origins.

include/bsd/vis.h
test/vis-openbsd.c

index 84102b2c1c18f9ea97de2e587f593491009c3973..fb9ad274ad84ead8eb9453c4f0a233503da505b2 100644 (file)
  * Provide both implementations and default for now on the historical one to
  * avoid breakage, we will switch to the NetBSD one in libbsd 0.10.0 or so.
  * Define LIBBSD_NETBSD_VIS to switch to the NetBSD one now.
+ * Define LIBBSD_OPENBSD_VIS to keep using the OpenBSD one.
  */
-#ifndef LIBBSD_NETBSD_VIS
+#if defined(LIBBSD_OPENBSD_VIS)
+#undef LIBBSD_NETBSD_VIS
+#elif !defined(LIBBSD_NETBSD_VIS)
 #warning "NetBSD added incompatible strnvis() and strnunvis(), please see <bsd/vis.h> for more detils."
 #endif
 
index 99c41984a3ebbbd218ab96e26bf038efc92af5e6..cd39675f286aa6bbdb36ac0917feb82bdf6dd6e3 100644 (file)
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#define LIBBSD_OPENBSD_VIS 1
+
 #include <assert.h>
 #include <string.h>
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wcpp"
 #include <vis.h>
-#pragma GCC diagnostic pop
 
 int
 main(int argc, char **argv)