SHA256
1
0
forked from pool/libisds
libisds/tests-Fix-building-with-GCC-10.patch

55 lines
1.6 KiB
Diff

From: =?utf8?q?Petr=20P=C3=ADsa=C5=99?= <petr.pisar@atlas.cz>
Date: Wed, 22 Jan 2020 19:13:50 +0100
Subject: [PATCH 1/1] tests: Fix building with GCC 10
Git-commit: ce92ec266ccccc90b7a8cb0264b997dab27c10f9
Patch-mainline: yes
GCC 10 defaults to -fno-common resulting into errors about a multiple
definitions of variables that where defined instead of declared by
a mistake in a header file that is included into more compilations
units.
---
test/test.c | 3 +++
test/test.h | 9 +++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/test/test.c b/test/test.c
index 00e2ddb..6abd774 100644
--- a/test/test.c
+++ b/test/test.c
@@ -17,8 +17,11 @@
#include <unistd.h>
/* Global variables for each test unit */
+char *unit_name = NULL;
char *reason = NULL;
+unsigned int passed, failed, skipped;
void (*test_destructor_function)(void *) = NULL;
+void *test_destructor_argument = NULL;
/* Print formated string into automtically reallocated @uffer.
* @buffer automatically reallocated buffer. Must be &NULL or preallocated
diff --git a/test/test.h b/test/test.h
index 63f22f9..1559a9d 100644
--- a/test/test.h
+++ b/test/test.h
@@ -14,10 +14,11 @@
#include "test-tools.h"
-char *unit_name, *reason;
-unsigned int passed, failed, skipped;
-void (*test_destructor_function)(void *);
-void *test_destructor_argument;
+extern char *unit_name;
+extern char *reason;
+extern unsigned int passed, failed, skipped;
+extern void (*test_destructor_function)(void *);
+extern void *test_destructor_argument;
#define INIT_TEST(name) { \
setlocale(LC_ALL, "C"); \
--
2.11.4.GIT