0003-Fix-uClibc-build.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. [rebased for 23.2.0]
  24. Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
  25. ---
  26. src/util/compiler.h | 10 ++++++++++
  27. src/util/macros.h | 1 +
  28. 2 files changed, 11 insertions(+)
  29. diff --git a/src/util/compiler.h b/src/util/compiler.h
  30. index d184ad455af..b5c56807acc 100644
  31. --- a/src/util/compiler.h
  32. +++ b/src/util/compiler.h
  33. @@ -35,6 +35,17 @@
  34. #include <assert.h>
  35. +
  36. +/*
  37. + * C11 static_assert() macro
  38. + * assert.h only defines that name for C11 and above
  39. + */
  40. +#if !defined(__cplusplus)
  41. +#ifndef static_assert
  42. +#define static_assert _Static_assert
  43. +#endif
  44. +#endif
  45. +
  46. #include <limits.h>
  47. #include <stdarg.h>
  48. #include <stdbool.h>
  49. diff --git a/src/util/macros.h b/src/util/macros.h
  50. index 22b18303826..8f73ee72693 100644
  51. --- a/src/util/macros.h
  52. +++ b/src/util/macros.h
  53. @@ -31,6 +31,7 @@
  54. #include <stddef.h>
  55. #include <stdint.h>
  56. #include <stdio.h>
  57. +#include "util/compiler.h"
  58. #ifdef _GAMING_XBOX
  59. #define strdup _strdup
  60. --
  61. 2.34.1