diff options
author | Geoffrey Keating <geoffk@apple.com> | 2005-01-03 23:26:54 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@gcc.gnu.org> | 2005-01-03 23:26:54 +0000 |
commit | d7001ae593744a2243c7674cae610f645ab18252 (patch) | |
tree | 715b198064e6dd14dd879b254826896000dafdf4 | |
parent | a035080cbcedd9c8c595f9fa336f4fcd140eb296 (diff) | |
download | gcc-d7001ae593744a2243c7674cae610f645ab18252.zip gcc-d7001ae593744a2243c7674cae610f645ab18252.tar.gz gcc-d7001ae593744a2243c7674cae610f645ab18252.tar.bz2 |
darwin.c (darwin_handle_weak_import_attribute): Permit VAR_DECLs to have weak_import attribute.
2005-01-03 Geoffrey Keating <geoffk@apple.com>
* config/darwin.c (darwin_handle_weak_import_attribute): Permit
VAR_DECLs to have weak_import attribute.
Index: testsuite/ChangeLog
2005-01-03 Geoffrey Keating <geoffk@apple.com>
* gcc.dg/darwin-weakimport-1.c: Remove check for variables
producing warning.
* gcc.dg/darwin-weakimport-2.c: New.
From-SVN: r92871
-rw-r--r-- | gcc/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/config/darwin.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/darwin-weakimport-1.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/darwin-weakimport-2.c | 14 |
5 files changed, 24 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a1369db..f94c25f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,8 @@ 2005-01-03 Geoffrey Keating <geoffk@apple.com> + * config/darwin.c (darwin_handle_weak_import_attribute): Permit + VAR_DECLs to have weak_import attribute. + * config/rs6000/darwin-fallback.c: Use 'ucontext_t' rather than 'struct ucontext'. diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 4738fee..b95c438 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -1228,7 +1228,7 @@ darwin_handle_weak_import_attribute (tree *node, tree name, int ARG_UNUSED (flags), bool * no_add_attrs) { - if (TREE_CODE (*node) != FUNCTION_DECL) + if (TREE_CODE (*node) != FUNCTION_DECL && TREE_CODE (*node) != VAR_DECL) { warning ("%qs attribute ignored", IDENTIFIER_POINTER (name)); *no_add_attrs = true; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 058df89..f74a542 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2005-01-03 Geoffrey Keating <geoffk@apple.com> + + * gcc.dg/darwin-weakimport-1.c: Remove check for variables + producing warning. + * gcc.dg/darwin-weakimport-2.c: New. + 2005-01-03 Richard Henderson <rth@redhat.com> * g++.old-deja/g++.ext/attrib5.C: Move the alias after the referent. diff --git a/gcc/testsuite/gcc.dg/darwin-weakimport-1.c b/gcc/testsuite/gcc.dg/darwin-weakimport-1.c index c797720..e74ccc9 100644 --- a/gcc/testsuite/gcc.dg/darwin-weakimport-1.c +++ b/gcc/testsuite/gcc.dg/darwin-weakimport-1.c @@ -12,5 +12,3 @@ void b(void) { a(); } - -extern int c __attribute__((weak_import)); /* { dg-warning "ignored" } */ diff --git a/gcc/testsuite/gcc.dg/darwin-weakimport-2.c b/gcc/testsuite/gcc.dg/darwin-weakimport-2.c new file mode 100644 index 0000000..1c80233 --- /dev/null +++ b/gcc/testsuite/gcc.dg/darwin-weakimport-2.c @@ -0,0 +1,14 @@ +/* APPLE LOCAL file put in 4.1 */ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-require-weak "" } */ + +/* { dg-final { scan-assembler "weak_reference _foo" } } */ + +extern int foo __attribute__((weak_import)); + +int main(void) +{ + if (&foo) + return foo; + return 0; +} |