From f3fdcb4288151356f544273c603d4e13a8b35269 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 9 Aug 2020 21:23:01 -0700 Subject: [PATCH] atftp: completely remove cdefs usage sys/cdefs.h is not provided by musl. Signed-off-by: Rosen Penev --- net/atftp/Makefile | 2 +- net/atftp/patches/04-cdefs.patch | 143 +++++++++++++++++++++++++++++-- 2 files changed, 137 insertions(+), 8 deletions(-) diff --git a/net/atftp/Makefile b/net/atftp/Makefile index ddd3281f3..72362c604 100644 --- a/net/atftp/Makefile +++ b/net/atftp/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=atftp PKG_VERSION:=0.7.2 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/$(PKG_NAME) diff --git a/net/atftp/patches/04-cdefs.patch b/net/atftp/patches/04-cdefs.patch index 1d3f3e2e8..8968045ff 100644 --- a/net/atftp/patches/04-cdefs.patch +++ b/net/atftp/patches/04-cdefs.patch @@ -1,22 +1,151 @@ --- a/argz.h +++ b/argz.h -@@ -39,6 +39,7 @@ +@@ -38,8 +38,6 @@ + #ifndef _ARGZ_H #define _ARGZ_H 1 - #include -+#include - +-#include +- #define __need_error_t #include -@@ -76,9 +77,9 @@ extern error_t argz_create_sep (__const char *__restrict __string, + #include /* Need size_t, and strchr is called below. */ +@@ -52,16 +50,17 @@ + typedef int error_t; + #endif + +- +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + + /* Make a '\0' separated arg vector from a unix argv vector, returning it in + ARGZ, and the total length in LEN. If a memory allocation error occurs, + ENOMEM is returned, otherwise 0. The result can be destroyed using free. */ + extern error_t __argz_create (char *__const __argv[], char **__restrict __argz, +- size_t *__restrict __len) __THROW; ++ size_t *__restrict __len) __attribute__ ((__nothrow__)); + extern error_t argz_create (char *__const __argv[], char **__restrict __argz, +- size_t *__restrict __len) __THROW; ++ size_t *__restrict __len) __attribute__ ((__nothrow__)); + + /* Make a '\0' separated arg vector from a SEP separated list in + STRING, returning it in ARGZ, and the total length in LEN. If a +@@ -69,65 +68,65 @@ extern error_t argz_create (char *__const __argv[], char **__restrict __argz, + The result can be destroyed using free. */ + extern error_t __argz_create_sep (__const char *__restrict __string, + int __sep, char **__restrict __argz, +- size_t *__restrict __len) __THROW; ++ size_t *__restrict __len) __attribute__ ((__nothrow__)); + extern error_t argz_create_sep (__const char *__restrict __string, + int __sep, char **__restrict __argz, +- size_t *__restrict __len) __THROW; ++ size_t *__restrict __len) __attribute__ ((__nothrow__)); /* Returns the number of strings in ARGZ. */ extern size_t __argz_count (__const char *__argz, size_t __len) - __THROW __attribute_pure__; -+ __THROW; ++ __attribute__ ((__nothrow__)); extern size_t argz_count (__const char *__argz, size_t __len) - __THROW __attribute_pure__; -+ __THROW; ++ __attribute__ ((__nothrow__)); /* Puts pointers to each string in ARGZ into ARGV, which must be large enough to hold them all. */ + extern void __argz_extract (__const char *__restrict __argz, size_t __len, +- char **__restrict __argv) __THROW; ++ char **__restrict __argv) __attribute__ ((__nothrow__)); + extern void argz_extract (__const char *__restrict __argz, size_t __len, +- char **__restrict __argv) __THROW; ++ char **__restrict __argv) __attribute__ ((__nothrow__)); + + /* Make '\0' separated arg vector ARGZ printable by converting all the '\0's + except the last into the character SEP. */ +-extern void __argz_stringify (char *__argz, size_t __len, int __sep) __THROW; +-extern void argz_stringify (char *__argz, size_t __len, int __sep) __THROW; ++extern void __argz_stringify (char *__argz, size_t __len, int __sep) __attribute__ ((__nothrow__)); ++extern void argz_stringify (char *__argz, size_t __len, int __sep) __attribute__ ((__nothrow__)); + + /* Append BUF, of length BUF_LEN to the argz vector in ARGZ & ARGZ_LEN. */ + extern error_t __argz_append (char **__restrict __argz, + size_t *__restrict __argz_len, + __const char *__restrict __buf, size_t _buf_len) +- __THROW; ++ __attribute__ ((__nothrow__)); + extern error_t argz_append (char **__restrict __argz, + size_t *__restrict __argz_len, + __const char *__restrict __buf, size_t __buf_len) +- __THROW; ++ __attribute__ ((__nothrow__)); + + /* Append STR to the argz vector in ARGZ & ARGZ_LEN. */ + extern error_t __argz_add (char **__restrict __argz, + size_t *__restrict __argz_len, +- __const char *__restrict __str) __THROW; ++ __const char *__restrict __str) __attribute__ ((__nothrow__)); + extern error_t argz_add (char **__restrict __argz, + size_t *__restrict __argz_len, +- __const char *__restrict __str) __THROW; ++ __const char *__restrict __str) __attribute__ ((__nothrow__)); + + /* Append SEP separated list in STRING to the argz vector in ARGZ & + ARGZ_LEN. */ + extern error_t __argz_add_sep (char **__restrict __argz, + size_t *__restrict __argz_len, + __const char *__restrict __string, int __delim) +- __THROW; ++ __attribute__ ((__nothrow__)); + extern error_t argz_add_sep (char **__restrict __argz, + size_t *__restrict __argz_len, + __const char *__restrict __string, int __delim) +- __THROW; ++ __attribute__ ((__nothrow__)); + + /* Delete ENTRY from ARGZ & ARGZ_LEN, if it appears there. */ + extern void __argz_delete (char **__restrict __argz, + size_t *__restrict __argz_len, +- char *__restrict __entry) __THROW; ++ char *__restrict __entry) __attribute__ ((__nothrow__)); + extern void argz_delete (char **__restrict __argz, + size_t *__restrict __argz_len, +- char *__restrict __entry) __THROW; ++ char *__restrict __entry) __attribute__ ((__nothrow__)); + + /* Insert ENTRY into ARGZ & ARGZ_LEN before BEFORE, which should be an + existing entry in ARGZ; if BEFORE is NULL, ENTRY is appended to the end. +@@ -138,11 +137,11 @@ extern void argz_delete (char **__restrict __argz, + extern error_t __argz_insert (char **__restrict __argz, + size_t *__restrict __argz_len, + char *__restrict __before, +- __const char *__restrict __entry) __THROW; ++ __const char *__restrict __entry) __attribute__ ((__nothrow__)); + extern error_t argz_insert (char **__restrict __argz, + size_t *__restrict __argz_len, + char *__restrict __before, +- __const char *__restrict __entry) __THROW; ++ __const char *__restrict __entry) __attribute__ ((__nothrow__)); + + /* Replace any occurrences of the string STR in ARGZ with WITH, reallocating + ARGZ as necessary. If REPLACE_COUNT is non-zero, *REPLACE_COUNT will be +@@ -173,9 +172,9 @@ extern error_t argz_replace (char **__restrict __argz, + ...; + */ + extern char *__argz_next (__const char *__restrict __argz, size_t __argz_len, +- __const char *__restrict __entry) __THROW; ++ __const char *__restrict __entry) __attribute__ ((__nothrow__)); + extern char *argz_next (__const char *__restrict __argz, size_t __argz_len, +- __const char *__restrict __entry) __THROW; ++ __const char *__restrict __entry) __attribute__ ((__nothrow__)); + + #ifdef __USE_EXTERN_INLINES + extern inline char * +@@ -200,6 +199,8 @@ argz_next (__const char *__argz, size_t __argz_len, + } + #endif /* Use extern inlines. */ + +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif /* argz.h */