mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 13:23:04 +00:00
* configure.in: Check the protos of strchr ans strspn.
Replace strchr if needed. * src/system.h: Provide the protos of strchr, strspn and memchr if missing. * lib/strchr.c: New. * src/reader.c (symbols_save): Use strchr.
This commit is contained in:
@@ -1647,13 +1647,11 @@ symbols_save (void)
|
||||
{
|
||||
struct obstack tokendefs;
|
||||
bucket *bp;
|
||||
char *cp, *symbol;
|
||||
char c;
|
||||
obstack_init (&tokendefs);
|
||||
|
||||
for (bp = firstsymbol; bp; bp = bp->next)
|
||||
{
|
||||
symbol = bp->tag; /* get symbol */
|
||||
char *symbol = bp->tag; /* get symbol */
|
||||
|
||||
if (bp->value >= ntokens)
|
||||
continue;
|
||||
@@ -1673,9 +1671,7 @@ symbols_save (void)
|
||||
}
|
||||
|
||||
/* Don't #define nonliteral tokens whose names contain periods. */
|
||||
cp = symbol;
|
||||
while ((c = *cp++) && c != '.');
|
||||
if (c != '\0')
|
||||
if (strchr (symbol, '.'))
|
||||
continue;
|
||||
|
||||
obstack_fgrow2 (&tokendefs, "# define %s\t%d\n",
|
||||
|
||||
12
src/system.h
12
src/system.h
@@ -110,14 +110,26 @@ char *alloca ();
|
||||
char *stpcpy PARAMS ((char *dest, const char *src));
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_STRCHR
|
||||
char *strchr(const char *s, int c);
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_STRNDUP
|
||||
char *strndup PARAMS ((const char *s, size_t size));
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_STRSPN
|
||||
size_t strspn(const char *s, const char *accept);
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_STRNLEN
|
||||
size_t strnlen PARAMS ((const char *s, size_t maxlen));
|
||||
#endif
|
||||
|
||||
#if !HAVE_DECL_MEMCHR
|
||||
void *memchr(const void *s, int c, size_t n);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*-----------------.
|
||||
|
||||
Reference in New Issue
Block a user