summaryrefslogtreecommitdiff
path: root/libsigrokdecode-internal.h
diff options
context:
space:
mode:
authorGerhard Sittig <gerhard.sittig@gmx.net>2021-12-25 19:50:43 +0100
committerGerhard Sittig <gerhard.sittig@gmx.net>2021-12-26 13:45:09 +0100
commit3db0d9750d6947080ae1cfe4ba1108a1687cf24f (patch)
treef13eefffec95be15325551ed64085a2af0c3fc92 /libsigrokdecode-internal.h
parenta6a5e2c8b0e9ecf5d69d0c237c8e8b717b82b36f (diff)
downloadlibsigrokdecode-3db0d9750d6947080ae1cfe4ba1108a1687cf24f.tar.gz
libsigrokdecode-3db0d9750d6947080ae1cfe4ba1108a1687cf24f.zip
internal: introduce ALL_ZERO declaration, modelled after libsigrok
Declare ALL_ZERO in the common libsigrokdecode-internal.h header file. The implementation and the comment on its motivation were taken from the libsigrok implementation, slightly rephrased for improved readability.
Diffstat (limited to 'libsigrokdecode-internal.h')
-rw-r--r--libsigrokdecode-internal.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/libsigrokdecode-internal.h b/libsigrokdecode-internal.h
index 329a10a..453e14b 100644
--- a/libsigrokdecode-internal.h
+++ b/libsigrokdecode-internal.h
@@ -27,6 +27,17 @@
#include <Python.h> /* First, so we avoid a _POSIX_C_SOURCE warning. */
#include "libsigrokdecode.h"
+/*
+ * Static definition of tables ending with an all-zero sentinel entry
+ * may raise warnings when compiling with -Wmissing-field-initializers.
+ * GCC suppresses the warning only with { 0 }, clang wants { } instead.
+ */
+#ifdef __clang__
+# define ALL_ZERO { }
+#else
+# define ALL_ZERO { 0 }
+#endif
+
enum {
SRD_TERM_ALWAYS_FALSE,
SRD_TERM_HIGH,