diff mbox series

[1/1] package/lighttpd: add missing static_assert macro

Message ID 20211215135421.1168030-1-br015@umbiko.net
State Superseded
Headers show
Series [1/1] package/lighttpd: add missing static_assert macro | expand

Commit Message

Andreas Ziegler Dec. 15, 2021, 1:54 p.m. UTC
Fixes build failure in toolchains using uClibc:

In file included from ../src/algo_xxhash.c:48:
../src/algo_xxhash.h: In function ‘XXH32_canonicalFromHash’:
../src/algo_xxhash.h:1566:54: warning: implicit declaration of function ‘static_assert’ [-Wimplicit-function-declaration]
 1566 | #    define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0)
      |                                                      ^~~~~~~~~~~~~
../src/algo_xxhash.h:1572:32: note: in expansion of macro ‘XXH_STATIC_ASSERT_WITH_MESSAGE’
 1572 | #  define XXH_STATIC_ASSERT(c) XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/algo_xxhash.h:2282:5: note: in expansion of macro ‘XXH_STATIC_ASSERT’
 2282 |     XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) == sizeof(XXH32_hash_t));
      |     ^~~~~~~~~~~~~~~~~

... and later:

../src/algo_xxhash.h:2282: undefined reference to `static_assert'

Signed-off-by: Andreas Ziegler <br015@umbiko.net>
---
 ...lgo_xxhash-add-missing-static_assert-macro.patch | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 package/lighttpd/0002-algo_xxhash-add-missing-static_assert-macro.patch

Comments

Arnout Vandecappelle Dec. 16, 2021, 6:52 p.m. UTC | #1
Hi Andreas,

On 15/12/2021 14:54, Andreas Ziegler wrote:
> Fixes build failure in toolchains using uClibc:
> 
> In file included from ../src/algo_xxhash.c:48:
> ../src/algo_xxhash.h: In function ‘XXH32_canonicalFromHash’:
> ../src/algo_xxhash.h:1566:54: warning: implicit declaration of function ‘static_assert’ [-Wimplicit-function-declaration]
>   1566 | #    define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0)
>        |                                                      ^~~~~~~~~~~~~
> ../src/algo_xxhash.h:1572:32: note: in expansion of macro ‘XXH_STATIC_ASSERT_WITH_MESSAGE’
>   1572 | #  define XXH_STATIC_ASSERT(c) XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
>        |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../src/algo_xxhash.h:2282:5: note: in expansion of macro ‘XXH_STATIC_ASSERT’
>   2282 |     XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) == sizeof(XXH32_hash_t));
>        |     ^~~~~~~~~~~~~~~~~
> 
> ... and later:
> 
> ../src/algo_xxhash.h:2282: undefined reference to `static_assert'
> 
> Signed-off-by: Andreas Ziegler <br015@umbiko.net>
> ---
>   ...lgo_xxhash-add-missing-static_assert-macro.patch | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
>   create mode 100644 package/lighttpd/0002-algo_xxhash-add-missing-static_assert-macro.patch
> 
> diff --git a/package/lighttpd/0002-algo_xxhash-add-missing-static_assert-macro.patch b/package/lighttpd/0002-algo_xxhash-add-missing-static_assert-macro.patch
> new file mode 100644
> index 0000000000..1fc8ca3afe
> --- /dev/null
> +++ b/package/lighttpd/0002-algo_xxhash-add-missing-static_assert-macro.patch
> @@ -0,0 +1,13 @@

  The patch should have a commit message including a signed-off-by, and 
preferably be git formatted. It should also have a reference to the upstream bug 
report or MR or commit.

  I've added that and applied to master, thanks.

  Regards,
  Arnout

