Commit c8724862 by Dave Brolley Committed by Dave Brolley

configure.in (extra_c_objs): add prefix.o.

Thu May 21 11:51:15 1998  Dave Brolley  <brolley@cygnus.com>
	* configure.in (extra_c_objs): add prefix.o.
	(extra_cxx_objs): extra objects for C++ with cpplib.
	* configure: Regenerate.
	* c-tree.h: (get_directive_line): Different prototype for cpplib.
	(GET_DIRECTIVE_LINE): Macro wrapper for get_directive_line.
	* c-lex.h: (get_directive_line): Not needed here for cpplib.
	* c-lex.c: (yy_cur,yy_lim,yy_get_token): Move to c-common.c.
	(GET_DIRECTIVE_LINE): Move to c-common.c and rename to get_directive_line.
	* c-common.c (parse_in,parse_options,cpp_token): Declare for cpplib.
	(yy_cur,yy_lim,yy_get_token,get_directive,line): Moved here from c-lex.c

From-SVN: r19926
parent 39d65850
Thu May 21 11:51:15 1998 Dave Brolley <brolley@cygnus.com>
* configure.in (extra_c_objs): add prefix.o.
(extra_cxx_objs): extra objects for C++ with cpplib.
* configure: Regenerate.
* c-tree.h: (get_directive_line): Different prototype for cpplib.
(GET_DIRECTIVE_LINE): Macro wrapper for get_directive_line.
* c-lex.h: (get_directive_line): Not needed here for cpplib.
* c-lex.c: (yy_cur,yy_lim,yy_get_token): Move to c-common.c.
(GET_DIRECTIVE_LINE): Move to c-common.c and rename to get_directive_line.
* c-common.c (parse_in,parse_options,cpp_token): Declare for cpplib.
(yy_cur,yy_lim,yy_get_token,get_directive,line): Moved here from c-lex.c
Thu May 21 09:04:42 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gengenrtl.c (type_from_format, accessor_from_format): Change
......
......@@ -28,6 +28,13 @@ Boston, MA 02111-1307, USA. */
#include "toplev.h"
#include "output.h"
#if USE_CPPLIB
#include "cpplib.h"
cpp_reader parse_in;
cpp_options parse_options;
static enum cpp_token cpp_token;
#endif
#ifndef WCHAR_TYPE_SIZE
#ifdef INT_TYPE_SIZE
#define WCHAR_TYPE_SIZE INT_TYPE_SIZE
......@@ -2673,6 +2680,105 @@ truthvalue_conversion (expr)
return build_binary_op (NE_EXPR, expr, integer_zero_node, 1);
}
#if USE_CPPLIB
/* Read the rest of a #-directive from input stream FINPUT.
In normal use, the directive name and the white space after it
have already been read, so they won't be included in the result.
We allow for the fact that the directive line may contain
a newline embedded within a character or string literal which forms
a part of the directive.
The value is a string in a reusable buffer. It remains valid
only until the next time this function is called. */
unsigned char *yy_cur, *yy_lim;
#define GETC() (yy_cur < yy_lim ? *yy_cur++ : yy_get_token ())
#define UNGETC(c) ((c), yy_cur--)
int
yy_get_token ()
{
for (;;)
{
parse_in.limit = parse_in.token_buffer;
cpp_token = cpp_get_token (&parse_in);
if (cpp_token == CPP_EOF)
return -1;
yy_lim = CPP_PWRITTEN (&parse_in);
yy_cur = parse_in.token_buffer;
if (yy_cur < yy_lim)
return *yy_cur++;
}
}
char *
get_directive_line ()
{
static char *directive_buffer = NULL;
static unsigned buffer_length = 0;
register char *p;
register char *buffer_limit;
register int looking_for = 0;
register int char_escaped = 0;
if (buffer_length == 0)
{
directive_buffer = (char *)xmalloc (128);
buffer_length = 128;
}
buffer_limit = &directive_buffer[buffer_length];
for (p = directive_buffer; ; )
{
int c;
/* Make buffer bigger if it is full. */
if (p >= buffer_limit)
{
register unsigned bytes_used = (p - directive_buffer);
buffer_length *= 2;
directive_buffer
= (char *)xrealloc (directive_buffer, buffer_length);
p = &directive_buffer[bytes_used];
buffer_limit = &directive_buffer[buffer_length];
}
c = GETC ();
/* Discard initial whitespace. */
if ((c == ' ' || c == '\t') && p == directive_buffer)
continue;
/* Detect the end of the directive. */
if (c == '\n' && looking_for == 0)
{
UNGETC (c);
c = '\0';
}
*p++ = c;
if (c == 0)
return directive_buffer;
/* Handle string and character constant syntax. */
if (looking_for)
{
if (looking_for == c && !char_escaped)
looking_for = 0; /* Found terminator... stop looking. */
}
else
if (c == '\'' || c == '"')
looking_for = c; /* Don't stop buffering until we see another
another one of these (or an EOF). */
/* Handle backslash. */
char_escaped = (c == '\\' && ! char_escaped);
}
}
#else
/* Read the rest of a #-directive from input stream FINPUT.
In normal use, the directive name and the white space after it
have already been read, so they won't be included in the result.
......@@ -2755,6 +2861,7 @@ get_directive_line (finput)
char_escaped = (c == '\\' && ! char_escaped);
}
}
#endif /* !USE_CPPLIB */
/* Make a variant type in the proper way for C/C++, propagating qualifiers
down to the element type of an array. */
......
......@@ -46,9 +46,8 @@ Boston, MA 02111-1307, USA. */
#if USE_CPPLIB
#include "cpplib.h"
cpp_reader parse_in;
cpp_options parse_options;
static enum cpp_token cpp_token;
extern cpp_reader parse_in;
extern cpp_options parse_options;
#else
/* Stream for reading from the input file. */
FILE *finput;
......@@ -63,24 +62,10 @@ tree ridpointers[(int) RID_MAX];
#define YYDEBUG 1
#if USE_CPPLIB
static unsigned char *yy_cur, *yy_lim;
int
yy_get_token ()
{
for (;;)
{
parse_in.limit = parse_in.token_buffer;
cpp_token = cpp_get_token (&parse_in);
if (cpp_token == CPP_EOF)
return -1;
yy_lim = CPP_PWRITTEN (&parse_in);
yy_cur = parse_in.token_buffer;
if (yy_cur < yy_lim)
return *yy_cur++;
}
}
extern unsigned char *yy_cur, *yy_lim;
extern int yy_get_token ();
#define GETC() (yy_cur < yy_lim ? *yy_cur++ : yy_get_token ())
#define UNGETC(c) ((c), yy_cur--)
#else
......@@ -498,88 +483,6 @@ extend_token_buffer (p)
return token_buffer + offset;
}
#if !USE_CPPLIB
#define GET_DIRECTIVE_LINE() get_directive_line (finput)
#else /* USE_CPPLIB */
/* Read the rest of a #-directive from input stream FINPUT.
In normal use, the directive name and the white space after it
have already been read, so they won't be included in the result.
We allow for the fact that the directive line may contain
a newline embedded within a character or string literal which forms
a part of the directive.
The value is a string in a reusable buffer. It remains valid
only until the next time this function is called. */
static char *
GET_DIRECTIVE_LINE ()
{
static char *directive_buffer = NULL;
static unsigned buffer_length = 0;
register char *p;
register char *buffer_limit;
register int looking_for = 0;
register int char_escaped = 0;
if (buffer_length == 0)
{
directive_buffer = (char *)xmalloc (128);
buffer_length = 128;
}
buffer_limit = &directive_buffer[buffer_length];
for (p = directive_buffer; ; )
{
int c;
/* Make buffer bigger if it is full. */
if (p >= buffer_limit)
{
register unsigned bytes_used = (p - directive_buffer);
buffer_length *= 2;
directive_buffer
= (char *)xrealloc (directive_buffer, buffer_length);
p = &directive_buffer[bytes_used];
buffer_limit = &directive_buffer[buffer_length];
}
c = GETC ();
/* Discard initial whitespace. */
if ((c == ' ' || c == '\t') && p == directive_buffer)
continue;
/* Detect the end of the directive. */
if (c == '\n' && looking_for == 0)
{
UNGETC (c);
c = '\0';
}
*p++ = c;
if (c == 0)
return directive_buffer;
/* Handle string and character constant syntax. */
if (looking_for)
{
if (looking_for == c && !char_escaped)
looking_for = 0; /* Found terminator... stop looking. */
}
else
if (c == '\'' || c == '"')
looking_for = c; /* Don't stop buffering until we see another
one of these (or an EOF). */
/* Handle backslash. */
char_escaped = (c == '\\' && ! char_escaped);
}
}
#endif /* USE_CPPLIB */
/* At the beginning of a line, increment the line number
and process any #-directive on this line.
If the line is a #-directive, read the entire line and return a newline.
......
......@@ -81,8 +81,6 @@ extern int check_newline PROTO((void));
extern int yylex PROTO((void));
extern void yyerror PROTO((char *));
extern char *get_directive_line PROTO((FILE *));
extern void forget_protocol_qualifiers PROTO((void));
extern void remember_protocol_qualifiers PROTO((void));
extern tree is_class_name PROTO((tree));
......@@ -180,7 +180,14 @@ extern tree convert_and_check PROTO((tree, tree));
extern void overflow_warning PROTO((tree));
extern void unsigned_conversion_warning PROTO((tree, tree));
/* Read the rest of the current #-directive line. */
#if USE_CPPLIB
extern char *get_directive_line PROTO((void));
#define GET_DIRECTIVE_LINE() get_directive_line ()
#else
extern char *get_directive_line PROTO((FILE *));
#define GET_DIRECTIVE_LINE() get_directive_line (finput)
#endif
/* Subroutine of build_binary_op, used for comparison operations.
See if the operands have both been converted from subword integer types
and, if so, perhaps change them both back to their original type. */
......
......@@ -89,6 +89,8 @@ AC_ARG_ENABLE(c-cpplib,
[ --enable-c-cpplib Use cpplib for C.],
if [[[ x$enable_c_cpplib != xno ]]]; then
extra_c_objs="${extra_c_objs} cpplib.o cppexp.o cpphash.o cpperror.o"
extra_c_objs="${extra_c_objs} prefix.o"
extra_cxx_objs="${extra_cxx_objs} ../cpplib.o ../cppexp.o ../cpphash.o ../cpperror.o ../prefix.o"
extra_c_flags=-DUSE_CPPLIB=1
fi)
......@@ -3430,6 +3432,7 @@ AC_SUBST(extra_passes)
AC_SUBST(extra_programs)
AC_SUBST(extra_parts)
AC_SUBST(extra_c_objs)
AC_SUBST(extra_cxx_objs)
AC_SUBST(extra_c_flags)
AC_SUBST(extra_objs)
AC_SUBST(host_extra_gcc_objs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment