c-common.c: Remove USE_CPPLIB conditional inclusions.

* c-common.c: Remove USE_CPPLIB conditional inclusions.
        * c-common.h: Similarly.
        * c-decl.c: Similarly.
        * c-lang.c: Similarly.
        * c-lex.c: Similarly.
        * c-parse.in: Similarly.
        * c-pragma.c: Similarly.
        * c-pragma.h: Similarly.
        * gcc.c: Similarly.
        * toplev.c: Similarly.
        * cp/cp-tree.h: Similarly.
        * cp/decl2.c: Similarly.
        * cp/lang-specs.h: Similarly.
        * cp/lex.c: Similarly.
        * cp/lex.h: Similarly.
        * cp/spew.c: Similarly.
        * java/lang-options.h: Similarly.
        * objc/lang-specs.h: Similarly.
        * objc/objc-act.c: Similarly.

        * configure.in: Remove configure option.
        * config.in: Regenerate.
        * configure: Regenerate.

From-SVN: r37742
This commit is contained in:
Neil Booth 2000-11-25 19:28:44 +00:00 committed by Neil Booth
parent 3e8aa6e31c
commit a32f2771a5
23 changed files with 284 additions and 1285 deletions

View File

@ -1,3 +1,29 @@
2000-11-25 Neil Booth <neilb@earthling.net>
* c-common.c: Remove USE_CPPLIB conditional inclusions.
* c-common.h: Similarly.
* c-decl.c: Similarly.
* c-lang.c: Similarly.
* c-lex.c: Similarly.
* c-parse.in: Similarly.
* c-pragma.c: Similarly.
* c-pragma.h: Similarly.
* gcc.c: Similarly.
* toplev.c: Similarly.
* cp/cp-tree.h: Similarly.
* cp/decl2.c: Similarly.
* cp/lang-specs.h: Similarly.
* cp/lex.c: Similarly.
* cp/lex.h: Similarly.
* cp/spew.c: Similarly.
* java/lang-options.h: Similarly.
* objc/lang-specs.h: Similarly.
* objc/objc-act.c: Similarly.
* configure.in: Remove configure option.
* config.in: Regenerate.
* configure: Regenerate.
2000-11-25 Richard Henderson <rth@redhat.com>
* haifa-sched.c (sched_analyze_1, sched_analyze_2, sched_analyze):

View File

