]> gcc.gnu.org Git - gcc.git/commitdiff
darwin.c (darwin_handle_weak_import_attribute): Permit VAR_DECLs to have weak_import...
authorGeoffrey Keating <geoffk@apple.com>
Mon, 3 Jan 2005 23:26:54 +0000 (23:26 +0000)
committerGeoffrey Keating <geoffk@gcc.gnu.org>
Mon, 3 Jan 2005 23:26:54 +0000 (23:26 +0000)
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

gcc/ChangeLog
gcc/config/darwin.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/darwin-weakimport-1.c
gcc/testsuite/gcc.dg/darwin-weakimport-2.c [new file with mode: 0644]

index a1369db17b3f693139527cd3b416f1716b005e4f..f94c25f202fdb7df2271333d24a39d24b03b09ea 100644 (file)
@@ -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'.
 
index 4738fee911caf589fc539b513a61de131bb0874d..b95c438988eba9d9b05a9c42a5ee18fd1ef812fc 100644 (file)
@@ -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;
index 058df899faf39d54290b033ac14b55daedb4e133..f74a542b2b49f9345471517fa982b7f901f0611d 100644 (file)
@@ -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.
index c797720e4e2400a418af29951c1170aa482e9c81..e74ccc98ae679f3c28dccc151b5e631a3899fa5b 100644 (file)
@@ -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 (file)
index 0000000..1c80233
--- /dev/null
@@ -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;
+}
This page took 0.08551 seconds and 5 git commands to generate.