> +--- lighttpd-1.4.63/src/algo_xxhash.h	2021-12-04 15:40:24.000000000 +0100
> ++++ lighttpd-1.4.64/src/algo_xxhash.h	2021-12-15 10:50:17.801155007 +0100
> +@@ -1563,6 +1563,10 @@
> + #ifndef XXH_STATIC_ASSERT
> + #  if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)    /* C11 */
> + #    include <assert.h>
> ++/* uClibc does not define static_assert */
> ++#    ifndef static_assert
> ++#      define static_assert _Static_assert
> ++#    endif
> + #    define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0)
> + #  elif defined(__cplusplus) && (__cplusplus >= 201103L)            /* C++11 */
> + #    define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0)
>
Arnout Vandecappelle Dec. 16, 2021, 6:57 p.m. UTC | #2
On 16/12/2021 19:52, Arnout Vandecappelle wrote:
>  Hi Andreas,
>
> On 15/12/2021 14:54, Andreas Ziegler wrote:
>> Fixes build failure in toolchains using uClibc:
>>
>> In file included from ../src/algo_xxhash.c:48:
>> ../src/algo_xxhash.h: In function ‘XXH32_canonicalFromHash’:
>> ../src/algo_xxhash.h:1566:54: warning: implicit declaration of function 
>> ‘static_assert’ [-Wimplicit-function-declaration]
>>   1566 | #    define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { 
>> static_assert((c),m); } while(0)
>>        | ^~~~~~~~~~~~~
>> ../src/algo_xxhash.h:1572:32: note: in expansion of macro 
>> ‘XXH_STATIC_ASSERT_WITH_MESSAGE’
>>   1572 | #  define XXH_STATIC_ASSERT(c) XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
>>        | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> ../src/algo_xxhash.h:2282:5: note: in expansion of macro ‘XXH_STATIC_ASSERT’
>>   2282 |     XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) == 
>> sizeof(XXH32_hash_t));
>>        |     ^~~~~~~~~~~~~~~~~
>>
>> ... and later:
>>
>> ../src/algo_xxhash.h:2282: undefined reference to `static_assert'
>>
>> Signed-off-by: Andreas Ziegler <br015@umbiko.net>
>> ---
>>   ...lgo_xxhash-add-missing-static_assert-macro.patch | 13 +++++++++++++
>>   1 file changed, 13 insertions(+)
>>   create mode 100644 
>> package/lighttpd/0002-algo_xxhash-add-missing-static_assert-macro.patch
>>
>> diff --git 
>> a/package/lighttpd/0002-algo_xxhash-add-missing-static_assert-macro.patch 
>> b/package/lighttpd/0002-algo_xxhash-add-missing-static_assert-macro.patch
>> new file mode 100644
>> index 0000000000..1fc8ca3afe
>> --- /dev/null
>> +++ b/package/lighttpd/0002-algo_xxhash-add-missing-static_assert-macro.patch
>> @@ -0,0 +1,13 @@
>
>  The patch should have a commit message including a signed-off-by, and 
> preferably be git formatted. It should also have a reference to the upstream 
> bug report or MR or commit.
>
>  I've added that and applied to master, thanks.

  Actually, scratch that. Fabrice submitted a patch series that instead 
unbundles xxhash, so I'm going to apply that one.


  Regards,
  Arnout


>
>  Regards,
>  Arnout
>
>> +--- lighttpd-1.4.63/src/algo_xxhash.h 2021-12-04 15:40:24.000000000 +0100
>> ++++ lighttpd-1.4.64/src/algo_xxhash.h    2021-12-15 10:50:17.801155007 +0100
>> +@@ -1563,6 +1563,10 @@
>> + #ifndef XXH_STATIC_ASSERT
>> + #  if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)    /* C11 */
>> + #    include <assert.h>
>> ++/* uClibc does not define static_assert */
>> ++#    ifndef static_assert
>> ++#      define static_assert _Static_assert
>> ++#    endif
>> + #    define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); 
>> } while(0)
>> + #  elif defined(__cplusplus) && (__cplusplus >= 201103L)            /* 
>> C++11 */
>> + #    define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); 
>> } while(0)
>>
diff mbox series

Patch

diff --git a/package/lighttpd/0002-algo_xxhash-add-missing-static_assert-macro.patch b/package/lighttpd/0002-algo_xxhash-add-missing-static_assert-macro.patch
new file mode 100644
index 0000000000..1fc8ca3afe
--- /dev/null
+++ b/package/lighttpd/0002-algo_xxhash-add-missing-static_assert-macro.patch
@@ -0,0 +1,13 @@ 
+--- lighttpd-1.4.63/src/algo_xxhash.h	2021-12-04 15:40:24.000000000 +0100
++++ lighttpd-1.4.64/src/algo_xxhash.h	2021-12-15 10:50:17.801155007 +0100
+@@ -1563,6 +1563,10 @@
+ #ifndef XXH_STATIC_ASSERT
+ #  if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)    /* C11 */
+ #    include <assert.h>
++/* uClibc does not define static_assert */
++#    ifndef static_assert
++#      define static_assert _Static_assert
++#    endif
+ #    define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0)
+ #  elif defined(__cplusplus) && (__cplusplus >= 201103L)            /* C++11 */
+ #    define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0)