@ -34,11 +34,8 @@ Boston, MA 02111-1307, USA. */
#include "intl.h"
#include "diagnostic.h"
#include "obstack.h"
#if USE_CPPLIB
#include "cpplib.h"
cpp_reader parse_in;
#endif
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE TYPE_PRECISION (wchar_type_node)
@ -4710,91 +4707,6 @@ 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.
The terminating character ('\n' or EOF) is left in FINPUT for the
caller to re-read. */
char *
get_directive_line (finput)
register FILE *finput;
{
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 (finput);
/* Discard initial whitespace. */
if ((c == ' ' || c == '\t') && p == directive_buffer)
continue;
/* Detect the end of the directive. */
if (looking_for == 0
&& (c == '\n' || c == EOF))
{
ungetc (c, finput);
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 */
/* Make a variant type in the proper way for C/C++, propagating qualifiers
down to the element type of an array. */

View File

@ -463,13 +463,8 @@ extern void overflow_warning PARAMS ((tree));
extern void unsigned_conversion_warning PARAMS ((tree, tree));
/* Read the rest of the current #-directive line. */
#if USE_CPPLIB
extern char *get_directive_line PARAMS ((void));
#define GET_DIRECTIVE_LINE() get_directive_line ()
#else
extern char *get_directive_line PARAMS ((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

View File

@ -41,11 +41,8 @@ Boston, MA 02111-1307, USA. */
#include "defaults.h"
#include "ggc.h"
#include "tm_p.h"
#if USE_CPPLIB
#include "cpplib.h"
extern cpp_reader parse_in;
#endif
/* In grokdeclarator, distinguish syntactic contexts of declarators. */
enum decl_context
@ -512,11 +509,8 @@ c_decode_option (argc, argv)
int strings_processed;
const char *option_value = NULL;
char *p = argv[0];
#if USE_CPPLIB
strings_processed = cpp_handle_option (&parse_in, argc, argv);
#else
strings_processed = 0;
#endif /* ! USE_CPPLIB */
if (!strcmp (p, "-lang-objc"))
c_language = clk_objective_c;

View File

@ -34,13 +34,10 @@ Boston, MA 02111-1307, USA. */
#include "expr.h"
#include "c-tree.h"
#include "c-lex.h"
static int c_tree_printer PARAMS ((output_buffer *));
#if USE_CPPLIB
#include "cpplib.h"
extern cpp_reader parse_in;
#endif
static int c_tree_printer PARAMS ((output_buffer *));
/* Each of the functions defined here
is an alternative to a function in objc-actions.c. */
@ -56,10 +53,9 @@ lang_decode_option (argc, argv)
void
lang_init_options ()
{
#if USE_CPPLIB
cpp_init ();
cpp_reader_init (&parse_in, CLK_GNUC89);
#endif
/* Mark as "unspecified". */
flag_bounds_check = -1;
}
@ -80,13 +76,6 @@ lang_init ()
mesg_implicit_function_declaration = 0;
}
/* the beginning of the file is a new line; check for # */
/* With luck, we discover the real source file's name from that
and put it in input_filename. */
#if !USE_CPPLIB
ungetc (check_newline (), finput);
#endif
save_lang_status = &push_c_function_context;
restore_lang_status = &pop_c_function_context;
mark_lang_status = &mark_c_function_context;

View File

@ -53,12 +53,7 @@ Boston, MA 02111-1307, USA. */
#define GET_ENVIRONMENT(ENV_VALUE,ENV_NAME) ((ENV_VALUE) = getenv (ENV_NAME))
#endif
#if USE_CPPLIB
extern cpp_reader parse_in;
#else
/* Stream for reading from the input file. */
FILE *finput;
#endif
/* The original file name, before changing "-" to "stdin". */
static const char *orig_filename;
@ -73,52 +68,6 @@ static splay_tree file_info_tree;
/* Cause the `yydebug' variable to be defined. */
#define YYDEBUG 1
#if !USE_CPPLIB
struct putback_buffer
{
unsigned char *buffer;
int buffer_size;
int index;
};
static struct putback_buffer putback = {NULL, 0, -1};
static inline int getch PARAMS ((void));
static inline int
getch ()
{
if (putback.index != -1)
{
int ch = putback.buffer[putback.index];
--putback.index;
return ch;
}
return getc (finput);
}
static inline void put_back PARAMS ((int));
static inline void
put_back (ch)
int ch;
{
if (ch != EOF)
{
if (putback.index == putback.buffer_size - 1)
{
putback.buffer_size += 16;
putback.buffer = xrealloc (putback.buffer, putback.buffer_size);
}
putback.buffer[++putback.index] = ch;
}
}
int linemode;
#endif
/* File used for outputting assembler code. */
extern FILE *asm_out_file;
@ -128,12 +77,6 @@ extern FILE *asm_out_file;
/* Number of bytes in a wide character. */
#define WCHAR_BYTES (WCHAR_TYPE_SIZE / BITS_PER_UNIT)
#if !USE_CPPLIB
static int maxtoken; /* Current nominal length of token buffer. */
static char *token_buffer; /* Pointer to token buffer.
Actual allocated length is maxtoken + 2. */
#endif
int indent_level; /* Number of { minus number of }. */
int pending_lang_change; /* If we need to switch languages - C++ only */
int c_header_level; /* depth in C headers - C++ only */
@ -151,21 +94,11 @@ static tree lex_string PARAMS ((const char *, unsigned int, int));
static tree lex_charconst PARAMS ((const char *, unsigned int, int));
static void update_header_times PARAMS ((const char *));
static int dump_one_header PARAMS ((splay_tree_node, void *));
#if !USE_CPPLIB
static int skip_white_space PARAMS ((int));
static char *extend_token_buffer PARAMS ((const char *));
static void extend_token_buffer_to PARAMS ((int));
static int read_line_number PARAMS ((int *));
static void process_directive PARAMS ((void));
#else
static void cb_ident PARAMS ((cpp_reader *, const cpp_string *));
static void cb_enter_file PARAMS ((cpp_reader *));
static void cb_leave_file PARAMS ((cpp_reader *));
static void cb_rename_file PARAMS ((cpp_reader *));
static void cb_def_pragma PARAMS ((cpp_reader *));
#endif
const char *
init_c_lex (filename)
@ -193,23 +126,6 @@ init_c_lex (filename)
GET_ENVIRONMENT (literal_codeset, "LANG");
#endif
#if !USE_CPPLIB
/* Open input file. */
if (filename == 0 || !strcmp (filename, "-"))
{
finput = stdin;
filename = "stdin";
}
else
finput = fopen (filename, "r");
if (finput == 0)
pfatal_with_name (filename);
#ifdef IO_BUFFER_SIZE
setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE);
#endif
#else /* !USE_CPPLIB */
parse_in.cb.ident = cb_ident;
parse_in.cb.enter_file = cb_enter_file;
parse_in.cb.leave_file = cb_leave_file;
@ -221,12 +137,7 @@ init_c_lex (filename)
if (filename == 0 || !strcmp (filename, "-"))
filename = "stdin";
#endif
#if !USE_CPPLIB
maxtoken = 40;
token_buffer = (char *) xmalloc (maxtoken + 2);
#endif
/* Start it at 0, because check_newline is called at the very beginning
and will increment it to 1. */
lineno = lex_lineno = 0;
@ -309,140 +220,7 @@ dump_time_statistics ()
splay_tree_foreach (file_info_tree, dump_one_header, 0);
}
#if !USE_CPPLIB
/* If C is not whitespace, return C.
Otherwise skip whitespace and return first nonwhite char read. */
static int
skip_white_space (c)
register int c;
{
for (;;)
{
switch (c)
{
/* There is no need to process comments or backslash-newline
here. None can occur in the output of cpp. Do handle \r
in case someone sent us a .i file. */
case '\n':
if (linemode)
{
put_back (c);
return EOF;
}
c = check_newline ();
break;
case '\r':
/* Per C99, horizontal whitespace is just these four characters. */
case ' ':
case '\t':
case '\f':
case '\v':
c = getch ();
break;
case '\\':
error ("stray '\\' in program");
c = getch ();
break;
default:
return (c);
}
}
}
/* Skips all of the white space at the current location in the input file. */
void
position_after_white_space ()
{
register int c;
c = getch ();
put_back (skip_white_space (c));
}
/* Make the token buffer longer, preserving the data in it.
P should point to just beyond the last valid character in the old buffer.
The value we return is a pointer to the new buffer
at a place corresponding to P. */
static void
extend_token_buffer_to (size)
int size;
{
do
maxtoken = maxtoken * 2 + 10;
while (maxtoken < size);
token_buffer = (char *) xrealloc (token_buffer, maxtoken + 2);
}
static char *
extend_token_buffer (p)
const char *p;
{
int offset = p - token_buffer;
extend_token_buffer_to (offset);
return token_buffer + offset;
}
static int
read_line_number (num)
int *num;
{
tree value;
enum cpp_ttype token = c_lex (&value);
if (token == CPP_NUMBER && TREE_CODE (value) == INTEGER_CST)
{
*num = TREE_INT_CST_LOW (value);
return 1;
}
else
{
if (token != CPP_EOF)
error ("invalid #-line");
return 0;
}
}
/* 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.
Otherwise, return the line's first non-whitespace character. */
int
check_newline ()
{
register int c;
/* Loop till we get a nonblank, non-directive line. */
for (;;)
{
/* Read first nonwhite char on the line. */
do
c = getch ();
while (c == ' ' || c == '\t');
lex_lineno++;
if (c == '#')
{
process_directive ();
return '\n';
}
else if (c != '\n')
break;
}
return c;
}
#if 0 /* Keep this code for a while for reference. */
static void
process_directive ()
{
@ -674,7 +452,7 @@ linenum:
while (getch () != '\n');
}
#else /* USE_CPPLIB */
#endif
/* Not yet handled: #pragma, #define, #undef.
No need to deal with linemarkers under normal conditions. */
@ -810,7 +588,6 @@ cb_def_pragma (pfile)
warning ("ignoring #pragma %s", space);
}
}
#endif /* USE_CPPLIB */
/* Parse a '\uNNNN' or '\UNNNNNNNN' sequence.
@ -1430,7 +1207,6 @@ int
c_lex (value)
tree *value;
{
#if USE_CPPLIB
cpp_token tok;
enum cpp_ttype type;
@ -1493,387 +1269,8 @@ c_lex (value)
}
return type;
#else
int c;
char *p;
int wide_flag = 0;
int objc_flag = 0;
int charconst = 0;
*value = NULL_TREE;
retry:
c = getch ();
/* Effectively do c = skip_white_space (c)
but do it faster in the usual cases. */
while (1)
switch (c)
{
case ' ':
case '\t':
case '\f':
case '\v':
c = getch ();
break;
case '\r':
case '\n':
c = skip_white_space (c);
default:
goto found_nonwhite;
}
found_nonwhite:
lineno = lex_lineno;
switch (c)
{
case EOF:
return CPP_EOF;
case 'L':
/* Capital L may start a wide-string or wide-character constant. */
{
register int c1 = getch();
if (c1 == '\'')
{
wide_flag = 1;
goto char_constant;
}
if (c1 == '"')
{
wide_flag = 1;
goto string_constant;
}
put_back (c1);
}
goto letter;
case '@':
if (!doing_objc_thang)
goto straychar;
else
{
/* '@' may start a constant string object. */
register int c1 = getch ();
if (c1 == '"')
{
objc_flag = 1;
goto string_constant;
}
put_back (c1);
/* Fall through to treat '@' as the start of an identifier. */
}
case 'A': case 'B': case 'C': case 'D': case 'E':
case 'F': case 'G': case 'H': case 'I': case 'J':
case 'K': case 'M': case 'N': case 'O':
case 'P': case 'Q': case 'R': case 'S': case 'T':
case 'U': case 'V': case 'W': case 'X': case 'Y':
case 'Z':
case 'a': case 'b': case 'c': case 'd': case 'e':
case 'f': case 'g': case 'h': case 'i': case 'j':
case 'k': case 'l': case 'm': case 'n': case 'o':
case 'p': case 'q': case 'r': case 's': case 't':
case 'u': case 'v': case 'w': case 'x': case 'y':
case 'z':
case '_':
case '$':
letter:
p = token_buffer;
while (ISALNUM (c) || c == '_' || c == '$' || c == '@')
{
/* Make sure this char really belongs in an identifier. */
if (c == '$')
{
if (! dollars_in_ident)
error ("'$' in identifier");
else if (pedantic)
pedwarn ("'$' in identifier");
}
if (p >= token_buffer + maxtoken)
p = extend_token_buffer (p);
*p++ = c;
c = getch();
}
put_back (c);
if (p >= token_buffer + maxtoken)
p = extend_token_buffer (p);
*p = 0;
*value = get_identifier (token_buffer);
return CPP_NAME;
case '.':
{
/* It's hard to preserve tokenization on '.' because
it could be a symbol by itself, or it could be the
start of a floating point number and cpp won't tell us. */
int c1 = getch ();
if (c1 == '.')
{
int c2 = getch ();
if (c2 == '.')
return CPP_ELLIPSIS;
put_back (c2);
error ("parse error at '..'");
}
else if (c1 == '*' && c_language == clk_cplusplus)
return CPP_DOT_STAR;
put_back (c1);
if (ISDIGIT (c1))
goto number;
}
return CPP_DOT;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
number:
p = token_buffer;
/* Scan the next preprocessing number. All C numeric constants
are preprocessing numbers, but not all preprocessing numbers
are valid numeric constants. Preprocessing numbers fit the
regular expression \.?[0-9]([0-9a-zA-Z_.]|[eEpP][+-])*
See C99 section 6.4.8. */
for (;;)
{
if (p >= token_buffer + maxtoken)
p = extend_token_buffer (p);
*p++ = c;
c = getch();
if (c == '+' || c == '-')
{
int d = p[-1];
if (d == 'e' || d == 'E' || d == 'p' || d == 'P')
continue;
}
if (ISALNUM (c) || c == '_' || c == '.')
continue;
break;
}
put_back (c);
*value = lex_number (token_buffer, p - token_buffer);
return CPP_NUMBER;
case '\'':
char_constant:
charconst = 1;
case '"':
string_constant:
{
int delimiter = charconst ? '\'' : '"';
#ifdef MULTIBYTE_CHARS
int longest_char = local_mb_cur_max ();
(void) local_mbtowc (NULL_PTR, NULL_PTR, 0);
#endif
c = getch ();
p = token_buffer + 1;
while (c != delimiter && c != EOF)
{
if (p + 2 > token_buffer + maxtoken)
p = extend_token_buffer (p);
/* ignore_escape_flag is set for reading the filename in #line. */
if (!ignore_escape_flag && c == '\\')
{
*p++ = c;
*p++ = getch (); /* escaped character */
c = getch ();
continue;
}
else
{
#ifdef MULTIBYTE_CHARS
int i;
int char_len = -1;
for (i = 0; i < longest_char; ++i)
{
if (p + i >= token_buffer + maxtoken)
p = extend_token_buffer (p);
p[i] = c;
char_len = local_mblen (p, i + 1);
if (char_len != -1)
break;
c = getch ();
}
if (char_len == -1)
{
/* Replace all except the first byte. */
put_back (c);
for (--i; i > 0; --i)
put_back (p[i]);
char_len = 1;
}
/* mbtowc sometimes needs an extra char before accepting */
else if (char_len <= i)
put_back (c);
p += char_len;
#else
*p++ = c;
#endif
c = getch ();
}
}
}
if (charconst)
{
*value = lex_charconst (token_buffer + 1, p - (token_buffer + 1),
wide_flag);
return wide_flag ? CPP_WCHAR : CPP_CHAR;
}
else
{
*value = lex_string (token_buffer + 1, p - (token_buffer + 1),
wide_flag);
return wide_flag ? CPP_WSTRING : objc_flag ? CPP_OSTRING : CPP_STRING;
}
case '+':
case '-':
case '&':
case '|':
case ':':
case '<':
case '>':
case '*':
case '/':
case '%':
case '^':
case '!':
case '=':
{
int c1;
enum cpp_ttype type = CPP_EOF;
switch (c)
{
case '+': type = CPP_PLUS; break;
case '-': type = CPP_MINUS; break;
case '&': type = CPP_AND; break;
case '|': type = CPP_OR; break;
case ':': type = CPP_COLON; break;
case '<': type = CPP_LESS; break;
case '>': type = CPP_GREATER; break;
case '*': type = CPP_MULT; break;
case '/': type = CPP_DIV; break;
case '%': type = CPP_MOD; break;
case '^': type = CPP_XOR; break;
case '!': type = CPP_NOT; break;
case '=': type = CPP_EQ; break;
}
c1 = getch ();
if (c1 == '=' && type < CPP_LAST_EQ)
return type + (CPP_EQ_EQ - CPP_EQ);
else if (c == c1)
switch (c)
{
case '+': return CPP_PLUS_PLUS;
case '-': return CPP_MINUS_MINUS;
case '&': return CPP_AND_AND;
case '|': return CPP_OR_OR;
case ':':
if (c_language == clk_cplusplus)
return CPP_SCOPE;
break;
case '<': type = CPP_LSHIFT; goto do_triad;
case '>': type = CPP_RSHIFT; goto do_triad;
}
else
switch (c)
{
case '-':
if (c1 == '>')
{
if (c_language == clk_cplusplus)
{
c1 = getch ();
if (c1 == '*')
return CPP_DEREF_STAR;
put_back (c1);
}
return CPP_DEREF;
}
break;
case '>':
if (c1 == '?' && c_language == clk_cplusplus)
{ type = CPP_MAX; goto do_triad; }
break;
case '<':
if (c1 == ':' && flag_digraphs)
return CPP_OPEN_SQUARE;
if (c1 == '%' && flag_digraphs)
{ indent_level++; return CPP_OPEN_BRACE; }
if (c1 == '?' && c_language == clk_cplusplus)
{ type = CPP_MIN; goto do_triad; }
break;
case ':':
if (c1 == '>' && flag_digraphs)
return CPP_CLOSE_SQUARE;
break;
case '%':
if (c1 == '>' && flag_digraphs)
{ indent_level--; return CPP_CLOSE_BRACE; }
break;
}
put_back (c1);
return type;
do_triad:
c1 = getch ();
if (c1 == '=')
type += (CPP_EQ_EQ - CPP_EQ);
else
put_back (c1);
return type;
}
case '~': return CPP_COMPL;
case '?': return CPP_QUERY;
case ',': return CPP_COMMA;
case '(': return CPP_OPEN_PAREN;
case ')': return CPP_CLOSE_PAREN;
case '[': return CPP_OPEN_SQUARE;
case ']': return CPP_CLOSE_SQUARE;
case '{': indent_level++; return CPP_OPEN_BRACE;
case '}': indent_level--; return CPP_CLOSE_BRACE;
case ';': return CPP_SEMICOLON;
straychar:
default:
if (ISGRAPH (c))
error ("stray '%c' in program", c);
else
error ("stray '\\%#o' in program", c);
goto retry;
}
/* NOTREACHED */
#endif
}
#define ERROR(msgid) do { error(msgid); goto syntax_error; } while(0)
static tree

