aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-03-27 16:34:55 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-03-27 16:34:55 +0000
commit6b4e94bcaef89af9899da67f2dffc54496120535 (patch)
tree80c072ec99b03af1c2177a37fdaa302f07d39aa2 /gcc
parent62bc00e258331aeba39f47e9fee275f4ba5b7956 (diff)
downloadgcc-6b4e94bcaef89af9899da67f2dffc54496120535.zip
gcc-6b4e94bcaef89af9899da67f2dffc54496120535.tar.gz
gcc-6b4e94bcaef89af9899da67f2dffc54496120535.tar.bz2
re PR c/32511 (GCC rejects inline+weak function)
2008-03-27 Richard Guenther <rguenther@suse.de> PR c/32511 * c-common.c (handle_weak_attribute): Reject combination of weak and inline. * gcc.dg/attr-weak-1.c: New testcase. From-SVN: r133646
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/c-common.c9
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/attr-weak-1.c4
4 files changed, 22 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 215f0b2..19cb567 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2008-03-27 Richard Guenther <rguenther@suse.de>
+ PR c/32511
+ * c-common.c (handle_weak_attribute): Reject combination of
+ weak and inline.
+
+2008-03-27 Richard Guenther <rguenther@suse.de>
+
PR tree-optimization/32810
* tree-ssa-ccp.c (get_symbol_constant_value): Strip useless
conversions from DECL_INITIAL.
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 1b62974..7e609de 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -5518,11 +5518,16 @@ handle_weak_attribute (tree *node, tree name,
bool * ARG_UNUSED (no_add_attrs))
{
if (TREE_CODE (*node) == FUNCTION_DECL
- || TREE_CODE (*node) == VAR_DECL)
+ && DECL_DECLARED_INLINE_P (*node))
+ {
+ error ("inline function %q+D cannot be declared weak", *node);
+ *no_add_attrs = true;
+ }
+ else if (TREE_CODE (*node) == FUNCTION_DECL
+ || TREE_CODE (*node) == VAR_DECL)
declare_weak (*node);
else
warning (OPT_Wattributes, "%qE attribute ignored", name);
-
return NULL_TREE;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index abaed69..1752896 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2008-03-27 Richard Guenther <rguenther@suse.de>
+ PR c/32511
+ * gcc.dg/attr-weak-1.c: New testcase.
+
+2008-03-27 Richard Guenther <rguenther@suse.de>
+
PR tree-optimization/32810
* gcc.dg/tree-ssa/ssa-ccp-18.c: New testcase.
diff --git a/gcc/testsuite/gcc.dg/attr-weak-1.c b/gcc/testsuite/gcc.dg/attr-weak-1.c
new file mode 100644
index 0000000..014e37d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/attr-weak-1.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+
+__inline void foo(void) __attribute__((weak)); /* { dg-error "inline.*weak" } */
+