0002-Fix-static_assert-build-failure-with-C-version-11.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. From 5fafd1a33e9442811074604eeaa060578e589730 Mon Sep 17 00:00:00 2001
  2. From: Giulio Benetti <giulio.benetti@benettiengineering.com>
  3. Date: Fri, 4 Apr 2025 22:17:49 +0200
  4. Subject: [PATCH] Fix static_assert build failure with C++ version < 11
  5. At the moment build fails due to lack of static_assert:
  6. https://gitlab.com/jolivain/buildroot/-/jobs/9606292537
  7. this means that the check per date is not enough, so let's use meson to
  8. check if static_assert() is present or not and simplify
  9. fuse_static_assert() definition by only checking HAVE_STATIC_ASSERT.
  10. Upstream: https://github.com/libfuse/libfuse/pull/1189
  11. Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
  12. ---
  13. include/fuse_common.h | 4 +---
  14. meson.build | 2 +-
  15. 2 files changed, 2 insertions(+), 4 deletions(-)
  16. diff --git a/include/fuse_common.h b/include/fuse_common.h
  17. index 77efc5d..582505f 100644
  18. --- a/include/fuse_common.h
  19. +++ b/include/fuse_common.h
  20. @@ -30,9 +30,7 @@
  21. #define FUSE_MAKE_VERSION(maj, min) ((maj) * 100 + (min))
  22. #define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION)
  23. -#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
  24. - (!defined(__cplusplus) && defined(__STDC_VERSION__) && \
  25. - __STDC_VERSION__ >= 201112L)
  26. +#ifdef HAVE_STATIC_ASSERT
  27. #define fuse_static_assert(condition, message) static_assert(condition, message)
  28. #else
  29. #define fuse_static_assert(condition, message)
  30. diff --git a/meson.build b/meson.build
  31. index 96c655c..bab98da 100644
  32. --- a/meson.build
  33. +++ b/meson.build
  34. @@ -72,7 +72,7 @@ private_cfg.set_quoted('PACKAGE_VERSION', meson.project_version())
  35. # Test for presence of some functions
  36. test_funcs = [ 'fork', 'fstatat', 'openat', 'readlinkat', 'pipe2',
  37. 'splice', 'vmsplice', 'posix_fallocate', 'fdatasync',
  38. - 'utimensat', 'copy_file_range', 'fallocate' ]
  39. + 'utimensat', 'copy_file_range', 'fallocate', 'static_assert' ]
  40. foreach func : test_funcs
  41. private_cfg.set('HAVE_' + func.to_upper(),
  42. cc.has_function(func, prefix: include_default, args: args_default))
  43. --
  44. 2.39.5