[libcamera-devel] [PATCH] libcamera: media_object: Undef major/minor system macros
Kieran Bingham
kieran.bingham at ideasonboard.com
Mon Jan 7 16:54:27 CET 2019
GCC 7.3.0 defines conflicting macros within <sys/types.h> which are
deprecated and removed in later versions.
To support compilation with this toolchain, ensure that any previous
definition is removed before the class definitions.
Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
src/libcamera/include/media_object.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/libcamera/include/media_object.h b/src/libcamera/include/media_object.h
index 950a33286690..00772fd11234 100644
--- a/src/libcamera/include/media_object.h
+++ b/src/libcamera/include/media_object.h
@@ -12,6 +12,15 @@
#include <linux/media.h>
+/*
+ * In the GNU C Library, "major" and "minor" are defined by <sys/sysmacros.h>.
+ * GCC 7.3.0 also defines this in <sys/types.h> for historical compatibility.
+ * To prevent conflicting with the major() and minor() member functions we
+ * unconditionally undef these here.
+ */
+#undef major
+#undef minor
+
namespace libcamera {
class MediaDevice;
--
2.17.1
More information about the libcamera-devel
mailing list