Blame SOURCES/gcc44-pr38757.patch

f28b6a
2009-03-18  Jakub Jelinek  <jakub@redhat.com>
f28b6a
f28b6a
	PR debug/38757
f28b6a
	* langhooks.h (struct lang_hooks): Add source_language langhook.
f28b6a
	* langhooks-def.h (LANG_HOOKS_SOURCE_LANGUAGE): Define to NULL.
f28b6a
	(LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_SOURCE_LANGUAGE.
f28b6a
	* c-lang.c (c_source_language): New function.
f28b6a
	(LANG_HOOKS_SOURCE_LANGUAGE): Define.
f28b6a
	* dwarf2out.c (add_prototyped_attribute): Add DW_AT_prototype
f28b6a
	also for DW_LANG_{C,C99,ObjC}.
f28b6a
	(gen_compile_unit_die): Use lang_hooks.source_language () to
f28b6a
	determine if DW_LANG_C99 or DW_LANG_C89 should be returned.
f28b6a
f28b6a
--- gcc/langhooks.h.jj	2009-03-02 09:45:47.000000000 +0100
f28b6a
+++ gcc/langhooks.h	2009-03-18 12:53:24.000000000 +0100
f28b6a
@@ -1,5 +1,5 @@
f28b6a
 /* The lang_hooks data structure.
f28b6a
-   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
f28b6a
+   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
f28b6a
    Free Software Foundation, Inc.
f28b6a
 
f28b6a
 This file is part of GCC.
f28b6a
@@ -414,6 +414,10 @@ struct lang_hooks
f28b6a
      if in the process TREE_CONSTANT or TREE_SIDE_EFFECTS need updating.  */
f28b6a
   tree (*expr_to_decl) (tree expr, bool *tc, bool *se);
f28b6a
 
f28b6a
+  /* Return year of the source language standard version if the FE supports
f28b6a
+     multiple versions of the standard.  */
f28b6a
+  int (*source_language) (void);
f28b6a
+
f28b6a
   /* Whenever you add entries here, make sure you adjust langhooks-def.h
f28b6a
      and langhooks.c accordingly.  */
f28b6a
 };
f28b6a
--- gcc/langhooks-def.h.jj	2009-03-02 09:45:47.000000000 +0100
f28b6a
+++ gcc/langhooks-def.h	2009-03-18 12:53:45.000000000 +0100
f28b6a
@@ -1,5 +1,5 @@
f28b6a
 /* Default macros to initialize the lang_hooks data structure.
f28b6a
-   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
f28b6a
+   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
f28b6a
    Free Software Foundation, Inc.
f28b6a
    Contributed by Alexandre Oliva  <aoliva@redhat.com>
f28b6a
 
f28b6a
@@ -113,6 +113,7 @@ extern void lhd_omp_firstprivatize_type_
f28b6a
 #define LANG_HOOKS_EXPR_TO_DECL		lhd_expr_to_decl
f28b6a
 #define LANG_HOOKS_TO_TARGET_CHARSET	lhd_to_target_charset
f28b6a
 #define LANG_HOOKS_INIT_TS		lhd_do_nothing
f28b6a
+#define LANG_HOOKS_SOURCE_LANGUAGE	NULL
f28b6a
 
f28b6a
 /* Attribute hooks.  */
f28b6a
 #define LANG_HOOKS_ATTRIBUTE_TABLE		NULL
f28b6a
@@ -270,6 +271,7 @@ extern tree lhd_make_node (enum tree_cod
f28b6a
   LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE, \
f28b6a
   LANG_HOOKS_INIT_TS,          \
f28b6a
   LANG_HOOKS_EXPR_TO_DECL, \
f28b6a
+  LANG_HOOKS_SOURCE_LANGUAGE, \
f28b6a
 }
f28b6a
 
f28b6a
 #endif /* GCC_LANG_HOOKS_DEF_H */