View File

@ -2830,9 +2830,7 @@ end ifobjc
cpplib.h's token codes into yacc's token codes. */
static enum cpp_ttype last_token;
#if USE_CPPLIB
extern cpp_reader parse_in;
#endif
/* The reserved keyword table. */
struct resword
@ -3137,25 +3135,11 @@ init_parse (filename)
void
finish_parse ()
{
#if USE_CPPLIB
cpp_finish (&parse_in);
errorcount += parse_in.errors;
#else
fclose (finput);
#endif
}
#if USE_CPPLIB
#define NAME(type) cpp_type2name (type)
#else
/* Bleah */
#include "symcat.h"
#define OP(e, s) s,
#define TK(e, s) STRINGX(e),
static const char *type2name[N_TTYPES] = { TTYPE_TABLE };
#define NAME(type) type2name[type]
#endif
static void
yyerror (msgid)
@ -3248,10 +3232,8 @@ _yylex ()
case CPP_DOT: return '.';
case CPP_EOF:
#if USE_CPPLIB
cpp_pop_buffer (&parse_in);
if (! CPP_BUFFER (&parse_in))
#endif
return 0;
goto retry;

View File

@ -32,16 +32,7 @@ Boston, MA 02111-1307, USA. */
#include "c-lex.h"
#include "tm_p.h"
#if USE_CPPLIB
extern cpp_reader parse_in;
#else
struct pragma_entry;
static struct pragma_entry *pragmas;
void cpp_register_pragma PARAMS ((cpp_reader *, const char *, const char *,
void (*) PARAMS ((cpp_reader *)) ));
void cpp_register_pragma_space PARAMS ((cpp_reader *, const char *));
#endif
#define BAD(msgid) do { warning (msgid); return; } while (0)
#define BAD2(msgid, arg) do { warning (msgid, arg); return; } while (0)
@ -312,151 +303,11 @@ handle_pragma_weak (dummy)
}
#endif
#if !USE_CPPLIB
/* Glue version of cpplib's pragma registration and dispatch system. */
struct pragma_entry
{
struct pragma_entry *next;
const char *name;
size_t len;
int isnspace;
union {
void (*handler) PARAMS ((cpp_reader *));
struct pragma_entry *space;
} u;
};
void
cpp_register_pragma_space (pfile, space)
cpp_reader *pfile ATTRIBUTE_UNUSED;
const char *space;
{
struct pragma_entry *new;
const struct pragma_entry *p = pragmas;
size_t len = strlen (space);
while (p)
{
if (p->isnspace && p->len == len && !memcmp (p->name, space, len))
return;
p = p->next;
}
new = (struct pragma_entry *) xmalloc (sizeof (struct pragma_entry));
new->name = space;
new->len = len;
new->isnspace = 1;
new->u.space = 0;
new->next = pragmas;
pragmas = new;
}
void
cpp_register_pragma (pfile, space, name, handler)
cpp_reader *pfile ATTRIBUTE_UNUSED;
const char *space;
const char *name;
void (*handler) PARAMS ((cpp_reader *));
{
struct pragma_entry **x, *new;
size_t len;
x = &pragmas;
if (space)
{
struct pragma_entry *p = pragmas;
len = strlen (space);
while (p)
{
if (p->isnspace && p->len == len && !memcmp (p->name, space, len))
{
x = &p->u.space;
goto found;
}
p = p->next;
}
abort ();
}
found:
new = (struct pragma_entry *) xmalloc (sizeof (struct pragma_entry));
new->name = name;
new->len = strlen (name);
new->isnspace = 0;
new->u.handler = handler;
new->next = *x;
*x = new;
}
/* Called from process_directive() for #pragma lines. */
void
dispatch_pragma ()
{
enum cpp_ttype t;
tree x;
const struct pragma_entry *p;
const char *name, *space = 0;
size_t len;
p = pragmas;
new_space:
t = c_lex (&x);
if (t == CPP_EOF)
return;
if (t != CPP_NAME)
{
warning ("malformed #pragma directive");
return;
}
name = IDENTIFIER_POINTER (x);
len = IDENTIFIER_LENGTH (x);
while (p)
{
if (strlen (p->name) == len && !memcmp (p->name, name, len))
{
if (p->isnspace)
{
space = p->name;
p = p->u.space;
goto new_space;
}
else
{
(*p->u.handler) (0);
return;
}
}
p = p->next;
}
/* Issue a warning message if we have been asked to do so. Ignore
unknown pragmas in system headers unless an explicit
-Wunknown-pragmas has been given. */
if (warn_unknown_pragmas > in_system_header)
{
if (space)
warning ("ignoring #pragma %s %s", space, name);
else
warning ("ignoring #pragma %s", name);
}
}
#endif
void
init_pragma ()
{
cpp_reader *pfile ATTRIBUTE_UNUSED;
#if !USE_CPPLIB
pfile = 0;
#else
pfile = &parse_in;
#endif
#ifdef HANDLE_PRAGMA_PACK
cpp_register_pragma (pfile, 0, "pack", handle_pragma_pack);

View File

@ -59,11 +59,6 @@ extern int add_weak PARAMS ((const char *, const char *));
extern void init_pragma PARAMS ((void));
/* If cpplib is in use, it handles dispatch. */
#if !USE_CPPLIB
extern void dispatch_pragma PARAMS ((void));
#endif
/* Duplicate prototypes for the register_pragma stuff and the typedef for
cpp_reader, to avoid dragging cpplib.h in almost everywhere... */
#ifndef __GCC_CPPLIB__

View File

@ -308,9 +308,6 @@
every opportunity. This is extremely expensive. */
#undef ENABLE_GC_ALWAYS_COLLECT
/* Define if you want the preprocessor merged into the C and C++ compilers. */
#undef USE_CPPLIB
/* Define if you want the C and C++ compilers to support multibyte
character sets for source code. */
#undef MULTIBYTE_CHARS

497
gcc/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -271,19 +271,7 @@ elif test x$withval != xno; then
cpp_install_dir=$withval
fi])
# Link cpplib into the compiler proper, for C/C++/ObjC. Defaults to on.
maybe_cpplib=libcpp.a
AC_ARG_ENABLE(c-cpplib,
[ --enable-c-cpplib link cpplib directly into C and C++ compilers
(HIGHLY EXPERIMENTAL).],
[if test x$enable_c_cpplib != xyes; then
maybe_cpplib=
fi]
)
if test x$maybe_cpplib != x ; then
AC_DEFINE(USE_CPPLIB, 1,
[Define if you want the preprocessor merged into the C and C++ compilers.])
fi
AC_SUBST(maybe_cpplib)
# Enable Multibyte Characters for C/C++

