diff mbox

[1/2,libiberty] Sync with upstream gcc.

Message ID CABOHX+fCr6NhFrREEnj4UwDC6Gx_vZVtjG+qcCkLOyQVQb43vQ@mail.gmail.com
State New
Headers show

Commit Message

Iain Buclaw Jan. 27, 2016, 10:53 p.m. UTC
Hi,

This patch to syncs libiberty with upstream gcc.

Only additions are recent improvements to the dlang demangler, and
support for new features of the upcoming release.  Will follow up with
a patch for the demangling tests on gdb's side.

Iain.

Comments

Yao Qi Jan. 28, 2016, 10:26 a.m. UTC | #1
Iain Buclaw <ibuclaw@gdcproject.org> writes:

> This patch to syncs libiberty with upstream gcc.
>
> Only additions are recent improvements to the dlang demangler, and
> support for new features of the upcoming release.  Will follow up with
> a patch for the demangling tests on gdb's side.

Hi Iain,
The "obvious rule" can apply to the changes like this, so you can commit it.
Iain Buclaw Jan. 28, 2016, 11:20 a.m. UTC | #2
On 28 January 2016 at 11:26, Yao Qi <qiyaoltc@gmail.com> wrote:
> Iain Buclaw <ibuclaw@gdcproject.org> writes:
>
>> This patch to syncs libiberty with upstream gcc.
>>
>> Only additions are recent improvements to the dlang demangler, and
>> support for new features of the upcoming release.  Will follow up with
>> a patch for the demangling tests on gdb's side.
>
> Hi Iain,
> The "obvious rule" can apply to the changes like this, so you can commit it.
>

Hi Yao,

Thanks.  Is there any reference to the "obvious rule", or is it an
unwritten one? :-)

Iain
Yao Qi Jan. 28, 2016, 2:43 p.m. UTC | #3
Iain Buclaw <ibuclaw@gdcproject.org> writes:

> Thanks.  Is there any reference to the "obvious rule", or is it an
> unwritten one? :-)

It is described in gdb/MAINTAINERS.
diff mbox

Patch


libiberty/
2016-01-27  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_call_convention): Handle extern Objective-C
	function calling convention.
	(dlang_call_convention_p): Likewise.
	(dlang_type): Likewise.
	* testsuite/d-demangle-expected: Add coverage tests.

2016-01-27  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_function_args): Append ',' for variadic functions
	only if parameters were seen before the elipsis symbol.
	* testsuite/d-demangle-expected: Add coverage test for parameter-less
	variadic functions.

2016-01-27  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_type): Handle function types only in the context
	of seeing a pointer type symbol.
	* testsuite/d-demangle-expected: Update function pointer tests.

diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c
index 3d7ccf6..4ad90a6 100644
--- a/libiberty/d-demangle.c
+++ b/libiberty/d-demangle.c
@@ -1,5 +1,5 @@ 
 /* Demangler for the D programming language
-   Copyright 2014, 2015 Free Software Foundation, Inc.
+   Copyright 2014, 2015, 2016 Free Software Foundation, Inc.
    Written by Iain Buclaw (ibuclaw@gdcproject.org)
 
 This file is part of the libiberty library.
@@ -223,6 +223,10 @@  dlang_call_convention (string *decl, const char *mangled)
       mangled++;
       string_append (decl, "extern(C++) ");
       break;
+    case 'Y': /* (Objective-C) */
+      mangled++;
+      string_append (decl, "extern(Objective-C) ");
+      break;
     default:
       return NULL;
     }
@@ -399,7 +403,9 @@  dlang_function_args (string *decl, const char *mangled)
 	  return mangled;
 	case 'Y': /* (variadic T t, ...) style.  */
 	  mangled++;
-	  string_append (decl, ", ...");
+	  if (n != 0)
+	    string_append (decl, ", ");
+	  string_append (decl, "...");
 	  return mangled;
 	case 'Z': /* Normal function.  */
 	  mangled++;
@@ -533,6 +539,15 @@  dlang_type (string *decl, const char *mangled)
     }
     case 'P': /* pointer (T*) */
       mangled++;
+      /* Function pointer types don't include the trailing asterisk.  */
+      switch (*mangled)
+	{
+	case 'F': case 'U': case 'W':
+	case 'V': case 'R': case 'Y':
+	  mangled = dlang_function_type (decl, mangled);
+	  string_append (decl, "function");
+	  return mangled;
+	}
       mangled = dlang_type (decl, mangled);
       string_append (decl, "*");
       return mangled;
@@ -564,13 +579,6 @@  dlang_type (string *decl, const char *mangled)
       mangled++;
       return dlang_parse_tuple (decl, mangled);
 
-    /* Function types */
-    case 'F': case 'U': case 'W':
-    case 'V': case 'R':
-      mangled = dlang_function_type (decl, mangled);
-      string_append (decl, "function");
-      return mangled;
-
     /* Basic types */
     case 'n':
       mangled++;
