cpperror.c: Remove #ifdef EMACS block.

* cpperror.c: Remove #ifdef EMACS block.
	* cppmain.c: Likewise.
	* cpphash.c: Remove #if 0 blocks.
	* cppinit.c: Remove #if 0 blocks, and the -lint option.
	* cpplib.c: Remove #if 0 blocks and code referencing
	pcp_inside_if or for_lint.  Remove duplicate error message.
	Fix error messages for #else after #else or #elif.  Reformat.
	Remove archaic TODO list.
	* cpplib.h: Remove pcp_inside_if and for_lint flags.

From-SVN: r31817
This commit is contained in:
Zack Weinberg 2000-02-06 07:30:25 +00:00 committed by Zack Weinberg
parent fd81d24f99
commit 40ea76de51
7 changed files with 67 additions and 182 deletions

View file

@ -1,3 +1,15 @@
2000-02-05 Zack Weinberg <zack@wolery.cumb.org>
* cpperror.c: Remove #ifdef EMACS block.
* cppmain.c: Likewise.
* cpphash.c: Remove #if 0 blocks.
* cppinit.c: Remove #if 0 blocks, and the -lint option.
* cpplib.c: Remove #if 0 blocks and code referencing
pcp_inside_if or for_lint. Remove duplicate error message.
Fix error messages for #else after #else or #elif. Reformat.
Remove archaic TODO list.
* cpplib.h: Remove pcp_inside_if and for_lint flags.
2000-02-05 Zack Weinberg <zack@wolery.cumb.org>
* i386/osf1elf.h: Add missing backslash to multiline string.

View file

@ -1,5 +1,6 @@
/* Default error handlers for CPP Library.
Copyright (C) 1986, 87, 89, 92-95, 98, 99, 2000 Free Software Foundation, Inc.
Copyright (C) 1986, 87, 89, 92-95, 98, 99, 2000
Free Software Foundation, Inc.
Written by Per Bothner, 1994.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
@ -22,13 +23,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
#ifndef EMACS
#include "config.h"
#include "system.h"
#else
#include <stdio.h>
#endif /* not EMACS */
#include "cpplib.h"
#include "intl.h"

View file

@ -1,5 +1,6 @@
/* Part of CPP library. (Macro handling.)
Copyright (C) 1986, 87, 89, 92-96, 98, 99, 2000 Free Software Foundation, Inc.
Copyright (C) 1986, 87, 89, 92-96, 98, 99, 2000
Free Software Foundation, Inc.
Written by Per Bothner, 1994.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
@ -440,11 +441,6 @@ collect_expansion (pfile, buf, limit, nargs, arglist)
p += 1;
while (p < limit && !(p[-2] == '*' && p[-1] == '/'))
p++;
#if 0
/* Mark this as a concatenation-point,
as if it had been ##. */
concat = p;
#endif
}
break;
}
@ -1003,19 +999,9 @@ macroexpand (pfile, hp)
int xbuf_len;
struct argdata *args = 0;
long old_written = CPP_WRITTEN (pfile);
#if 0
int start_line = instack[indepth].lineno;
#endif
int rest_args, rest_zero = 0;
register int i;
#if 0
/* This macro is being used inside a #if, which means it must be */
/* recorded as a precondition. */
if (pcp_inside_if && pcp_outfile && defn->predefined)
dump_single_macro (hp, pcp_outfile);
#endif
cpp_buf_line_and_col (cpp_file_buffer (pfile), &start_line, &start_column);
/* Check for and handle special symbols. */

View file

@ -1,5 +1,5 @@
/* CPP Library.
Copyright (C) 1986, 87, 89, 92-98, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1986, 87, 89, 92-99, 2000 Free Software Foundation, Inc.
Contributed by Per Bothner, 1994-95.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
@ -200,7 +200,8 @@ static void append_include_chain PARAMS ((cpp_reader *,
static char *base_name PARAMS ((const char *));
static void dump_special_to_buffer PARAMS ((cpp_reader *, const char *));
static void initialize_dependency_output PARAMS ((cpp_reader *));
static void new_pending_define PARAMS ((struct cpp_options *, const char *));
static void new_pending_define PARAMS ((struct cpp_options *,
const char *));
/* Last argument to append_include_chain: chain to use */
enum { QUOTE = 0, BRACKET, SYSTEM, AFTER };
@ -418,9 +419,6 @@ cpp_reader_init (pfile)
cpp_reader *pfile;
{
bzero ((char *) pfile, sizeof (cpp_reader));
#if 0
pfile->get_token = cpp_get_token;
#endif
pfile->token_buffer_size = 200;
pfile->token_buffer = (U_CHAR *) xmalloc (pfile->token_buffer_size);
@ -1283,17 +1281,6 @@ cpp_handle_option (pfile, argc, argv)
CPP_PEDANTIC (pfile) = 1;
opts->pedantic_errors = 1;
}
#if 0
else if (!strcmp (argv[i], "-pcp")) {
char *pcp_fname = argv[++i];
pcp_outfile = ((pcp_fname[0] != '-' || pcp_fname[1] != '\0')
? fopen (pcp_fname, "w")
: fdopen (dup (fileno (stdout)), "w"));
if (pcp_outfile == 0)
cpp_pfatal_with_name (pfile, pcp_fname);
no_precomp = 1;
}
#endif
break;
case 't':
@ -1332,8 +1319,6 @@ cpp_handle_option (pfile, argc, argv)
opts->lang_asm = 1;
if (! strcmp (argv[i], "-lang-fortran"))
opts->lang_fortran = 1, opts->cplusplus_comments = 0;
if (! strcmp (argv[i], "-lint"))
opts->for_lint = 1;
if (! strcmp (argv[i], "-lang-chill"))
opts->objc = 0, opts->cplusplus = 0, opts->chill = 1,
opts->traditional = 1;
@ -1633,10 +1618,6 @@ cpp_handle_option (pfile, argc, argv)
else if (!strcmp (argv[i], "-nostdinc++"))
/* -nostdinc++ causes no default C++-specific include directories. */
opts->no_standard_cplusplus_includes = 1;
#if 0
else if (!strcmp (argv[i], "-noprecomp"))
no_precomp = 1;
#endif
break;
case 'r':

