aboutsummaryrefslogtreecommitdiff
path: root/libiberty/d-demangle.c
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2015-08-11 08:51:05 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2015-08-11 09:14:12 +0200
commit30379291886a171e6dc202122bc1c583318c2e17 (patch)
tree49b7398e2b12604f106f2407003db769236e4bbc /libiberty/d-demangle.c
parent125453567f4a0abc68cfc67a3df46be1aa9bb904 (diff)
downloadgdb-30379291886a171e6dc202122bc1c583318c2e17.zip
gdb-30379291886a171e6dc202122bc1c583318c2e17.tar.gz
gdb-30379291886a171e6dc202122bc1c583318c2e17.tar.bz2
PR gdb/18669 libiberty demangle.test failure: strtod() on sparc-sun-solaris2.9
Test symbols did not demangle as per the d-demangle-expected tests because strtod() on Solaris 9 does not accept hexadecimal numbers. This has now been fixed up so that no attempt at formatting/converting the demangled hexadecimal literals are done. libiberty/ChangeLog: 2015-08-11 Iain Buclaw <ibuclaw@gdcproject.org> * d-demangle.c (dlang_parse_real): Remove call to strtod. (strtod): Remove declaration. * testsuite/d-demangle-expected: Update float and complex literal tests to check correct hexadecimal demangling.
Diffstat (limited to 'libiberty/d-demangle.c')
-rw-r--r--libiberty/d-demangle.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c
index a2a3b32..3d7ccf6 100644
--- a/libiberty/d-demangle.c
+++ b/libiberty/d-demangle.c
@@ -28,7 +28,7 @@ If not, see <http://www.gnu.org/licenses/>. */
/* This file exports one function; dlang_demangle.
- This file imports strtol and strtod for decoding mangled literals. */
+ This file imports strtol for decoding mangled literals. */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -44,7 +44,6 @@ If not, see <http://www.gnu.org/licenses/>. */
#include <stdlib.h>
#else
extern long strtol (const char *nptr, char **endptr, int base);
-extern double strtod (const char *nptr, char **endptr);
#endif
#include <demangle.h>
@@ -970,8 +969,6 @@ dlang_parse_real (string *decl, const char *mangled)
{
char buffer[64];
int len = 0;
- double value;
- char *endptr;
/* Handle NAN and +-INF. */
if (strncmp (mangled, "NAN", 3) == 0)
@@ -1035,14 +1032,10 @@ dlang_parse_real (string *decl, const char *mangled)
mangled++;
}
- /* Convert buffer from hexadecimal to floating-point. */
+ /* Write out the demangled hexadecimal, rather than trying to
+ convert the buffer into a floating-point value. */
buffer[len] = '\0';
- value = strtod (buffer, &endptr);
-
- if (endptr == NULL || endptr != (buffer + len))
- return NULL;
-
- len = snprintf (buffer, sizeof(buffer), "%#g", value);
+ len = strlen (buffer);
string_appendn (decl, buffer, len);
return mangled;
}