Blob Blame History Raw
From 381f4ded3592163e30c45ac9064a065fdbbd8c49 Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Sun, 20 Oct 2019 22:01:15 +0200
Subject: [PATCH 74/76] xlat: update V4L2_COLORSPACE_* constants

* xlat/v4l2_colorspaces.in: Add #value_indexed.
(V4L2_COLORSPACE_DEFAULT): New constant introduced by Linux commit
v4.2-rc1~107^2~184.
(V4L2_COLORSPACE_ADOBERGB): Rename to V4L2_COLORSPACE_OPRGB, per Linux
commit v4.20-rc1~69^2~122.
(V4L2_COLORSPACE_SMPTE170M, V4L2_COLORSPACE_SMPTE240M,
V4L2_COLORSPACE_REC709, V4L2_COLORSPACE_BT878,
V4L2_COLORSPACE_470_SYSTEM_M, V4L2_COLORSPACE_470_SYSTEM_BG,
V4L2_COLORSPACE_JPEG, V4L2_COLORSPACE_SRGB, V4L2_COLORSPACE_OPRGB,
V4L2_COLORSPACE_BT2020, V4L2_COLORSPACE_RAW, V4L2_COLORSPACE_DCI_P3):
Add fallback definitions.
---
 xlat/v4l2_colorspaces.in | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

Index: strace-5.1/xlat/v4l2_colorspaces.in
===================================================================
--- strace-5.1.orig/xlat/v4l2_colorspaces.in	2017-04-07 03:21:36.000000000 +0200
+++ strace-5.1/xlat/v4l2_colorspaces.in	2020-01-29 12:40:34.307117739 +0100
@@ -1,12 +1,14 @@
-V4L2_COLORSPACE_SMPTE170M
-V4L2_COLORSPACE_SMPTE240M
-V4L2_COLORSPACE_REC709
-V4L2_COLORSPACE_BT878
-V4L2_COLORSPACE_470_SYSTEM_M
-V4L2_COLORSPACE_470_SYSTEM_BG
-V4L2_COLORSPACE_JPEG
-V4L2_COLORSPACE_SRGB
-V4L2_COLORSPACE_ADOBERGB
-V4L2_COLORSPACE_BT2020
-V4L2_COLORSPACE_RAW
-V4L2_COLORSPACE_DCI_P3
+#value_indexed
+V4L2_COLORSPACE_DEFAULT		0
+V4L2_COLORSPACE_SMPTE170M	1
+V4L2_COLORSPACE_SMPTE240M	2
+V4L2_COLORSPACE_REC709		3
+V4L2_COLORSPACE_BT878		4
+V4L2_COLORSPACE_470_SYSTEM_M	5
+V4L2_COLORSPACE_470_SYSTEM_BG	6
+V4L2_COLORSPACE_JPEG		7
+V4L2_COLORSPACE_SRGB		8
+V4L2_COLORSPACE_OPRGB		9
+V4L2_COLORSPACE_BT2020		10
+V4L2_COLORSPACE_RAW		11
+V4L2_COLORSPACE_DCI_P3		12
Index: strace-5.1/xlat/v4l2_colorspaces.h
===================================================================
--- strace-5.1.orig/xlat/v4l2_colorspaces.h	2019-05-22 15:08:31.000000000 +0200
+++ strace-5.1/xlat/v4l2_colorspaces.h	2020-01-29 12:41:11.073762718 +0100
@@ -3,55 +3,123 @@
 #include "gcc_compat.h"
 #include "static_assert.h"
 
-
-#ifndef XLAT_MACROS_ONLY
-
-# ifdef IN_MPERS
-
-extern const struct xlat v4l2_colorspaces[];
-
-# else
-
-#  if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
-static
-#  endif
-const struct xlat v4l2_colorspaces[] = {
+#if defined(V4L2_COLORSPACE_DEFAULT) || (defined(HAVE_DECL_V4L2_COLORSPACE_DEFAULT) && HAVE_DECL_V4L2_COLORSPACE_DEFAULT)
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_COLORSPACE_DEFAULT) == (0), "V4L2_COLORSPACE_DEFAULT != 0");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_COLORSPACE_DEFAULT 0
+#endif
 #if defined(V4L2_COLORSPACE_SMPTE170M) || (defined(HAVE_DECL_V4L2_COLORSPACE_SMPTE170M) && HAVE_DECL_V4L2_COLORSPACE_SMPTE170M)