View file

@ -1796,35 +1796,35 @@ do_elif (pfile, keyword)
cpp_reader *pfile;
const struct directive *keyword ATTRIBUTE_UNUSED;
{
if (pfile->if_stack == CPP_BUFFER (pfile)->if_stack) {
cpp_error (pfile, "`#elif' not within a conditional");
return 0;
} else {
if (pfile->if_stack->type != T_IF && pfile->if_stack->type != T_ELIF) {
cpp_error (pfile, "`#elif' after `#else'");
#if 0
fprintf (stderr, " (matches line %d", pfile->if_stack->lineno);
#endif
if (pfile->if_stack->fname != NULL && CPP_BUFFER (pfile)->fname != NULL
&& strcmp (pfile->if_stack->fname,
CPP_BUFFER (pfile)->nominal_fname) != 0)
fprintf (stderr, ", file %s", pfile->if_stack->fname);
fprintf (stderr, ")\n");
if (pfile->if_stack == CPP_BUFFER (pfile)->if_stack)
{
cpp_error (pfile, "`#elif' not within a conditional");
return 0;
}
else
{
if (pfile->if_stack->type != T_IF && pfile->if_stack->type != T_ELIF)
{
cpp_error (pfile, "`#elif' after `#else'");
cpp_error_with_line (pfile, pfile->if_stack->lineno, -1,
"the conditional began here");
}
pfile->if_stack->type = T_ELIF;
}
pfile->if_stack->type = T_ELIF;
}
if (pfile->if_stack->if_succeeded)
skip_if_group (pfile);
else {
HOST_WIDEST_INT value = eval_if_expression (pfile);
if (value == 0)
skip_if_group (pfile);
else {
++pfile->if_stack->if_succeeded; /* continue processing input */
output_line_command (pfile, same_file);
else
{
HOST_WIDEST_INT value = eval_if_expression (pfile);
if (value == 0)
skip_if_group (pfile);
else
{
++pfile->if_stack->if_succeeded; /* continue processing input */
output_line_command (pfile, same_file);
}
}
}
return 0;
}
@ -1840,9 +1840,7 @@ eval_if_expression (pfile)
HOST_WIDEST_INT value;
long old_written = CPP_WRITTEN (pfile);
pfile->pcp_inside_if = 1;
value = cpp_parse_expr (pfile);
pfile->pcp_inside_if = 0;
CPP_SET_WRITTEN (pfile, old_written); /* Pop */
@ -1918,20 +1916,6 @@ do_xifdef (pfile, keyword)
}
skip_rest_of_line (pfile);
#if 0
if (pcp_outfile) {
/* Output a precondition for this macro. */
if (hp && hp->value.defn->predefined)
fprintf (pcp_outfile, "#define %s\n", hp->name);
else {
U_CHAR *cp = buf;
fprintf (pcp_outfile, "#undef ");
while (is_idchar(*cp)) /* Ick! */
fputc (*cp++, pcp_outfile);
putc ('\n', pcp_outfile);
}
#endif
conditional_skip (pfile, skip, T_IF, control_macro);
return 0;
}
@ -2010,9 +1994,6 @@ consider_directive_while_skipping (pfile, stack)
validate_else (pfile, "#else");
/* fall through */
case T_ELIF:
if (pfile->if_stack->type == T_ELSE)
cpp_error (pfile, "`%s' after `#else'", kt->name);
if (pfile->if_stack == stack)
return 1;
else
@ -2136,35 +2117,36 @@ do_else (pfile, keyword)
cpp_reader *pfile;
const struct directive *keyword ATTRIBUTE_UNUSED;
{
cpp_buffer *ip = CPP_BUFFER (pfile);
validate_else (pfile, "#else");
skip_rest_of_line (pfile);
if (pfile->if_stack == CPP_BUFFER (pfile)->if_stack) {
cpp_error (pfile, "`#else' not within a conditional");
return 0;
} else {
/* #ifndef can't have its special treatment for containing the whole file
if it has a #else clause. */
pfile->if_stack->control_macro = 0;
if (pfile->if_stack->type != T_IF && pfile->if_stack->type != T_ELIF) {
cpp_error (pfile, "`#else' after `#else'");
fprintf (stderr, " (matches line %d", pfile->if_stack->lineno);
if (strcmp (pfile->if_stack->fname, ip->nominal_fname) != 0)
fprintf (stderr, ", file %s", pfile->if_stack->fname);
fprintf (stderr, ")\n");
if (pfile->if_stack == CPP_BUFFER (pfile)->if_stack)
{
cpp_error (pfile, "`#else' not within a conditional");
return 0;
}
else
{
/* #ifndef can't have its special treatment for containing the whole file
if it has a #else clause. */
pfile->if_stack->control_macro = 0;
if (pfile->if_stack->type != T_IF && pfile->if_stack->type != T_ELIF)
{
cpp_error (pfile, "`#else' after `#else'");
cpp_error_with_line (pfile, pfile->if_stack->lineno, -1,
"the conditional began here");
}
pfile->if_stack->type = T_ELSE;
}
pfile->if_stack->type = T_ELSE;
}
if (pfile->if_stack->if_succeeded)
skip_if_group (pfile);
else {
++pfile->if_stack->if_succeeded; /* continue processing input */
output_line_command (pfile, same_file);
}
else
{
++pfile->if_stack->if_succeeded; /* continue processing input */
output_line_command (pfile, same_file);
}
return 0;
}
@ -2347,51 +2329,7 @@ cpp_get_token (pfile)
CPP_PUTC (pfile, c);
return CPP_HSPACE;
}
#if 0
if (opts->for_lint) {
U_CHAR *argbp;
int cmdlen, arglen;
char *lintcmd = get_lintcmd (ibp, limit, &argbp, &arglen, &cmdlen);
if (lintcmd != NULL) {
/* I believe it is always safe to emit this newline: */
obp[-1] = '\n';
bcopy ("#pragma lint ", (char *) obp, 13);
obp += 13;
bcopy (lintcmd, (char *) obp, cmdlen);
obp += cmdlen;
if (arglen != 0) {
*(obp++) = ' ';
bcopy (argbp, (char *) obp, arglen);
obp += arglen;
}
/* OK, now bring us back to the state we were in before we entered
this branch. We need #line because the newline for the pragma
could mess things up. */
output_line_command (pfile, same_file);
*(obp++) = ' '; /* just in case, if comments are copied thru */
*(obp++) = '/';
}
}
#endif
case '#':
#if 0
/* If this is expanding a macro definition, don't recognize
preprocessor directives. */
if (ip->macro != 0)
goto randomchar;
/* If this is expand_into_temp_buffer, recognize them
only after an actual newline at this level,
not at the beginning of the input level. */
if (ip->fname == 0 && beg_of_line == ip->buf)
goto randomchar;
if (ident_length)
goto specialchar;
#endif
if (!pfile->only_seen_white)
goto randomchar;
/* -traditional directives are recognized only with the # in
@ -3555,15 +3493,3 @@ cpp_perror_with_name (pfile, name)
{
cpp_message (pfile, 1, "%s: %s: %s", progname, name, my_strerror (errno));
}
/* TODO:
* No pre-compiled header file support.
*
* Possibly different enum token codes for each C/C++ token.
*
* Find and cleanup remaining uses of static variables,
*
* Support -dM flag (dump_all_macros).
*
* Support for_lint flag.
*/

View file

@ -200,11 +200,6 @@ struct cpp_reader
struct if_stack *if_stack;
/* Nonzero means we are inside an IF during a -pcp run. In this mode
macro expansion is done, and preconditions are output for all macro
uses requiring them. */
char pcp_inside_if;
/* Nonzero means we have printed (while error reporting) a list of
containing files that matches the current status. */
char input_stack_listing_current;
@ -369,10 +364,6 @@ struct cpp_options {
char lang_fortran;
/* Nonzero means turn NOTREACHED into #pragma NOTREACHED etc */
char for_lint;
/* Nonzero means handle CHILL comment syntax
and output CHILL string delimiter for __DATE___ etc. */

View file

@ -1,5 +1,5 @@
/* CPP main program, using CPP Library.
Copyright (C) 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
Copyright (C) 1995, 1997-1999, 2000 Free Software Foundation, Inc.
Written by Per Bothner, 1994-95.
This program is free software; you can redistribute it and/or modify it
@ -20,15 +20,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
#ifndef EMACS
#include "config.h"
#include "system.h"
#else
#include <stdio.h>
extern char *getenv ();
#endif /* not EMACS */
#include "cpplib.h"
#include "intl.h"