summaryrefslogtreecommitdiff
path: root/gcc/c-family/c-pragma.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-family/c-pragma.c')
-rw-r--r--gcc/c-family/c-pragma.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c
index 718a310cf50..6894f0e7c3d 100644
--- a/gcc/c-family/c-pragma.c
+++ b/gcc/c-family/c-pragma.c
@@ -392,6 +392,9 @@ handle_pragma_weak (cpp_reader * ARG_UNUSED (dummy))
decl = identifier_global_value (name);
if (decl && DECL_P (decl))
{
+ if (!VAR_OR_FUNCTION_DECL_P (decl))
+ GCC_BAD2 ("%<#pragma weak%> declaration of %q+D not allowed,"
+ " ignored", decl);
apply_pragma_weak (decl, value);
if (value)
{