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.
This commit is contained in:
Iain Buclaw 2015-08-11 08:51:05 +02:00
parent 125453567f
commit 3037929188
3 changed files with 22 additions and 22 deletions

View file

@ -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;
}