f28b6a
--- gcc/c-lang.c.jj	2009-02-20 15:06:14.000000000 +0100
f28b6a
+++ gcc/c-lang.c	2009-03-18 13:33:41.000000000 +0100
f28b6a
@@ -1,6 +1,6 @@
f28b6a
 /* Language-specific hook definitions for C front end.
f28b6a
    Copyright (C) 1991, 1995, 1997, 1998,
f28b6a
-   1999, 2000, 2001, 2003, 2004, 2005, 2007, 2008
f28b6a
+   1999, 2000, 2001, 2003, 2004, 2005, 2007, 2008, 2009
f28b6a
    Free Software Foundation, Inc.
f28b6a
 
f28b6a
 This file is part of GCC.
f28b6a
@@ -37,6 +37,12 @@ along with GCC; see the file COPYING3.  
f28b6a
 
f28b6a
 enum c_language_kind c_language = clk_c;
f28b6a
 
f28b6a
+static int
f28b6a
+c_source_language (void)
f28b6a
+{
f28b6a
+  return flag_isoc99 ? 1999 : 1989;
f28b6a
+}
f28b6a
+
f28b6a
 /* Lang hooks common to C and ObjC are declared in c-objc-common.h;
f28b6a
    consequently, there should be very few hooks below.  */
f28b6a
 
f28b6a
@@ -44,6 +50,8 @@ enum c_language_kind c_language = clk_c;
f28b6a
 #define LANG_HOOKS_NAME "GNU C"
f28b6a
 #undef LANG_HOOKS_INIT
f28b6a
 #define LANG_HOOKS_INIT c_objc_common_init
f28b6a
+#undef LANG_HOOKS_SOURCE_LANGUAGE
f28b6a
+#define LANG_HOOKS_SOURCE_LANGUAGE c_source_language
f28b6a
 
f28b6a
 /* Each front end provides its own lang hook initializer.  */
f28b6a
 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
f28b6a
--- gcc/dwarf2out.c.jj	2009-03-17 13:06:29.000000000 +0100
f28b6a
+++ gcc/dwarf2out.c	2009-03-18 12:55:36.000000000 +0100
f28b6a
@@ -14286,9 +14286,18 @@ add_bit_size_attribute (dw_die_ref die, 
f28b6a
 static inline void
f28b6a
 add_prototyped_attribute (dw_die_ref die, tree func_type)
f28b6a
 {
f28b6a
-  if (get_AT_unsigned (comp_unit_die, DW_AT_language) == DW_LANG_C89
f28b6a
-      && TYPE_ARG_TYPES (func_type) != NULL)
f28b6a
-    add_AT_flag (die, DW_AT_prototyped, 1);
f28b6a
+  switch (get_AT_unsigned (comp_unit_die, DW_AT_language))
f28b6a
+    {
f28b6a
+    case DW_LANG_C:
f28b6a
+    case DW_LANG_C89:
f28b6a
+    case DW_LANG_C99:
f28b6a
+    case DW_LANG_ObjC:
f28b6a
+      if (TYPE_ARG_TYPES (func_type) != NULL)
f28b6a
+	add_AT_flag (die, DW_AT_prototyped, 1);
f28b6a
+      break;
f28b6a
+    default:
f28b6a
+      break;
f28b6a
+    }
f28b6a
 }
f28b6a
 
f28b6a
 /* Add an 'abstract_origin' attribute below a given DIE.  The DIE is found
f28b6a
@@ -16290,6 +16299,10 @@ gen_compile_unit_die (const char *filena
f28b6a
 	language = DW_LANG_ObjC;
f28b6a
       else if (strcmp (language_string, "GNU Objective-C++") == 0)
f28b6a
 	language = DW_LANG_ObjC_plus_plus;
f28b6a
+      else if (strcmp (language_string, "GNU C") == 0
f28b6a
+	       && lang_hooks.source_language
f28b6a
+	       && lang_hooks.source_language () >= 1999)
f28b6a
+	language = DW_LANG_C99;
f28b6a
     }
f28b6a
 
f28b6a
   add_AT_unsigned (die, DW_AT_language, language);