devel/elfutils: fix future build failure w.r.t. stdio _unlocked

Include <stdio.h> early so that the stdio.h function declarations come
first, then redefine fputs/fwrite/fread_unlocked to the locked versions.
fputc_unlocked will be a macro similar to putc_unlocked, so just hide that
one behind an #ifndef since it will be provided as a macro by <stdio.h>. The
other three will be using the technically-incorrect locked variants until
all supported releases provide the needed functions, at which point we can
switch them all at once.

No PORTREVISION bump as this is just a preemptive build fix that doesn't
change the output at all.

QA:
 * portlint not ran, no change outside of a single patch
 * testport (-CURRENT, amd64; 12.1-RELEASE, amd64; -CURRENT+patch, amd64)

PR:		243546
Reviewed by:	koobs (ports)
Approved by:	koobs (ports), cem (maintainer)
MFH:		2020Q1 (implicit, build fix)
This commit is contained in:
Kyle Evans 2020-01-29 18:35:29 +00:00
parent 419b0c3c1c
commit 2d49571815
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=524564

View file

@ -1,6 +1,6 @@
--- lib/eu-config.h.orig 2015-06-11 11:38:55 UTC
+++ lib/eu-config.h
@@ -187,4 +187,171 @@ asm (".section predict_data, \"aw\"; .pr
@@ -187,4 +187,180 @@ asm (".section predict_data, \"aw\"; .pr
#endif
@ -10,6 +10,7 @@
+#include <limits.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
@ -130,7 +131,15 @@
+#define bswap_32 bswap32
+#define bswap_64 bswap64
+
+/*
+ * Future versions of FreeBSD will provide proper versions of these _unlocked
+ * variants. These can and should be used instead, but won't be available
+ * until FreeBSD 11.4 and 12.2, at which point we should limit the scope of
+ * these to DragonFlyBSD.
+ */
+#ifndef fputc_unlocked
+#define fputc_unlocked putc_unlocked
+#endif
+#define fputs_unlocked fputs
+#define fwrite_unlocked fwrite
+#define fread_unlocked fread