View File

@ -3214,13 +3214,9 @@ extern void unsigned_conversion_warning PARAMS ((tree, tree));
extern void c_apply_type_quals_to_decl PARAMS ((int, tree));
/* Read the rest of the current #-directive line. */
#if USE_CPPLIB
extern char *get_directive_line PARAMS ((void));
#define GET_DIRECTIVE_LINE() get_directive_line ()
#else
extern char *get_directive_line PARAMS ((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. */

View File

@ -45,11 +45,8 @@ Boston, MA 02111-1307, USA. */
#include "dwarfout.h"
#include "ggc.h"
#include "timevar.h"
#if USE_CPPLIB
#include "cpplib.h"
extern cpp_reader parse_in;
#endif
/* This structure contains information about the initializations
and/or destructions required for a particular priority level. */
@ -566,20 +563,13 @@ compare_options (p1, p2)
int
lang_decode_option (argc, argv)
int argc
#if !USE_CPPLIB
ATTRIBUTE_UNUSED
#endif
;
int argc;
char **argv;
{
int strings_processed;
const char *p = argv[0];
#if USE_CPPLIB
strings_processed = cpp_handle_option (&parse_in, argc, argv);
#else
strings_processed = 0;
#endif /* ! USE_CPPLIB */
if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional"))
/* ignore */;

View File

@ -29,7 +29,6 @@ Boston, MA 02111-1307, USA. */
{".c++", "@c++"},
{".C", "@c++"},
{"@c++",
#if USE_CPPLIB
/* cc1plus has an integrated ISO C preprocessor. We should invoke
the external preprocessor if -save-temps is given. */
"%{E|M|MM:cpp0 -lang-c++ %{!no-gcc:-D__GNUG__=%v1}\
@ -44,16 +43,7 @@ Boston, MA 02111-1307, USA. */
%{fnew-abi:-D__GXX_ABI_VERSION=100}\
%{ansi:-trigraphs -$ -D__STRICT_ANSI__}\
%(cc1_options) %2 %{+e*}\
%{!fsyntax-only:%(invoke_as)}}}}"
#else /* ! USE_CPPLIB */
"cpp0 -lang-c++ %{!no-gcc:-D__GNUG__=%v1}\
%{fnew-abi:-D__GXX_ABI_VERSION=100}\
%{ansi:-trigraphs -$ -D__STRICT_ANSI__} %(cpp_options)\
%{!M:%{!MM:%{!E:%{!pipe:%g.ii} |\n\
cc1plus -lang-c++ %{!pipe:%g.ii} %(cc1_options) %2 %{+e*}\
%{!fsyntax-only:%(invoke_as)}}}}\n"
#endif /* ! USE_CPPLIB */
},
%{!fsyntax-only:%(invoke_as)}}}}"},
{".ii", "@c++-cpp-output"},
{"@c++-cpp-output",
"%{!M:%{!MM:%{!E:\

View File

@ -79,13 +79,7 @@ static void init_operators PARAMS ((void));
#endif
#include "cpplib.h"
#if USE_CPPLIB
extern cpp_reader parse_in;
#else
FILE *finput;
int linemode;
#endif
/* Pending language change.
Positive is push count, negative is pop count. */
@ -252,10 +246,8 @@ static const char *cplus_tree_code_name[] = {
void
lang_init_options ()
{
#if USE_CPPLIB
cpp_init ();
cpp_reader_init (&parse_in, CLK_GNUC89);
#endif
/* Default exceptions on. */
flag_exceptions = 1;
@ -276,13 +268,6 @@ lang_init ()
if (flag_bounds_check < 0)
flag_bounds_check = flag_bounded_pointers;
#if !USE_CPPLIB
/* the beginning of the file is a new line; check for # */
/* With luck, we discover the real source file's name from that
and put it in input_filename. */
ungetc (check_newline (), finput);
#endif
if (flag_gnu_xref) GNU_xref_begin (input_filename);
init_repo (input_filename);
}
@ -676,21 +661,16 @@ init_reswords ()
static void
init_cp_pragma ()
{
#if USE_CPPLIB
#define pfile &parse_in
#else
#define pfile 0
#endif
cpp_register_pragma (pfile, 0, "vtable", handle_pragma_vtable);
cpp_register_pragma (pfile, 0, "unit", handle_pragma_unit);
cpp_register_pragma (&parse_in, 0, "vtable", handle_pragma_vtable);
cpp_register_pragma (&parse_in, 0, "unit", handle_pragma_unit);
cpp_register_pragma (pfile, 0, "interface", handle_pragma_interface);
cpp_register_pragma (pfile, 0, "implementation",
cpp_register_pragma (&parse_in, 0, "interface", handle_pragma_interface);
cpp_register_pragma (&parse_in, 0, "implementation",
handle_pragma_implementation);
cpp_register_pragma_space (pfile, "GCC");
cpp_register_pragma (pfile, "GCC", "interface", handle_pragma_interface);
cpp_register_pragma (pfile, "GCC", "implementation",
cpp_register_pragma_space (&parse_in, "GCC");
cpp_register_pragma (&parse_in, "GCC", "interface", handle_pragma_interface);
cpp_register_pragma (&parse_in, "GCC", "implementation",
handle_pragma_implementation);
}
@ -762,12 +742,8 @@ init_parse (filename)
void
finish_parse ()
{
#if USE_CPPLIB
cpp_finish (&parse_in);
errorcount += parse_in.errors;
#else
fclose (finput);
#endif
}
inline void
@ -1174,12 +1150,9 @@ handle_pragma_implementation (dfile)
else
{
main_filename = TREE_STRING_POINTER (fname);
#if USE_CPPLIB
if (cpp_included (&parse_in, main_filename))
warning ("#pragma implementation for %s appears after file is included",
main_filename);
#endif
}
for (; ifiles; ifiles = ifiles->next)

View File

@ -70,10 +70,6 @@ typedef unsigned long RID_BIT_TYPE; /* assumed at least 32 bits */
used in a context which makes it a reference to a variable. */
extern tree lastiddecl;
#if !USE_CPPLIB
extern char *token_buffer; /* Pointer to token buffer. */
#endif
/* Back-door communication channel to the lexer. */
extern int looking_for_typename;
extern int looking_for_template;

View File

@ -45,9 +45,7 @@ Boston, MA 02111-1307, USA. */
#define SPEW_INLINE inline
#endif
#if USE_CPPLIB
extern cpp_reader parse_in;
#endif
/* This takes a token stream that hasn't decided much about types and
tries to figure out as much as it can, with excessive lookahead and
@ -327,11 +325,9 @@ read_token (t)
#undef YYCODE
case CPP_EOF:
#if USE_CPPLIB
cpp_pop_buffer (&parse_in);
if (CPP_BUFFER (&parse_in))
goto retry;
#endif
t->yychar = 0;
break;
@ -1377,17 +1373,7 @@ debug_yychar (yy)
#endif
#if USE_CPPLIB
#define NAME(type) cpp_type2name (type)
#else
/* Bleah */
#include "symcat.h"
#define OP(e, s) s,
#define TK(e, s) STRINGX(e),
static const char *type2name[N_TTYPES] = { TTYPE_TABLE };
#define NAME(type) type2name[type]
#endif
void
yyerror (msgid)

View File

@ -722,7 +722,6 @@ static struct compiler default_compilers[] =
/* Next come the entries for C. */
{".c", "@c"},
{"@c",
#if USE_CPPLIB
/* cc1 has an integrated ISO C preprocessor. We should invoke the
external preprocessor if -save-temps or -traditional is given. */
"%{E|M|MM:%(trad_capable_cpp) -lang-c %{ansi:-std=c89} %(cpp_options)}\
@ -736,13 +735,7 @@ static struct compiler default_compilers[] =
cc1 -fpreprocessed %{!pipe:%g.i} %(cc1_options)}\
%{!traditional:%{!ftraditional:%{!traditional-cpp:\
cc1 -lang-c %{ansi:-std=c89} %(cpp_options) %(cc1_options)}}}}\
%{!fsyntax-only:%(invoke_as)}}}}"
#else /* ! USE_CPPLIB */
"%(trad_capable_cpp) -lang-c %{ansi:-std=c89} %(cpp_options) \
%{!M:%{!MM:%{!E:%{!pipe:%g.i} |\n\
cc1 %{!pipe:%g.i} %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}"
#endif /* ! USE_CPPLIB */
},
%{!fsyntax-only:%(invoke_as)}}}}"},
{"-",
"%{!E:%e-E required when input is from standard input}\
%(trad_capable_cpp) -lang-c %{ansi:-std=c89} %(cpp_options)"},

