[PATCH] libcamera: base: Don't redefine __nodiscard
Mattijs Korpershoek
mkorpershoek at baylibre.com
Fri Jan 3 15:02:50 CET 2025
Some libc implementations (like bionic) already define the __nodiscard
macro [1].
Building with bionic results in compiler error since libcamera redefines
the __nodiscard macro.
Don't redefine __nodiscard if it's already defined.
[1] https://android-review.googlesource.com/c/platform/bionic/+/3254860
Signed-off-by: Mattijs Korpershoek <mkorpershoek at baylibre.com>
---
Hi, it's been a while. I've found a (trivial) build issue when
building against recent bionic versions.
I hope this is the right fix. Thanks for your review!
---
include/libcamera/base/compiler.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/libcamera/base/compiler.h b/include/libcamera/base/compiler.h
index fda8fdfdc543f86c5554e38ef790c00d72d60389..946e20d835b216446e4099b6ab6865638d9aaf26 100644
--- a/include/libcamera/base/compiler.h
+++ b/include/libcamera/base/compiler.h
@@ -7,8 +7,10 @@
#pragma once
+#ifndef __nodiscard
#if __cplusplus >= 201703L
#define __nodiscard [[nodiscard]]
#else
#define __nodiscard
#endif
+#endif
---
base-commit: 35ed4b91291d9f3d08e4b51acfb51163e65df8f8
change-id: 20250103-nodiscard-redef-9158e8fdc3f5
Best regards,
--
Mattijs Korpershoek <mkorpershoek at baylibre.com>
More information about the libcamera-devel
mailing list