/* 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
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;
}
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. */
/* 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
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 };
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);
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':
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;
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':
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;
}
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 */
}
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;
}
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
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");
- }
- pfile->if_stack->type = T_ELSE;
- }
+ 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;
+ }
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;
}
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
{
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.
- */