diff --git a/src/acconfig.h b/src/acconfig.h index a8480b20100db3e1271768e29c7d0c23386ef125..ed790d42f519b59a5690a71361723a1b926b2998 100644 --- a/src/acconfig.h +++ b/src/acconfig.h @@ -1,5 +1,5 @@ /* - * $Id: acconfig.h,v 1.71 2000/12/27 10:38:16 mirar Exp $ + * $Id: acconfig.h,v 1.72 2001/01/20 01:15:44 grubba Exp $ */ #ifndef MACHINE_H #define MACHINE_H @@ -361,6 +361,9 @@ /* Enable tracing of the compiler */ #undef YYDEBUG +/* The type of the last argument to __yy_memcpy (usually unsigned int). */ +#define YY_COUNT_TYPE unsigned int + /* Define if your compiler has a symbol __func__ */ #undef HAVE_WORKING___FUNC__ diff --git a/src/configure.in b/src/configure.in index e73c09c7f10844bc064729dacca0a862d902bb38..b4f69a05d863b7342638aac0119c2aa8bdc691b3 100644 --- a/src/configure.in +++ b/src/configure.in @@ -1,4 +1,4 @@ -AC_REVISION("$Id: configure.in,v 1.456 2001/01/19 19:45:00 grubba Exp $") +AC_REVISION("$Id: configure.in,v 1.457 2001/01/20 01:15:43 grubba Exp $") AC_INIT(interpret.c) AC_CONFIG_HEADER(machine.h) @@ -1460,6 +1460,50 @@ else AC_MSG_RESULT($YACC) fi +AC_MSG_CHECKING(for the type of the last argument to __yy_memcpy) +AC_CACHE_VAL(pike_cv___yy_memcpy_count_type, [ + pike_cv___yy_memcpy_count_type=unknown + for count_type in "unsigned int" "size_t" "int"; do + cat >conftest.y<<\EOF +%pure_parser +%{ +#include <stdio.h> + +#ifndef __GNUC__ +#ifndef __cplusplus +static void __yy_memcpy(char *to, char *from, $count_type count); +#endif /* !__cplusplus */ +#endif /* !__GNUC__ */ +%} +%% +all: foo bar +foo: 'f' 'o' 'o' { fprintf(stderr, "foo\n"); } ; +bar: 'b' 'a' 'r' ; +%% +int yylex(YYSTYPE *yylval) { return 'f'; } +void yyerror(char *err) { fprintf(stderr, "ERR: %s\n", err); } +EOF + if $YACC -d conftest.y 1>&5 2>&5; then + AC_TRY_LINK([ +#include "y.tab.c" + ], [ + yyparse(); + exit(0); + ], [ + pike_cv___yy_memcpy_count_type=$count_type + break + ]) + fi + done +]) +AC_MSG_RESULT($pike_cv___yy_memcpy_count_type) +if test "x$pike_cv___yy_memcpy_count_type" = "xunknown"; then + AC_MSG_WARN([Defaulting to unsigned int.]) + AC_DEFINE(YY_COUNT_TYPE, [unsigned int]) +else + AC_DEFINE_UNQUOTED(YY_COUNT_TYPE, $pike_cv___yy_memcpy_count_type) +fi + ############################################################################# ## At this point we have found all binaries we are going to use. diff --git a/src/language.yacc b/src/language.yacc index b21711eafab7cfb923245979cc14eb1ee902a2fd..fa9c01686200230b5354b6e277236e75edda12d4 100644 --- a/src/language.yacc +++ b/src/language.yacc @@ -110,7 +110,7 @@ /* This is the grammar definition of Pike. */ #include "global.h" -RCSID("$Id: language.yacc,v 1.222 2001/01/16 09:36:30 hubbe Exp $"); +RCSID("$Id: language.yacc,v 1.223 2001/01/20 01:15:44 grubba Exp $"); #ifdef HAVE_MEMORY_H #include <memory.h> #endif @@ -154,7 +154,7 @@ static struct program_state *inherit_state = NULL; */ #ifndef __GNUC__ #ifndef __cplusplus -static void __yy_memcpy(char *to, char *from, unsigned int count); +static void __yy_memcpy(char *to, char *from, YY_COUNT_TYPE count); #endif /* !__cplusplus */ #endif /* !__GNUC__ */