d-demangle.c (dlang_parse_real): Remove stack buffer, write the demangled hexadecimal directly to string.
libiberty/ChangeLog: * d-demangle.c (dlang_parse_real): Remove stack buffer, write the demangled hexadecimal directly to string. * testsuite/d-demangle-expected: Add tests. From-SVN: r248537
This commit is contained in:
parent
b9396a495c
commit
1a122a71ee
3 changed files with 18 additions and 17 deletions
|
@ -1,3 +1,9 @@
|
|||
2017-05-27 Iain Buclaw <ibuclaw@gdcproject.org>
|
||||
|
||||
* d-demangle.c (dlang_parse_real): Remove stack buffer, write
|
||||
the demangled hexadecimal directly to string.
|
||||
* testsuite/d-demangle-expected: Add tests.
|
||||
|
||||
2017-05-24 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* waitpid.c (wait) [__MINGW32__]: Define as a macro
|
||||
|
|
|
@ -1025,9 +1025,6 @@ dlang_parse_integer (string *decl, const char *mangled, char type)
|
|||
static const char *
|
||||
dlang_parse_real (string *decl, const char *mangled)
|
||||
{
|
||||
char buffer[64];
|
||||
int len = 0;
|
||||
|
||||
/* Handle NAN and +-INF. */
|
||||
if (strncmp (mangled, "NAN", 3) == 0)
|
||||
{
|
||||
|
@ -1051,23 +1048,22 @@ dlang_parse_real (string *decl, const char *mangled)
|
|||
/* Hexadecimal prefix and leading bit. */
|
||||
if (*mangled == 'N')
|
||||
{
|
||||
buffer[len++] = '-';
|
||||
string_append (decl, "-");
|
||||
mangled++;
|
||||
}
|
||||
|
||||
if (!ISXDIGIT (*mangled))
|
||||
return NULL;
|
||||
|
||||
buffer[len++] = '0';
|
||||
buffer[len++] = 'x';
|
||||
buffer[len++] = *mangled;
|
||||
buffer[len++] = '.';
|
||||
string_append (decl, "0x");
|
||||
string_appendn (decl, mangled, 1);
|
||||
string_append (decl, ".");
|
||||
mangled++;
|
||||
|
||||
/* Significand. */
|
||||
while (ISXDIGIT (*mangled))
|
||||
{
|
||||
buffer[len++] = *mangled;
|
||||
string_appendn (decl, mangled, 1);
|
||||
mangled++;
|
||||
}
|
||||
|
||||
|
@ -1075,26 +1071,21 @@ dlang_parse_real (string *decl, const char *mangled)
|
|||
if (*mangled != 'P')
|
||||
return NULL;
|
||||
|
||||
buffer[len++] = 'p';
|
||||
string_append (decl, "p");
|
||||
mangled++;
|
||||
|
||||
if (*mangled == 'N')
|
||||
{
|
||||
buffer[len++] = '-';
|
||||
string_append (decl, "-");
|
||||
mangled++;
|
||||
}
|
||||
|
||||
while (ISDIGIT (*mangled))
|
||||
{
|
||||
buffer[len++] = *mangled;
|
||||
string_appendn (decl, mangled, 1);
|
||||
mangled++;
|
||||
}
|
||||
|
||||
/* Write out the demangled hexadecimal, rather than trying to
|
||||
convert the buffer into a floating-point value. */
|
||||
buffer[len] = '\0';
|
||||
len = strlen (buffer);
|
||||
string_appendn (decl, buffer, len);
|
||||
return mangled;
|
||||
}
|
||||
|
||||
|
|
|
@ -838,6 +838,10 @@ _D8demangle52__T4testVrcN0C4CCCCCCCCCCCCCDP4c0B666666666666666P6Zv
|
|||
demangle.test!(-0x0.C4CCCCCCCCCCCCCDp4+0x0.B666666666666666p6i)
|
||||
#
|
||||
--format=dlang
|
||||
_D8demangle91__T4testVde000111222333444555666777888999AAABBBCCCDDDEEEFFFP000111222333444555666777888999Zv
|
||||
demangle.test!(0x0.00111222333444555666777888999AAABBBCCCDDDEEEFFFp000111222333444555666777888999)
|
||||
#
|
||||
--format=dlang
|
||||
_D8demangle22__T4testVG3ua3_616263Zv
|
||||
demangle.test!("abc")
|
||||
#
|
||||
|
|
Loading…
Add table
Reference in a new issue