View File

@ -36,15 +36,6 @@ DEFINE_LANG_NAME ("Java")
{ "-fuse-boehm-gc", "Generate code for Boehm GC" },
{ "-fhash-synchronization", "Don't put synchronization structure in each object" },
{ "-fjni", "Assume native functions are implemented using JNI" },
#if ! USE_CPPLIB
{ "-MD", "Print dependencies to FILE.d" },
{ "-MMD", "Print dependencies to FILE.d" },
{ "-M", "Print dependencies to stdout" },
{ "-MM", "Print dependencies to stdout" },
{ "-MA", "Print dummy rules for included files" },
{ "-MF", "Print dependencies to FILE" },
{ "-MT", "Use TARGET as name of target in dependency file" },
#endif /* ! USE_CPPLIB */
{ "--classpath", "Set class path and suppress system path" },
{ "--CLASSPATH", "Set class path" },
{ "--main", "Choose class whose main method should be used" },

View File

@ -23,7 +23,6 @@ Boston, MA 02111-1307, USA. */
{".m", "@objective-c"},
{"@objective-c",
#if USE_CPPLIB
/* cc1obj has an integrated ISO C preprocessor. We should invoke the
external preprocessor if -save-temps or -traditional is given. */
"%{E|M|MM:%(trad_capable_cpp) -lang-objc %{ansi:-std=c89} %(cpp_options)}\
@ -37,14 +36,7 @@ Boston, MA 02111-1307, USA. */
cc1obj -fpreprocessed %{!pipe:%g.mi} -lang-objc %(cc1_options) %{gen-decls}}\
%{!traditional:%{!ftraditional:%{!traditional-cpp:\
cc1obj -lang-objc %{ansi:-std=c89} %(cpp_options) %(cc1_options) %{gen-decls}}}}}\
%{!fsyntax-only:%(invoke_as)}}}}"
#else /* ! USE_CPPLIB */
"%(trad_capable_cpp) -lang-objc %{ansi:-std=c89} %(cpp_options)\
%{!M:%{!MM:%{!E:%{!pipe:%g.mi} |\n\
cc1obj -lang-objc %{!pipe:%g.mi} %(cc1_options) %{gen-decls}\
%{!fsyntax-only:%(invoke_as)}}}}\n"
#endif /* ! USE_CPPLIB */
},
%{!fsyntax-only:%(invoke_as)}}}}"},
{".mi", "@objc-cpp-output"},
{"@objc-cpp-output",
"%{!M:%{!MM:%{!E:cc1obj -lang-objc %i %(cc1_options) %{gen-decls}\

View File

@ -55,11 +55,8 @@ Boston, MA 02111-1307, USA. */
#include "output.h"
#include "toplev.h"
#include "ggc.h"
#if USE_CPPLIB
#include "cpplib.h"
extern cpp_reader parse_in;
#endif
/* This is the default way of generating a method name. */
/* I am not sure it is really correct.
@ -698,21 +695,13 @@ generate_struct_by_value_array ()
void
lang_init_options ()
{
#if USE_CPPLIB
cpp_init ();
cpp_reader_init (&parse_in, CLK_GNUC89);
#endif
}
void
lang_init ()
{
#if !USE_CPPLIB
/* The beginning of the file is a new line; check for #.
With luck, we discover the real source file's name from that
and put it in input_filename. */
ungetc (check_newline (), finput);
#endif
/* Force the line number back to 0; check_newline will have
raised it to 1, which will make the builtin functions appear
not to be built in. */

View File

@ -3781,10 +3781,6 @@ display_help ()
unsigned long i;
const char *lang;
#ifndef USE_CPPLIB
printf (_("Usage: %s input [switches]\n"), progname);
printf (_("Switches:\n"));
#endif
printf (_(" -ffixed-<register> Mark <register> as being unavailable to the compiler\n"));
printf (_(" -fcall-used-<register> Mark <register> as being corrupted by function calls\n"));
printf (_(" -fcall-saved-<register> Mark <register> as being preserved across functions\n"));