Merge commit 'origin/master' into roland/known-dwarf

Conflicts:
	libdw/ChangeLog
diff --git a/config/ChangeLog b/config/ChangeLog
index 0c50373..883e893 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,8 @@
+2009-01-11  Roland McGrath  <roland@redhat.com>
+
+	* known-dwarf.awk: New file.
+	* Makefile.am (EXTRA_DIST): Add it.
+
 2008-12-24  Roland McGrath  <roland@redhat.com>
 
 	* Makefile.am ($(srcdir)/elfutils.spec.in): Rewrite awk magic.
diff --git a/config/Makefile.am b/config/Makefile.am
index f2db4ef..91adeee 100644
--- a/config/Makefile.am
+++ b/config/Makefile.am
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in -*-Makefile-*-
 ## Configure input file for elfutils.
 ##
-## Copyright (C) 2004, 2005, 2008 Red Hat, Inc.
+## Copyright (C) 2004, 2005, 2008, 2009 Red Hat, Inc.
 ## This file is part of Red Hat elfutils.
 ##
 ## Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -25,7 +25,7 @@
 ## Network licensing program, please visit www.openinventionnetwork.com
 ## <http://www.openinventionnetwork.com>.
 ##
-EXTRA_DIST = elfutils.spec.in
+EXTRA_DIST = elfutils.spec.in known-dwarf.awk
 
 if MAINTAINER_MODE
 $(srcdir)/elfutils.spec.in: $(top_srcdir)/NEWS
diff --git a/config/known-dwarf.awk b/config/known-dwarf.awk
new file mode 100644
index 0000000..6e8af6d
--- /dev/null
+++ b/config/known-dwarf.awk
@@ -0,0 +1,45 @@
+#!/bin/awk -f
+
+$1 ~ /DW_([A-Z]+)_([^ ]+)/ {
+  match($1, /DW_([A-Z]+)_([^ ]+)/, fields);
+  set = fields[1];
+  elt = fields[2];
+  if (set in DW)
+    DW[set] = DW[set] "," elt;
+  else
+    DW[set] = elt;
+  if ($NF == "*/" && $4 == "/*") {
+    c = $5;
+    for (i = 6; i < NF; ++i) c = c " " $i;
+    comment[set, elt] = c;
+  }
+}
+END {
+  print "/* Generated by config/dwarf-known.awk from libdw.h contents.  */";
+  n = asorti(DW, sets);
+  for (i = 1; i <= n; ++i) {
+    set = sets[i];
+    if (what && what != set) continue;
+    print "\n#define ALL_KNOWN_DW_" set " \\";
+    split(DW[set], elts, ",");
+    m = asort(elts);
+    lo = hi = "";
+    for (j = 1; j <= m; ++j) {
+      elt = elts[j];
+      if (elt ~ /(lo|low)_user$/) {
+	lo = elt;
+	continue;
+      }
+      if (elt ~ /(hi|high)_user$/) {
+	hi = elt;
+	continue;
+      }
+      if (comment[set, elt])
+	print "  ONE_KNOWN_DW_" set "_DESC (" elt ", DW_" set "_" elt \
+	  ", \"" comment[set, elt] "\") \\";
+      else
+	print "  ONE_KNOWN_DW_" set " (" elt ", DW_" set "_" elt ") \\";
+    }
+    print "  /* End of DW_" set "_*.  */";
+  }
+}
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index b0415d8..51ab6e9 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,5 +1,15 @@
 2009-01-17  Roland McGrath  <roland@redhat.com>
 
+	* Makefile.am (known-dwarf.h): Target renamed, not in $(srcdir).
+	Make it unconditional.
+	(BUILT_SOURCES): Updated.
+
+	* dwarf.h: Add description comments for DW_LANG_* values.
+
+	* Makefile.am [MAINTAINER_MODE]
+	($(srcdir)/known-dwarf.h): New target.
+	(BUILT_SOURCES): Add it.
+
 	* dwarf.h: Add DW_OP_GNU_push_tls_address, DW_OP_GNU_uninit.
 
 2009-01-10  Ulrich Drepper  <drepper@redhat.com>
