nbdkit/0014-common-include-test-ar...

65 lines
2.5 KiB
Diff

From 47d80b6020a739e9f005de24d4928721854da8dc Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 7 Jul 2022 14:06:25 +0100
Subject: [PATCH] common/include/test-array-size.c: Avoid Clang warning
On Clang with warn-error enabled:
test-array-size.c:44:20: error: variable 's0' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
static const char *s0[] = { };
^
test-array-size.c:45:20: error: variable 's1' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
static const char *s1[] = { "a" };
^
(etc)
Updates: commit 0fa23df5cd5dc97a55857416ea81d5de6d867c18
(cherry picked from commit 90f5dbf78bb56cb00d6b3c58fa0a9b390d50e25e)
---
common/include/test-array-size.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/common/include/test-array-size.c b/common/include/test-array-size.c
index d77ba3c9..1ce2142c 100644
--- a/common/include/test-array-size.c
+++ b/common/include/test-array-size.c
@@ -41,19 +41,21 @@
struct st { const char *s; int i; };
-static const char *s0[] = { };
-static const char *s1[] = { "a" };
-static const char *s3[] = { "a", "b", "c" };
-static const char *s4[4] = { "a", "b", "c", "d" };
-static int i0[] = { };
-static int i1[] = { 1 };
-static int i3[] = { 1, 2, 3 };
-static int i4[4] = { 1, 2, 3, 4 };
-static struct st st0[] = { };
-static struct st st1[] = { { "a", 1 } };
-static struct st st3[] = { { "a", 1 }, { "b", 2 }, { "c", 3 } };
-static struct st st4[4] = { { "a", 1 }, { "b", 2 }, { "c", 3 }, { "d", 4 } };
-static struct st st4_0[4];
+static const char *s0[] __attribute__((__unused__)) = { };
+static const char *s1[] __attribute__((__unused__)) = { "a" };
+static const char *s3[] __attribute__((__unused__)) = { "a", "b", "c" };
+static const char *s4[4] __attribute__((__unused__)) = { "a", "b", "c", "d" };
+static int i0[] __attribute__((__unused__)) = { };
+static int i1[] __attribute__((__unused__)) = { 1 };
+static int i3[] __attribute__((__unused__)) = { 1, 2, 3 };
+static int i4[4] __attribute__((__unused__)) = { 1, 2, 3, 4 };
+static struct st st0[] __attribute__((__unused__)) = { };
+static struct st st1[] __attribute__((__unused__)) = { { "a", 1 } };
+static struct st st3[] __attribute__((__unused__)) =
+ { { "a", 1 }, { "b", 2 }, { "c", 3 } };
+static struct st st4[4] __attribute__((__unused__)) =
+ { { "a", 1 }, { "b", 2 }, { "c", 3 }, { "d", 4 } };
+static struct st st4_0[4] __attribute__((__unused__));
int
main (void)
--
2.31.1