]> git.ipfire.org Git - people/stevee/ipfire-3.x.git/blob - gcc/patches/gcc46-pr38757.patch0
Change file layout of the makefiles.
[people/stevee/ipfire-3.x.git] / gcc / patches / gcc46-pr38757.patch0
1 2009-03-18 Jakub Jelinek <jakub@redhat.com>
2
3 PR debug/38757
4 * langhooks.h (struct lang_hooks): Add source_language langhook.
5 * langhooks-def.h (LANG_HOOKS_SOURCE_LANGUAGE): Define to NULL.
6 (LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_SOURCE_LANGUAGE.
7 * c-lang.c (c_source_language): New function.
8 (LANG_HOOKS_SOURCE_LANGUAGE): Define.
9 * dwarf2out.c (add_prototyped_attribute): Add DW_AT_prototype
10 also for DW_LANG_{C,C99,ObjC}.
11 (gen_compile_unit_die): Use lang_hooks.source_language () to
12 determine if DW_LANG_C99 or DW_LANG_C89 should be returned.
13
14 --- gcc/langhooks.h.jj 2011-01-03 12:53:05.125745450 +0100
15 +++ gcc/langhooks.h 2011-01-04 17:59:43.166744926 +0100
16 @@ -467,6 +467,10 @@ struct lang_hooks
17 gimplification. */
18 bool deep_unsharing;
19
20 + /* Return year of the source language standard version if the FE supports
21 + multiple versions of the standard. */
22 + int (*source_language) (void);
23 +
24 /* Whenever you add entries here, make sure you adjust langhooks-def.h
25 and langhooks.c accordingly. */
26 };
27 --- gcc/langhooks-def.h.jj 2011-01-03 12:53:05.000000000 +0100
28 +++ gcc/langhooks-def.h 2011-01-04 18:00:44.858851030 +0100
29 @@ -118,6 +118,7 @@ extern void lhd_omp_firstprivatize_type_
30 #define LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS NULL
31 #define LANG_HOOKS_EH_USE_CXA_END_CLEANUP false
32 #define LANG_HOOKS_DEEP_UNSHARING false
33 +#define LANG_HOOKS_SOURCE_LANGUAGE NULL
34
35 /* Attribute hooks. */
36 #define LANG_HOOKS_ATTRIBUTE_TABLE NULL
37 @@ -307,7 +308,8 @@ extern void lhd_end_section (void);
38 LANG_HOOKS_EH_RUNTIME_TYPE, \
39 LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS, \
40 LANG_HOOKS_EH_USE_CXA_END_CLEANUP, \
41 - LANG_HOOKS_DEEP_UNSHARING \
42 + LANG_HOOKS_DEEP_UNSHARING, \
43 + LANG_HOOKS_SOURCE_LANGUAGE \
44 }
45
46 #endif /* GCC_LANG_HOOKS_DEF_H */
47 --- gcc/c-lang.c.jj 2011-01-03 12:53:05.376056936 +0100
48 +++ gcc/c-lang.c 2011-01-04 17:59:43.167743798 +0100
49 @@ -36,6 +36,12 @@ along with GCC; see the file COPYING3.
50
51 enum c_language_kind c_language = clk_c;
52
53 +static int
54 +c_source_language (void)
55 +{
56 + return flag_isoc99 ? 1999 : 1989;
57 +}
58 +
59 /* Lang hooks common to C and ObjC are declared in c-objc-common.h;
60 consequently, there should be very few hooks below. */
61
62 @@ -43,6 +49,8 @@ enum c_language_kind c_language = clk_c;
63 #define LANG_HOOKS_NAME "GNU C"
64 #undef LANG_HOOKS_INIT
65 #define LANG_HOOKS_INIT c_objc_common_init
66 +#undef LANG_HOOKS_SOURCE_LANGUAGE
67 +#define LANG_HOOKS_SOURCE_LANGUAGE c_source_language
68
69 /* Each front end provides its own lang hook initializer. */
70 struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
71 --- gcc/dwarf2out.c.jj 2011-01-03 12:53:05.102056475 +0100
72 +++ gcc/dwarf2out.c 2011-01-04 18:03:14.534151763 +0100
73 @@ -17650,9 +17650,18 @@ add_bit_size_attribute (dw_die_ref die,
74 static inline void
75 add_prototyped_attribute (dw_die_ref die, tree func_type)
76 {
77 - if (get_AT_unsigned (comp_unit_die (), DW_AT_language) == DW_LANG_C89
78 - && prototype_p (func_type))
79 - add_AT_flag (die, DW_AT_prototyped, 1);
80 + switch (get_AT_unsigned (comp_unit_die (), DW_AT_language))
81 + {
82 + case DW_LANG_C:
83 + case DW_LANG_C89:
84 + case DW_LANG_C99:
85 + case DW_LANG_ObjC:
86 + if (prototype_p (func_type) != NULL)
87 + add_AT_flag (die, DW_AT_prototyped, 1);
88 + break;
89 + default:
90 + break;
91 + }
92 }
93
94 /* Add an 'abstract_origin' attribute below a given DIE. The DIE is found
95 @@ -19875,6 +19884,10 @@ gen_compile_unit_die (const char *filena
96 language = DW_LANG_ObjC;
97 else if (strcmp (language_string, "GNU Objective-C++") == 0)
98 language = DW_LANG_ObjC_plus_plus;
99 + else if (strcmp (language_string, "GNU C") == 0
100 + && lang_hooks.source_language
101 + && lang_hooks.source_language () >= 1999)
102 + language = DW_LANG_C99;
103 }
104
105 add_AT_unsigned (die, DW_AT_language, language);