Blob Blame History Raw
From 300b952c68a991eca56d31b044bd9643028ee46b Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Sun, 20 Oct 2019 21:06:28 +0200
Subject: [PATCH 73/76] xlat: Provide fallback definitions for V4L2_FIELD_*
 constants

* xlat/v4l2_fields.in: Add fallback definitions for constants.
---
 xlat/v4l2_fields.in | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

Index: strace-5.1/xlat/v4l2_fields.in
===================================================================
--- strace-5.1.orig/xlat/v4l2_fields.in	2014-11-04 16:27:31.000000000 +0100
+++ strace-5.1/xlat/v4l2_fields.in	2020-01-29 12:40:10.613338727 +0100
@@ -1,10 +1,11 @@
-V4L2_FIELD_ANY
-V4L2_FIELD_NONE
-V4L2_FIELD_TOP
-V4L2_FIELD_BOTTOM
-V4L2_FIELD_INTERLACED
-V4L2_FIELD_SEQ_TB
-V4L2_FIELD_SEQ_BT
-V4L2_FIELD_ALTERNATE
-V4L2_FIELD_INTERLACED_TB
-V4L2_FIELD_INTERLACED_BT
+#value_indexed
+V4L2_FIELD_ANY			0
+V4L2_FIELD_NONE			1
+V4L2_FIELD_TOP			2
+V4L2_FIELD_BOTTOM		3
+V4L2_FIELD_INTERLACED		4
+V4L2_FIELD_SEQ_TB		5
+V4L2_FIELD_SEQ_BT		6
+V4L2_FIELD_ALTERNATE		7
+V4L2_FIELD_INTERLACED_TB	8
+V4L2_FIELD_INTERLACED_BT	9
Index: strace-5.1/xlat/v4l2_fields.h
===================================================================
--- strace-5.1.orig/xlat/v4l2_fields.h	2019-05-22 15:08:31.000000000 +0200
+++ strace-5.1/xlat/v4l2_fields.h	2020-01-29 12:40:18.817263422 +0100
@@ -3,49 +3,99 @@
 #include "gcc_compat.h"
 #include "static_assert.h"
 
-
-#ifndef XLAT_MACROS_ONLY
-
-# ifdef IN_MPERS
-
-extern const struct xlat v4l2_fields[];
-
-# else
-
-#  if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
-static
-#  endif
-const struct xlat v4l2_fields[] = {
 #if defined(V4L2_FIELD_ANY) || (defined(HAVE_DECL_V4L2_FIELD_ANY) && HAVE_DECL_V4L2_FIELD_ANY)
-  XLAT(V4L2_FIELD_ANY),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_FIELD_ANY) == (0), "V4L2_FIELD_ANY != 0");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_FIELD_ANY 0
 #endif
 #if defined(V4L2_FIELD_NONE) || (defined(HAVE_DECL_V4L2_FIELD_NONE) && HAVE_DECL_V4L2_FIELD_NONE)
-  XLAT(V4L2_FIELD_NONE),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_FIELD_NONE) == (1), "V4L2_FIELD_NONE != 1");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_FIELD_NONE 1
 #endif
 #if defined(V4L2_FIELD_TOP) || (defined(HAVE_DECL_V4L2_FIELD_TOP) && HAVE_DECL_V4L2_FIELD_TOP)
-  XLAT(V4L2_FIELD_TOP),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_FIELD_TOP) == (2), "V4L2_FIELD_TOP != 2");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_FIELD_TOP 2
 #endif
 #if defined(V4L2_FIELD_BOTTOM) || (defined(HAVE_DECL_V4L2_FIELD_BOTTOM) && HAVE_DECL_V4L2_FIELD_BOTTOM)
-  XLAT(V4L2_FIELD_BOTTOM),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_FIELD_BOTTOM) == (3), "V4L2_FIELD_BOTTOM != 3");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_FIELD_BOTTOM 3
 #endif
 #if defined(V4L2_FIELD_INTERLACED) || (defined(HAVE_DECL_V4L2_FIELD_INTERLACED) && HAVE_DECL_V4L2_FIELD_INTERLACED)
