aboutsummaryrefslogtreecommitdiff
path: root/gdb/cp-name-parser.y
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2008-10-27 19:28:52 +0000
committerPedro Alves <palves@redhat.com>2008-10-27 19:28:52 +0000
commit5256a53bb3fbf514d1e9a1fed84ce57d7a94ecc8 (patch)
treeba0442f22a8fe344338c4994e0f6d44e5bdd9538 /gdb/cp-name-parser.y
parentaed1add31bf14e0cf760f01ac02437988b5762c3 (diff)
downloadgdb-5256a53bb3fbf514d1e9a1fed84ce57d7a94ecc8.zip
gdb-5256a53bb3fbf514d1e9a1fed84ce57d7a94ecc8.tar.gz
gdb-5256a53bb3fbf514d1e9a1fed84ce57d7a94ecc8.tar.bz2
* cp-name-parser.y: Include defs.h instead of config.h.
(parse_escape): Rename to ... (cp_parse_escape): ... this. (yylex): Update. (xfree) [TEST_CPNAMES]: New.
Diffstat (limited to 'gdb/cp-name-parser.y')
-rw-r--r--gdb/cp-name-parser.y18
1 files changed, 14 insertions, 4 deletions
diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y
index 023e306..e1641f4 100644
--- a/gdb/cp-name-parser.y
+++ b/gdb/cp-name-parser.y
@@ -31,7 +31,7 @@ Boston, MA 02110-1301, USA. */
%{
-#include "config.h"
+#include "defs.h"
#include <stdio.h>
#include <stdlib.h>
@@ -1462,7 +1462,7 @@ c_parse_backslash (int host_char, int *target_char)
after the zeros. A value of 0 does not mean end of string. */
static int
-parse_escape (const char **string_ptr)
+cp_parse_escape (const char **string_ptr)
{
int target_char;
int c = *(*string_ptr)++;
@@ -1483,7 +1483,7 @@ parse_escape (const char **string_ptr)
if (c == '?')
return 0177;
else if (c == '\\')
- target_char = parse_escape (string_ptr);
+ target_char = cp_parse_escape (string_ptr);
else
target_char = c;
@@ -1581,7 +1581,7 @@ yylex (void)
lexptr++;
c = *lexptr++;
if (c == '\\')
- c = parse_escape (&lexptr);
+ c = cp_parse_escape (&lexptr);
else if (c == '\'')
{
yyerror ("empty character constant");
@@ -2084,6 +2084,16 @@ trim_chars (char *lexptr, char **extra_chars)
return c;
}
+/* When this file is built as a standalone program, xmalloc comes from
+ libiberty --- in which case we have to provide xfree ourselves. */
+
+void
+xfree (void *ptr)
+{
+ if (ptr != NULL)
+ free (ptr);
+}
+
int
main (int argc, char **argv)
{