@@ -1334,7 +1342,7 @@  dlang_call_convention_p (const char *mangled)
   switch (*mangled)
     {
     case 'F': case 'U': case 'V':
-    case 'W': case 'R':
+    case 'W': case 'R': case 'Y':
       return 1;
 
     default:
diff --git a/libiberty/testsuite/d-demangle-expected b/libiberty/testsuite/d-demangle-expected
index 2b1cc4f..04d39f4 100644
--- a/libiberty/testsuite/d-demangle-expected
+++ b/libiberty/testsuite/d-demangle-expected
@@ -342,6 +342,10 @@  _D8demangle4testFaaYv
 demangle.test(char, char, ...)
 #
 --format=dlang
+_D8demangle4testFYv
+demangle.test(...)
+#
+--format=dlang
 _D8demangle4testFaaZv
 demangle.test(char, char)
 #
@@ -390,26 +394,34 @@  _D8demangle4testFDRZaZv
 demangle.test(extern(C++) char() delegate)
 #
 --format=dlang
-_D8demangle4testFFZaZv
+_D8demangle4testFDYZaZv
+demangle.test(extern(Objective-C) char() delegate)
+#
+--format=dlang
+_D8demangle4testFPFZaZv
 demangle.test(char() function)
 #
 --format=dlang
-_D8demangle4testFUZaZv
+_D8demangle4testFPUZaZv
 demangle.test(extern(C) char() function)
 #
 --format=dlang
-_D8demangle4testFWZaZv
+_D8demangle4testFPWZaZv
 demangle.test(extern(Windows) char() function)
 #
 --format=dlang
-_D8demangle4testFVZaZv
+_D8demangle4testFPVZaZv
 demangle.test(extern(Pascal) char() function)
 #
 --format=dlang
-_D8demangle4testFRZaZv
+_D8demangle4testFPRZaZv
 demangle.test(extern(C++) char() function)
 #
 --format=dlang
+_D8demangle4testFPYZaZv
+demangle.test(extern(Objective-C) char() function)
+#
+--format=dlang
 _D8demangle4testFDFNaZaZv
 demangle.test(char() pure delegate)
 #
@@ -466,59 +478,59 @@  _D8demangle4testFNjNkDFNjZaZv
 demangle.test(return char() return delegate)
 #
 --format=dlang
-_D8demangle4testFFNaZaZv
+_D8demangle4testFPFNaZaZv
 demangle.test(char() pure function)
 #
 --format=dlang
-_D8demangle4testFFNbZaZv
+_D8demangle4testFPFNbZaZv
 demangle.test(char() nothrow function)
 #
 --format=dlang
-_D8demangle4testFFNcZaZv
+_D8demangle4testFPFNcZaZv
 demangle.test(char() ref function)
 #
 --format=dlang
-_D8demangle4testFFNdZaZv
+_D8demangle4testFPFNdZaZv
 demangle.test(char() @property function)
 #
 --format=dlang
-_D8demangle4testFFNeZaZv
+_D8demangle4testFPFNeZaZv
 demangle.test(char() @trusted function)
 #
 --format=dlang
-_D8demangle4testFFNfZaZv
+_D8demangle4testFPFNfZaZv
 demangle.test(char() @safe function)
 #
 --format=dlang
-_D8demangle4testFFNiZaZv
+_D8demangle4testFPFNiZaZv
 demangle.test(char() @nogc function)
 #
 --format=dlang
-_D8demangle4testFFNaNbZaZv
+_D8demangle4testFPFNaNbZaZv
 demangle.test(char() pure nothrow function)
 #
 --format=dlang
-_D8demangle4testFFNbNaZaZv
+_D8demangle4testFPFNbNaZaZv
 demangle.test(char() nothrow pure function)
 #
 --format=dlang
-_D8demangle4testFFNdNfNaZaZv
+_D8demangle4testFPFNdNfNaZaZv
 demangle.test(char() @property @safe pure function)
 #
 --format=dlang
-_D8demangle4testFNjFZaZv
+_D8demangle4testFNjPFZaZv
 demangle.test(char() function)
 #
 --format=dlang
-_D8demangle4testFNkFZaZv
+_D8demangle4testFNkPFZaZv
 demangle.test(return char() function)
 #
 --format=dlang
-_D8demangle4testFFNjZaZv
+_D8demangle4testFPFNjZaZv
 demangle.test(char() return function)
 #
 --format=dlang
-_D8demangle4testFNjNkFNjZaZv
+_D8demangle4testFNjNkPFNjZaZv
 demangle.test(return char() return function)
 #
 --format=dlang
@@ -989,7 +1001,7 @@  object.TypeInfo_Array.argTypes(out TypeInfo, out TypeInfo)
 #
 --format=dlang
 _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv
-rt.dmain2._d_run_main(int, char**, extern(C) int(char[][]) function*).tryExec(scope void() delegate)
+rt.dmain2._d_run_main(int, char**, extern(C) int(char[][]) function).tryExec(scope void() delegate)
 #
 --format=dlang
 _D6object9Exception6__ctorMFNaNbNfAyaAyamC6object9ThrowableZC9Exception