-  XLAT(V4L2_COLORSPACE_SMPTE170M),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_COLORSPACE_SMPTE170M) == (1), "V4L2_COLORSPACE_SMPTE170M != 1");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_COLORSPACE_SMPTE170M 1
 #endif
 #if defined(V4L2_COLORSPACE_SMPTE240M) || (defined(HAVE_DECL_V4L2_COLORSPACE_SMPTE240M) && HAVE_DECL_V4L2_COLORSPACE_SMPTE240M)
-  XLAT(V4L2_COLORSPACE_SMPTE240M),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_COLORSPACE_SMPTE240M) == (2), "V4L2_COLORSPACE_SMPTE240M != 2");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_COLORSPACE_SMPTE240M 2
 #endif
 #if defined(V4L2_COLORSPACE_REC709) || (defined(HAVE_DECL_V4L2_COLORSPACE_REC709) && HAVE_DECL_V4L2_COLORSPACE_REC709)
-  XLAT(V4L2_COLORSPACE_REC709),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_COLORSPACE_REC709) == (3), "V4L2_COLORSPACE_REC709 != 3");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_COLORSPACE_REC709 3
 #endif
 #if defined(V4L2_COLORSPACE_BT878) || (defined(HAVE_DECL_V4L2_COLORSPACE_BT878) && HAVE_DECL_V4L2_COLORSPACE_BT878)
-  XLAT(V4L2_COLORSPACE_BT878),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_COLORSPACE_BT878) == (4), "V4L2_COLORSPACE_BT878 != 4");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_COLORSPACE_BT878 4
 #endif
 #if defined(V4L2_COLORSPACE_470_SYSTEM_M) || (defined(HAVE_DECL_V4L2_COLORSPACE_470_SYSTEM_M) && HAVE_DECL_V4L2_COLORSPACE_470_SYSTEM_M)
-  XLAT(V4L2_COLORSPACE_470_SYSTEM_M),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_COLORSPACE_470_SYSTEM_M) == (5), "V4L2_COLORSPACE_470_SYSTEM_M != 5");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_COLORSPACE_470_SYSTEM_M 5
 #endif
 #if defined(V4L2_COLORSPACE_470_SYSTEM_BG) || (defined(HAVE_DECL_V4L2_COLORSPACE_470_SYSTEM_BG) && HAVE_DECL_V4L2_COLORSPACE_470_SYSTEM_BG)
-  XLAT(V4L2_COLORSPACE_470_SYSTEM_BG),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_COLORSPACE_470_SYSTEM_BG) == (6), "V4L2_COLORSPACE_470_SYSTEM_BG != 6");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_COLORSPACE_470_SYSTEM_BG 6
 #endif
 #if defined(V4L2_COLORSPACE_JPEG) || (defined(HAVE_DECL_V4L2_COLORSPACE_JPEG) && HAVE_DECL_V4L2_COLORSPACE_JPEG)
-  XLAT(V4L2_COLORSPACE_JPEG),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_COLORSPACE_JPEG) == (7), "V4L2_COLORSPACE_JPEG != 7");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_COLORSPACE_JPEG 7
 #endif
 #if defined(V4L2_COLORSPACE_SRGB) || (defined(HAVE_DECL_V4L2_COLORSPACE_SRGB) && HAVE_DECL_V4L2_COLORSPACE_SRGB)
