* 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.
This commit is contained in:
Pedro Alves
2008-10-27 19:28:52 +00:00
parent aed1add31b
commit 5256a53bb3
2 changed files with 22 additions and 4 deletions

View File

@ -1,3 +1,11 @@
2008-10-27 Pedro Alves <pedro@codesourcery.com>
* 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.
2008-10-27 Pedro Alves <pedro@codesourcery.com> 2008-10-27 Pedro Alves <pedro@codesourcery.com>
* CONTRIBUTE: Mention autoconf 2.59 and configure.ac instead of * CONTRIBUTE: Mention autoconf 2.59 and configure.ac instead of

View File

@ -31,7 +31,7 @@ Boston, MA 02110-1301, USA. */
%{ %{
#include "config.h" #include "defs.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.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. */ after the zeros. A value of 0 does not mean end of string. */
static int static int
parse_escape (const char **string_ptr) cp_parse_escape (const char **string_ptr)
{ {
int target_char; int target_char;
int c = *(*string_ptr)++; int c = *(*string_ptr)++;
@ -1483,7 +1483,7 @@ parse_escape (const char **string_ptr)
if (c == '?') if (c == '?')
return 0177; return 0177;
else if (c == '\\') else if (c == '\\')
target_char = parse_escape (string_ptr); target_char = cp_parse_escape (string_ptr);
else else
target_char = c; target_char = c;
@ -1581,7 +1581,7 @@ yylex (void)
lexptr++; lexptr++;
c = *lexptr++; c = *lexptr++;
if (c == '\\') if (c == '\\')
c = parse_escape (&lexptr); c = cp_parse_escape (&lexptr);
else if (c == '\'') else if (c == '\'')
{ {
yyerror ("empty character constant"); yyerror ("empty character constant");
@ -2084,6 +2084,16 @@ trim_chars (char *lexptr, char **extra_chars)
return c; 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 int
main (int argc, char **argv) main (int argc, char **argv)
{ {