diff options
Diffstat (limited to 'gcc-4.8/gcc/c-family/c-pragma.c')
-rw-r--r-- | gcc-4.8/gcc/c-family/c-pragma.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc-4.8/gcc/c-family/c-pragma.c b/gcc-4.8/gcc/c-family/c-pragma.c index 7d8a1a605..02cb36a60 100644 --- a/gcc-4.8/gcc/c-family/c-pragma.c +++ b/gcc-4.8/gcc/c-family/c-pragma.c @@ -259,6 +259,7 @@ apply_pragma_weak (tree decl, tree value) if (SUPPORTS_WEAK && DECL_EXTERNAL (decl) && TREE_USED (decl) && !DECL_WEAK (decl) /* Don't complain about a redundant #pragma. */ + && DECL_ASSEMBLER_NAME_SET_P (decl) && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))) warning (OPT_Wpragmas, "applying #pragma weak %q+D after first use " "results in unspecified behavior", decl); @@ -276,7 +277,7 @@ maybe_apply_pragma_weak (tree decl) /* Avoid asking for DECL_ASSEMBLER_NAME when it's not needed. */ /* No weak symbols pending, take the short-cut. */ - if (!pending_weaks) + if (vec_safe_is_empty (pending_weaks)) return; /* If it's not visible outside this file, it doesn't matter whether it's weak. */ @@ -288,7 +289,13 @@ maybe_apply_pragma_weak (tree decl) if (TREE_CODE (decl) != FUNCTION_DECL && TREE_CODE (decl) != VAR_DECL) return; + if (DECL_ASSEMBLER_NAME_SET_P (decl)) id = DECL_ASSEMBLER_NAME (decl); + else + { + id = DECL_ASSEMBLER_NAME (decl); + SET_DECL_ASSEMBLER_NAME (decl, NULL_TREE); + } FOR_EACH_VEC_ELT (*pending_weaks, i, pe) if (id == pe->name) @@ -309,7 +316,7 @@ maybe_apply_pending_pragma_weaks (void) pending_weak *pe; symtab_node target; - if (!pending_weaks) + if (vec_safe_is_empty (pending_weaks)) return; FOR_EACH_VEC_ELT (*pending_weaks, i, pe) |