diff options
author | geoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-24 21:59:48 +0000 |
---|---|---|
committer | geoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-24 21:59:48 +0000 |
commit | f543041be33a93d253a4aa1882532480e2bc4628 (patch) | |
tree | 9167ce1f04f8c8057edc2a048d5102b1811fb922 /gcc/dwarf2out.c | |
parent | 0c573f984386af7be60890bd572fe1f94e919666 (diff) | |
download | gcc-f543041be33a93d253a4aa1882532480e2bc4628.tar.gz |
2006-03-23 Geoffrey Keating <geoffk@apple.com>
PR 26793
* config/t-darwin (crt3.o): Work around bug 26840.
* config/darwin-crt3.c: Rewrite.
* config/darwin.h (STARTFILE_SPEC): Don't use -l for crt3.o.
Index: gcc/testsuite/ChangeLog
2006-03-24 Geoffrey Keating <geoffk@apple.com>
* g++.old-deja/g++.other/init19.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112361 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r-- | gcc/dwarf2out.c | 54 |
1 files changed, 40 insertions, 14 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index ccfb5df699f..5b1894c5be0 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -5326,8 +5326,9 @@ is_c_family (void) { unsigned int lang = get_AT_unsigned (comp_unit_die, DW_AT_language); - return (lang == DW_LANG_C || lang == DW_LANG_C89 - || lang == DW_LANG_C_plus_plus); + return (lang == DW_LANG_C || lang == DW_LANG_C89 || lang == DW_LANG_ObjC + || lang == DW_LANG_C99 + || lang == DW_LANG_C_plus_plus || lang == DW_LANG_ObjC_plus_plus); } /* Return TRUE if the language is C++. */ @@ -5335,8 +5336,9 @@ is_c_family (void) static inline bool is_cxx (void) { - return (get_AT_unsigned (comp_unit_die, DW_AT_language) - == DW_LANG_C_plus_plus); + unsigned int lang = get_AT_unsigned (comp_unit_die, DW_AT_language); + + return lang == DW_LANG_C_plus_plus || lang == DW_LANG_ObjC_plus_plus; } /* Return TRUE if the language is Fortran. */ @@ -9927,6 +9929,23 @@ add_const_value_attribute (dw_die_ref die, rtx rtl) } +/* Determine whether the evaluation of EXPR references any variables + or functions which aren't otherwise used (and therefore may not be + output). */ +static tree +reference_to_unused (tree * tp, int * walk_subtrees, + void * data ATTRIBUTE_UNUSED) +{ + if (! EXPR_P (*tp) && ! CONSTANT_CLASS_P (*tp)) + *walk_subtrees = 0; + + if (DECL_P (*tp) && ! TREE_PUBLIC (*tp) && ! TREE_USED (*tp) + && ! TREE_ASM_WRITTEN (*tp)) + return *tp; + else + return NULL_TREE; +} + /* Generate an RTL constant from a decl initializer INIT with decl type TYPE, for use in a later add_const_value_attribute call. */ @@ -9953,15 +9972,16 @@ rtl_for_decl_init (tree init, tree type) rtl = gen_rtx_CONST_STRING (VOIDmode, ggc_strdup (TREE_STRING_POINTER (init))); } + /* Although DWARF could easily handle other kinds of aggregates, we + have no way to represent such values as RTL constants, so skip + those. */ + else if (AGGREGATE_TYPE_P (type)) + ; /* If the initializer is something that we know will expand into an - immediate RTL constant, expand it now. Expanding anything else - tends to produce unresolved symbols; see debug/5770 and c++/6381. */ - /* Aggregate, vector, and complex types may contain constructors that may - result in code being generated when expand_expr is called, so we can't - handle them here. Integer and float are useful and safe types to handle - here. */ - else if ((INTEGRAL_TYPE_P (type) || SCALAR_FLOAT_TYPE_P (type)) - && initializer_constant_valid_p (init, type) == null_pointer_node) + immediate RTL constant, expand it now. We must be careful not to + reference variables which won't be output. */ + else if (initializer_constant_valid_p (init, type) + && ! walk_tree (&init, reference_to_unused, NULL, NULL)) { rtl = expand_expr (init, NULL_RTX, VOIDmode, EXPAND_INITIALIZER); @@ -10325,6 +10345,9 @@ add_location_or_const_value_attribute (dw_die_ref die, tree decl, add_AT_location_description (die, attr, descr); return; } + /* None of that worked, so it must not really have a location; + try adding a constant value attribute from the DECL_INITIAL. */ + tree_add_const_value_attribute (die, decl); } /* If we don't have a copy of this variable in memory for some reason (such @@ -12204,6 +12227,10 @@ gen_compile_unit_die (const char *filename) language = DW_LANG_Pascal83; else if (strcmp (language_string, "GNU Java") == 0) language = DW_LANG_Java; + else if (strcmp (language_string, "GNU Objective-C") == 0) + language = DW_LANG_ObjC; + else if (strcmp (language_string, "GNU Objective-C++") == 0) + language = DW_LANG_ObjC_plus_plus; else language = DW_LANG_C89; @@ -13314,8 +13341,7 @@ dwarf2out_decl (tree decl) { /* OK, we need to generate one for `bool' so GDB knows what type comparisons have. */ - if ((get_AT_unsigned (comp_unit_die, DW_AT_language) - == DW_LANG_C_plus_plus) + if (is_cxx () && TREE_CODE (TREE_TYPE (decl)) == BOOLEAN_TYPE && ! DECL_IGNORED_P (decl)) modified_type_die (TREE_TYPE (decl), 0, 0, NULL); |