diff options
| author | Ernestas Kulik <ekulik@redhat.com> | 2020-01-25 18:44:11 +0100 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2020-01-25 23:07:38 +0200 |
| commit | dbad64cf34ba43b24dc2d71bd260f137acc37ea5 (patch) | |
| tree | c14976cf980023ccdc887212fcfd396bc05b1688 /test cases | |
| parent | f54f27b1a8d0b3ea842ed8981f4f56cd305f9794 (diff) | |
| download | meson-dbad64cf34ba43b24dc2d71bd260f137acc37ea5.tar.gz | |
tests: Prevent multiple-definition of symbols
With GCC 10, -fno-common becomes default behavior, meaning that any
subtly-broken code will be broken not so subtly anymore.
This commit changes the linkage to variables declared in headers to
external and, where needed, adds additional definitions in other
compilation units.
Diffstat (limited to 'test cases')
6 files changed, 14 insertions, 6 deletions
diff --git a/test cases/common/219 source set configuration_data/all.h b/test cases/common/219 source set configuration_data/all.h index 728a7f652..e3547dfdc 100644 --- a/test cases/common/219 source set configuration_data/all.h +++ b/test cases/common/219 source set configuration_data/all.h @@ -3,5 +3,7 @@ extern void g(void); extern void h(void); extern void undefined(void); -/* No extern here to get a common symbol */ -void (*p)(void); +/* Defined in nope.c and f.c, + * value depends on the source set and configuration used. + */ +extern void (*p)(void); diff --git a/test cases/common/219 source set configuration_data/f.c b/test cases/common/219 source set configuration_data/f.c index a50ecda32..33d2f18f0 100644 --- a/test cases/common/219 source set configuration_data/f.c +++ b/test cases/common/219 source set configuration_data/f.c @@ -1,5 +1,7 @@ #include "all.h" +void (*p)(void) = (void *)0x12AB34CD; + void f(void) { } diff --git a/test cases/common/220 source set dictionary/all.h b/test cases/common/220 source set dictionary/all.h index 728a7f652..e3547dfdc 100644 --- a/test cases/common/220 source set dictionary/all.h +++ b/test cases/common/220 source set dictionary/all.h @@ -3,5 +3,7 @@ extern void g(void); extern void h(void); extern void undefined(void); -/* No extern here to get a common symbol */ -void (*p)(void); +/* Defined in nope.c and f.c, + * value depends on the source set and configuration used. + */ +extern void (*p)(void); diff --git a/test cases/common/220 source set dictionary/f.c b/test cases/common/220 source set dictionary/f.c index a50ecda32..9c5bb1cb9 100644 --- a/test cases/common/220 source set dictionary/f.c +++ b/test cases/common/220 source set dictionary/f.c @@ -1,5 +1,7 @@ #include "all.h" +void (*p)(void) = (void *)0x1234ABCD; + void f(void) { } diff --git a/test cases/common/68 build always/version.h b/test cases/common/68 build always/version.h index d3fe5c695..7d433f035 100644 --- a/test cases/common/68 build always/version.h +++ b/test cases/common/68 build always/version.h @@ -1,3 +1,3 @@ #pragma once -const char *version_string; +extern const char *version_string; diff --git a/test cases/common/69 vcstag/tagprog.c b/test cases/common/69 vcstag/tagprog.c index 19b775456..27c3cc58d 100644 --- a/test cases/common/69 vcstag/tagprog.c +++ b/test cases/common/69 vcstag/tagprog.c @@ -1,6 +1,6 @@ #include<stdio.h> -const char *vcstag; +extern const char *vcstag; int main(void) { printf("Version is %s\n", vcstag); |
