diff options
author | Christian Weisgerber <naddy@FreeBSD.org> | 2020-09-24 19:02:01 +0000 |
---|---|---|
committer | Christian Weisgerber <naddy@FreeBSD.org> | 2020-09-24 19:02:01 +0000 |
commit | 209ada44d81f1ad266b3218cab4a87ca9ba2905c (patch) | |
tree | b5bf0314b52ee4deec86d7b03e066463610a445f | |
parent | 08ee8c0bae208ea801368bddc3e34a1ebfff668d (diff) | |
download | ports-209ada44d81f1ad266b3218cab4a87ca9ba2905c.tar.gz ports-209ada44d81f1ad266b3218cab4a87ca9ba2905c.zip |
Switch mostly to a single compat header file that provides compatibility
mappings for system headers and prototypes of functions in libopenbsd-compat.
Notes
Notes:
svn path=/head/; revision=549940
-rw-r--r-- | devel/got/Makefile | 5 | ||||
-rw-r--r-- | devel/got/files/openbsd-compat/basename.c | 2 | ||||
-rw-r--r-- | devel/got/files/openbsd-compat/dirname.c | 2 | ||||
-rw-r--r-- | devel/got/files/openbsd-compat/imsg-buffer.c | 2 | ||||
-rw-r--r-- | devel/got/files/openbsd-compat/imsg.c | 2 | ||||
-rw-r--r-- | devel/got/files/openbsd-compat/libgen.h | 10 | ||||
-rw-r--r-- | devel/got/files/openbsd-compat/openbsd-compat.h (renamed from devel/got/files/openbsd-compat/sys/queue.h) | 47 | ||||
-rw-r--r-- | devel/got/files/openbsd-compat/stdlib.h | 9 | ||||
-rw-r--r-- | devel/got/files/openbsd-compat/sys/cdefs.h | 8 | ||||
-rw-r--r-- | devel/got/files/openbsd-compat/unistd.h | 14 |
10 files changed, 56 insertions, 45 deletions
diff --git a/devel/got/Makefile b/devel/got/Makefile index 6043757e37a0..629d96706f34 100644 --- a/devel/got/Makefile +++ b/devel/got/Makefile @@ -13,7 +13,12 @@ LICENSE_FILE= ${WRKSRC}/LICENCE USES= uidfix +n= ${.newline} post-extract: + @${FIND} ${WRKSRC} -name '*.[cy]' -exec \ + ${REINPLACE_CMD} '1,/^#include "/{ \ + /^#include "/i\$n#include "openbsd-compat.h"\$n$n}' \ + {} + ${CP} -R ${FILESDIR}/openbsd-compat ${WRKSRC} # The regression test suite requires: diff --git a/devel/got/files/openbsd-compat/basename.c b/devel/got/files/openbsd-compat/basename.c index 2081cb95a28b..84e9d13de81e 100644 --- a/devel/got/files/openbsd-compat/basename.c +++ b/devel/got/files/openbsd-compat/basename.c @@ -21,6 +21,8 @@ #include <limits.h> #include <string.h> +#include <openbsd-compat.h> + char * basename(const char *path) { diff --git a/devel/got/files/openbsd-compat/dirname.c b/devel/got/files/openbsd-compat/dirname.c index 7a5d83b91e0a..1973f82ef481 100644 --- a/devel/got/files/openbsd-compat/dirname.c +++ b/devel/got/files/openbsd-compat/dirname.c @@ -21,6 +21,8 @@ #include <limits.h> #include <string.h> +#include <openbsd-compat.h> + /* A slightly modified copy of this file exists in libexec/ld.so */ char * diff --git a/devel/got/files/openbsd-compat/imsg-buffer.c b/devel/got/files/openbsd-compat/imsg-buffer.c index 7c60d9e9e727..c1ec73a3160d 100644 --- a/devel/got/files/openbsd-compat/imsg-buffer.c +++ b/devel/got/files/openbsd-compat/imsg-buffer.c @@ -27,6 +27,8 @@ #include <string.h> #include <unistd.h> +#include <openbsd-compat.h> + #include "imsg.h" static int ibuf_realloc(struct ibuf *, size_t); diff --git a/devel/got/files/openbsd-compat/imsg.c b/devel/got/files/openbsd-compat/imsg.c index c0ff22978e01..06d1fabb8875 100644 --- a/devel/got/files/openbsd-compat/imsg.c +++ b/devel/got/files/openbsd-compat/imsg.c @@ -26,6 +26,8 @@ #include <string.h> #include <unistd.h> +#include <openbsd-compat.h> + #include "imsg.h" int imsg_fd_overhead = 0; diff --git a/devel/got/files/openbsd-compat/libgen.h b/devel/got/files/openbsd-compat/libgen.h deleted file mode 100644 index dbea51c5234a..000000000000 --- a/devel/got/files/openbsd-compat/libgen.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _OPENBSD_COMPAT_LIBGEN_H_ -#define _OPENBSD_COMPAT_LIBGEN_H_ - -#define basename(path) basename_const(path) -#define dirname(path) dirname_const(path) - -char *basename(const char *); -char *dirname(const char *); - -#endif diff --git a/devel/got/files/openbsd-compat/sys/queue.h b/devel/got/files/openbsd-compat/openbsd-compat.h index c6e7ae2f50ec..fd66e6e8ef59 100644 --- a/devel/got/files/openbsd-compat/sys/queue.h +++ b/devel/got/files/openbsd-compat/openbsd-compat.h @@ -1,8 +1,19 @@ -#ifndef _OPENBSD_COMPAT_SYS_QUEUE_H_ -#define _OPENBSD_COMPAT_SYS_QUEUE_H_ +/* + * Compatibility mappings for system headers and + * prototypes for functions in libopenbsd-compat. + */ -#include_next <sys/queue.h> +#ifndef _OPENBSD_COMPAT_H_ +#define _OPENBSD_COMPAT_H_ +/* + * <sys/cdefs.h> + */ +#define __dead __dead2 + +/* + * <sys/queue.h> + */ #define SIMPLEQ_HEAD(name, type) \ STAILQ_HEAD(name, type) #define SIMPLEQ_HEAD_INITIALIZER(head) \ @@ -36,4 +47,32 @@ #define SIMPLEQ_CONCAT(head1, head2) \ STAILQ_CONCAT(head1, head2) -#endif +/* + * <libgen.h> + */ +#undef basename +#undef dirname +#define basename(path) basename_const(path) +#define dirname(path) dirname_const(path) + +char *basename(const char *); +char *dirname(const char *); + +/* + * <stdlib.h> + */ +void freezero(void *, size_t); +void *recallocarray(void *, size_t, size_t, size_t); + +/* + * <unistd.h> + */ +int getdtablecount(void); + +/* void -> int */ +#define closefrom(fd) (closefrom(fd), 0) + +#define pledge(promises, execpromises) 0 +#define unveil(path, permissions) 0 + +#endif /* _OPENBSD_COMPAT_H_ */ diff --git a/devel/got/files/openbsd-compat/stdlib.h b/devel/got/files/openbsd-compat/stdlib.h deleted file mode 100644 index 760f4e2fa9a5..000000000000 --- a/devel/got/files/openbsd-compat/stdlib.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _OPENBSD_COMPAT_STDLIB_H_ -#define _OPENBSD_COMPAT_STDLIB_H_ - -#include_next <stdlib.h> - -void freezero(void *, size_t); -void *recallocarray(void *, size_t, size_t, size_t); - -#endif diff --git a/devel/got/files/openbsd-compat/sys/cdefs.h b/devel/got/files/openbsd-compat/sys/cdefs.h deleted file mode 100644 index de5996041bc1..000000000000 --- a/devel/got/files/openbsd-compat/sys/cdefs.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _OPENBSD_COMPAT_SYS_CDEFS_ -#define _OPENBSD_COMPAT_SYS_CDEFS_ - -#include_next <sys/cdefs.h> - -#define __dead __dead2 - -#endif diff --git a/devel/got/files/openbsd-compat/unistd.h b/devel/got/files/openbsd-compat/unistd.h deleted file mode 100644 index de0af88cba19..000000000000 --- a/devel/got/files/openbsd-compat/unistd.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _OPENBSD_COMPAT_UNISTD_H_ -#define _OPENBSD_COMPAT_UNISTD_H_ - -#include_next <unistd.h> - -int getdtablecount(void); - -/* void -> int */ -#define closefrom(fd) (closefrom(fd), 0) - -#define pledge(promises, execpromises) 0 -#define unveil(path, permissions) 0 - -#endif |