diff --git a/libdw/Makefile.am b/libdw/Makefile.am
index 56c7a2f..5f84abd 100644
--- a/libdw/Makefile.am
+++ b/libdw/Makefile.am
@@ -85,6 +85,11 @@
 		  libdw_visit_scopes.c \
 		  dwarf_entry_breakpoints.c
 
+BUILT_SOURCES = known-dwarf.h
+known-dwarf.h: $(top_srcdir)/config/known-dwarf.awk $(srcdir)/dwarf.h
+	$(AWK) -f $^ > $@.new
+	mv -f $@.new $@
+
 if !MUDFLAP
 libdw_pic_a_SOURCES =
 am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
diff --git a/libdw/dwarf.h b/libdw/dwarf.h
index 0088f0b..cce4630 100644
--- a/libdw/dwarf.h
+++ b/libdw/dwarf.h
@@ -519,25 +519,25 @@
 /* DWARF language encodings.  */
 enum
   {
-    DW_LANG_C89 = 0x0001,
-    DW_LANG_C = 0x0002,
-    DW_LANG_Ada83 = 0x0003,
-    DW_LANG_C_plus_plus	= 0x0004,
-    DW_LANG_Cobol74 = 0x0005,
-    DW_LANG_Cobol85 = 0x0006,
-    DW_LANG_Fortran77 = 0x0007,
-    DW_LANG_Fortran90 = 0x0008,
-    DW_LANG_Pascal83 = 0x0009,
-    DW_LANG_Modula2 = 0x000a,
-    DW_LANG_Java = 0x000b,
-    DW_LANG_C99 = 0x000c,
-    DW_LANG_Ada95 = 0x000d,
-    DW_LANG_Fortran95 = 0x000e,
-    DW_LANG_PL1 = 0x000f,
-    DW_LANG_Objc = 0x0010,
-    DW_LANG_ObjC_plus_plus = 0x0011,
-    DW_LANG_UPC = 0x0012,
-    DW_LANG_D = 0x0013,
+    DW_LANG_C89 = 0x0001,	     /* ISO C:1989 */
+    DW_LANG_C = 0x0002,		     /* C */
+    DW_LANG_Ada83 = 0x0003,	     /* ISO Ada:1983 */
+    DW_LANG_C_plus_plus	= 0x0004,    /* ISO C++:1998 */
+    DW_LANG_Cobol74 = 0x0005,	     /* ISO Cobol:1974 */
+    DW_LANG_Cobol85 = 0x0006,	     /* ISO Cobol:1985 */
+    DW_LANG_Fortran77 = 0x0007,	     /* ISO FORTRAN 77 */
+    DW_LANG_Fortran90 = 0x0008,	     /* ISO Fortran 90 */
+    DW_LANG_Pascal83 = 0x0009,	     /* ISO Pascal:1983 */
+    DW_LANG_Modula2 = 0x000a,	     /* ISO Modula-2:1996 */
+    DW_LANG_Java = 0x000b,	     /* Java */
+    DW_LANG_C99 = 0x000c,	     /* ISO C:1999 */
+    DW_LANG_Ada95 = 0x000d,	     /* ISO Ada:1995 */
+    DW_LANG_Fortran95 = 0x000e,	     /* ISO Fortran 95 */
+    DW_LANG_PL1 = 0x000f,	     /* ISO PL/1:1976 */
+    DW_LANG_Objc = 0x0010,	     /* Objective-C */
+    DW_LANG_ObjC_plus_plus = 0x0011, /* Objective-C++ */
+    DW_LANG_UPC = 0x0012,	     /* Unified Parallel C */
+    DW_LANG_D = 0x0013,		     /* D */
 
     DW_LANG_lo_user = 0x8000,
     DW_LANG_Mips_Assembler = 0x8001,