0004-Fix-uClibc-build.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. From 09ce52fe375a6fc1ccf51b6b691aaa2c3f53fbd5 Mon Sep 17 00:00:00 2001
  2. From: Bernd Kuhls <bernd.kuhls@t-online.de>
  3. Date: Fri, 3 Jun 2022 16:26:03 +0200
  4. Subject: [PATCH] Fix uClibc build
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. Fixes build errors with uClibc and gcc-9.3.0:
  9. ../src/gallium/drivers/lima/lima_texture.c:47:15: error: expected
  10. declaration specifiers or ‘...’ before ‘__builtin_offsetof’
  11. 47 | static_assert(offsetof(lima_tex_desc, va) == 24,
  12. "lima_tex_desc->va offset isn't 24");
  13. ../src/egl/main/egldisplay.c: In function ‘_eglGetNativePlatformFromEnv’:
  14. ../src/egl/main/egldisplay.c:101:4: error: implicit declaration of
  15. function ‘static_assert’ [-Werror=implicit-function-declaration] 101 |
  16. static_assert(ARRAY_SIZE(egl_platforms) == _EGL_NUM_PLATFORMS,
  17. ../src/util/macros.h:74:4: error: implicit declaration of function
  18. ‘static_assert’ [-Werror=implicit-function-declaration]
  19. 74 | static_assert(cond, #cond); \
  20. | ^~~~~~~~~~~~~
  21. Upstream: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13898
  22. Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  23. ---
  24. src/util/compiler.h | 10 ++++++++++
  25. src/util/macros.h | 1 +
  26. 2 files changed, 11 insertions(+)
  27. diff --git a/src/util/compiler.h b/src/util/compiler.h
  28. index d184ad455af..b5c56807acc 100644
  29. --- a/src/util/compiler.h
  30. +++ b/src/util/compiler.h
  31. @@ -36,6 +36,16 @@
  32. #include <assert.h>
  33. +/*
  34. + * C11 static_assert() macro
  35. + * assert.h only defines that name for C11 and above
  36. + */
  37. +#if !defined(__cplusplus)
  38. +#ifndef static_assert
  39. +#define static_assert _Static_assert
  40. +#endif
  41. +#endif
  42. +
  43. #include "util/macros.h"
  44. diff --git a/src/util/macros.h b/src/util/macros.h
  45. index 22b18303826..8f73ee72693 100644
  46. --- a/src/util/macros.h
  47. +++ b/src/util/macros.h
  48. @@ -27,6 +27,7 @@
  49. #include <stddef.h>
  50. #include <stdint.h>
  51. #include <stdio.h>
  52. +#include "util/compiler.h"
  53. /* Compute the size of an array */
  54. #ifndef ARRAY_SIZE
  55. --
  56. 2.34.1