-  XLAT(V4L2_COLORSPACE_SRGB),
-#endif
-#if defined(V4L2_COLORSPACE_ADOBERGB) || (defined(HAVE_DECL_V4L2_COLORSPACE_ADOBERGB) && HAVE_DECL_V4L2_COLORSPACE_ADOBERGB)
-  XLAT(V4L2_COLORSPACE_ADOBERGB),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_COLORSPACE_SRGB) == (8), "V4L2_COLORSPACE_SRGB != 8");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_COLORSPACE_SRGB 8
+#endif
+#if defined(V4L2_COLORSPACE_OPRGB) || (defined(HAVE_DECL_V4L2_COLORSPACE_OPRGB) && HAVE_DECL_V4L2_COLORSPACE_OPRGB)
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_COLORSPACE_OPRGB) == (9), "V4L2_COLORSPACE_OPRGB != 9");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_COLORSPACE_OPRGB 9
 #endif
 #if defined(V4L2_COLORSPACE_BT2020) || (defined(HAVE_DECL_V4L2_COLORSPACE_BT2020) && HAVE_DECL_V4L2_COLORSPACE_BT2020)
-  XLAT(V4L2_COLORSPACE_BT2020),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_COLORSPACE_BT2020) == (10), "V4L2_COLORSPACE_BT2020 != 10");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_COLORSPACE_BT2020 10
 #endif
 #if defined(V4L2_COLORSPACE_RAW) || (defined(HAVE_DECL_V4L2_COLORSPACE_RAW) && HAVE_DECL_V4L2_COLORSPACE_RAW)
-  XLAT(V4L2_COLORSPACE_RAW),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_COLORSPACE_RAW) == (11), "V4L2_COLORSPACE_RAW != 11");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_COLORSPACE_RAW 11
 #endif
 #if defined(V4L2_COLORSPACE_DCI_P3) || (defined(HAVE_DECL_V4L2_COLORSPACE_DCI_P3) && HAVE_DECL_V4L2_COLORSPACE_DCI_P3)
-  XLAT(V4L2_COLORSPACE_DCI_P3),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_COLORSPACE_DCI_P3) == (12), "V4L2_COLORSPACE_DCI_P3 != 12");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_COLORSPACE_DCI_P3 12
 #endif
+
+#ifndef XLAT_MACROS_ONLY
+
+# ifdef IN_MPERS
+
+extern const struct xlat v4l2_colorspaces[];
+
+# else
+
+#  if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+#  endif
+const struct xlat v4l2_colorspaces[] = {
+ [V4L2_COLORSPACE_DEFAULT] = XLAT(V4L2_COLORSPACE_DEFAULT),
+ [V4L2_COLORSPACE_SMPTE170M] = XLAT(V4L2_COLORSPACE_SMPTE170M),
+ [V4L2_COLORSPACE_SMPTE240M] = XLAT(V4L2_COLORSPACE_SMPTE240M),
+ [V4L2_COLORSPACE_REC709] = XLAT(V4L2_COLORSPACE_REC709),
+ [V4L2_COLORSPACE_BT878] = XLAT(V4L2_COLORSPACE_BT878),
+ [V4L2_COLORSPACE_470_SYSTEM_M] = XLAT(V4L2_COLORSPACE_470_SYSTEM_M),
+ [V4L2_COLORSPACE_470_SYSTEM_BG] = XLAT(V4L2_COLORSPACE_470_SYSTEM_BG),
+ [V4L2_COLORSPACE_JPEG] = XLAT(V4L2_COLORSPACE_JPEG),
+ [V4L2_COLORSPACE_SRGB] = XLAT(V4L2_COLORSPACE_SRGB),
+ [V4L2_COLORSPACE_OPRGB] = XLAT(V4L2_COLORSPACE_OPRGB),
+ [V4L2_COLORSPACE_BT2020] = XLAT(V4L2_COLORSPACE_BT2020),
+ [V4L2_COLORSPACE_RAW] = XLAT(V4L2_COLORSPACE_RAW),
+ [V4L2_COLORSPACE_DCI_P3] = XLAT(V4L2_COLORSPACE_DCI_P3),
  XLAT_END
 };