-  XLAT(V4L2_FIELD_INTERLACED),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_FIELD_INTERLACED) == (4), "V4L2_FIELD_INTERLACED != 4");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_FIELD_INTERLACED 4
 #endif
 #if defined(V4L2_FIELD_SEQ_TB) || (defined(HAVE_DECL_V4L2_FIELD_SEQ_TB) && HAVE_DECL_V4L2_FIELD_SEQ_TB)
-  XLAT(V4L2_FIELD_SEQ_TB),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_FIELD_SEQ_TB) == (5), "V4L2_FIELD_SEQ_TB != 5");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_FIELD_SEQ_TB 5
 #endif
 #if defined(V4L2_FIELD_SEQ_BT) || (defined(HAVE_DECL_V4L2_FIELD_SEQ_BT) && HAVE_DECL_V4L2_FIELD_SEQ_BT)
-  XLAT(V4L2_FIELD_SEQ_BT),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_FIELD_SEQ_BT) == (6), "V4L2_FIELD_SEQ_BT != 6");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_FIELD_SEQ_BT 6
 #endif
 #if defined(V4L2_FIELD_ALTERNATE) || (defined(HAVE_DECL_V4L2_FIELD_ALTERNATE) && HAVE_DECL_V4L2_FIELD_ALTERNATE)
-  XLAT(V4L2_FIELD_ALTERNATE),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_FIELD_ALTERNATE) == (7), "V4L2_FIELD_ALTERNATE != 7");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_FIELD_ALTERNATE 7
 #endif
 #if defined(V4L2_FIELD_INTERLACED_TB) || (defined(HAVE_DECL_V4L2_FIELD_INTERLACED_TB) && HAVE_DECL_V4L2_FIELD_INTERLACED_TB)
-  XLAT(V4L2_FIELD_INTERLACED_TB),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_FIELD_INTERLACED_TB) == (8), "V4L2_FIELD_INTERLACED_TB != 8");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_FIELD_INTERLACED_TB 8
 #endif
 #if defined(V4L2_FIELD_INTERLACED_BT) || (defined(HAVE_DECL_V4L2_FIELD_INTERLACED_BT) && HAVE_DECL_V4L2_FIELD_INTERLACED_BT)
-  XLAT(V4L2_FIELD_INTERLACED_BT),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_FIELD_INTERLACED_BT) == (9), "V4L2_FIELD_INTERLACED_BT != 9");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_FIELD_INTERLACED_BT 9
 #endif
+
+#ifndef XLAT_MACROS_ONLY
+
+# ifdef IN_MPERS
+
+extern const struct xlat v4l2_fields[];
+
+# else
+
+#  if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+#  endif
+const struct xlat v4l2_fields[] = {
+ [V4L2_FIELD_ANY] = XLAT(V4L2_FIELD_ANY),
+ [V4L2_FIELD_NONE] = XLAT(V4L2_FIELD_NONE),
+ [V4L2_FIELD_TOP] = XLAT(V4L2_FIELD_TOP),
+ [V4L2_FIELD_BOTTOM] = XLAT(V4L2_FIELD_BOTTOM),
+ [V4L2_FIELD_INTERLACED] = XLAT(V4L2_FIELD_INTERLACED),
+ [V4L2_FIELD_SEQ_TB] = XLAT(V4L2_FIELD_SEQ_TB),
+ [V4L2_FIELD_SEQ_BT] = XLAT(V4L2_FIELD_SEQ_BT),
+ [V4L2_FIELD_ALTERNATE] = XLAT(V4L2_FIELD_ALTERNATE),
+ [V4L2_FIELD_INTERLACED_TB] = XLAT(V4L2_FIELD_INTERLACED_TB),
+ [V4L2_FIELD_INTERLACED_BT] = XLAT(V4L2_FIELD_INTERLACED_BT),
  XLAT_END
 };