#include "config.h"
#include "system.h"
-#include "coretypes.h"
-#include "tm.h"
#include "cpplib.h"
#include "cpphash.h"
cpp_macro *macro = node->value.macro;
if (!macro->used
- && MAIN_FILE_P (lookup_line (&pfile->line_maps, macro->line)))
- cpp_error_with_line (pfile, DL_WARNING, macro->line, 0,
+ && MAIN_FILE_P (linemap_lookup (&pfile->line_maps, macro->line)))
+ cpp_error_with_line (pfile, CPP_DL_WARNING, macro->line, 0,
"macro \"%s\" is not used", NODE_NAME (node));
}
switch (node->value.builtin)
{
default:
- cpp_error (pfile, DL_ICE, "invalid built-in macro \"%s\"",
+ cpp_error (pfile, CPP_DL_ICE, "invalid built-in macro \"%s\"",
NODE_NAME (node));
break;
}
else
{
- cpp_errno (pfile, DL_WARNING,
+ cpp_errno (pfile, CPP_DL_WARNING,
"could not determine date and time");
pfile->date = U"\"??? ?? ????\"";
memcpy (nbuf, buf, len);
nbuf[len]='\n';
- cpp_push_buffer (pfile, (uchar *) nbuf, len, /* from_stage3 */ true, 1);
+ cpp_push_buffer (pfile, (uchar *) nbuf, len, /* from_stage3 */ true);
_cpp_clean_line (pfile);
/* Set pfile->cur_token as required by _cpp_lex_direct. */
pfile->cur_token = _cpp_temp_token (pfile);
push_token_context (pfile, NULL, _cpp_lex_direct (pfile), 1);
if (pfile->buffer->cur != pfile->buffer->rlimit)
- cpp_error (pfile, DL_ICE, "invalid built-in macro \"%s\"",
+ cpp_error (pfile, CPP_DL_ICE, "invalid built-in macro \"%s\"",
NODE_NAME (node));
_cpp_pop_buffer (pfile);
/* Ignore the final \ of invalid string literals. */
if (backslash_count & 1)
{
- cpp_error (pfile, DL_WARNING,
+ cpp_error (pfile, CPP_DL_WARNING,
"invalid string literal, ignoring final '\\'");
dest--;
}
lhs = *plhs;
len = cpp_token_len (lhs) + cpp_token_len (rhs) + 1;
- buf = (unsigned char *) alloca (len);
+ buf = alloca (len);
end = cpp_spell_token (pfile, lhs, buf);
/* Avoid comment headers, since they are still processed in stage 3.
end = cpp_spell_token (pfile, rhs, end);
*end = '\n';
- cpp_push_buffer (pfile, buf, end - buf, /* from_stage3 */ true, 1);
+ cpp_push_buffer (pfile, buf, end - buf, /* from_stage3 */ true);
_cpp_clean_line (pfile);
/* Set pfile->cur_token as required by _cpp_lex_direct. */
/* Mandatory error for all apart from assembler. */
if (CPP_OPTION (pfile, lang) != CLK_ASM)
- cpp_error (pfile, DL_ERROR,
+ cpp_error (pfile, CPP_DL_ERROR,
"pasting \"%s\" and \"%s\" does not give a valid preprocessing token",
cpp_token_as_text (pfile, lhs),
cpp_token_as_text (pfile, rhs));
if (argc + 1 == macro->paramc && macro->variadic)
{
if (CPP_PEDANTIC (pfile) && ! macro->syshdr)
- cpp_error (pfile, DL_PEDWARN,
+ cpp_error (pfile, CPP_DL_PEDWARN,
"ISO C99 requires rest arguments to be used");
return true;
}
- cpp_error (pfile, DL_ERROR,
+ cpp_error (pfile, CPP_DL_ERROR,
"macro \"%s\" requires %u arguments, but only %u given",
NODE_NAME (node), macro->paramc, argc);
}
else
- cpp_error (pfile, DL_ERROR,
+ cpp_error (pfile, CPP_DL_ERROR,
"macro \"%s\" passed %u arguments, but takes just %u",
NODE_NAME (node), argc, macro->paramc);
callers at the end of an -include-d file. */
if (pfile->context->prev || pfile->state.in_directive)
_cpp_backup_tokens (pfile, 1);
- cpp_error (pfile, DL_ERROR,
+ cpp_error (pfile, CPP_DL_ERROR,
"unterminated argument list invoking macro \"%s\"",
NODE_NAME (node));
}
if (buff == NULL)
{
if (CPP_WTRADITIONAL (pfile) && ! node->value.macro->syshdr)
- cpp_error (pfile, DL_WARNING,
+ cpp_error (pfile, CPP_DL_WARNING,
"function-like macro \"%s\" must be used with arguments in traditional C",
NODE_NAME (node));
/* Loop, reading in the arguments. */
capacity = 256;
- arg->expanded = (const cpp_token **)
- xmalloc (capacity * sizeof (cpp_token *));
+ arg->expanded = xmalloc (capacity * sizeof (cpp_token *));
push_ptoken_context (pfile, NULL, NULL, arg->first, arg->count + 1);
for (;;)
if (arg->expanded_count + 1 >= capacity)
{
capacity *= 2;
- arg->expanded = (const cpp_token **)
- xrealloc (arg->expanded, capacity * sizeof (cpp_token *));
+ arg->expanded = xrealloc (arg->expanded,
+ capacity * sizeof (cpp_token *));
}
token = cpp_get_token (pfile);
pfile->context = context->prev;
}
-/* Eternal routine to get a token. Also used nearly everywhere
+/* External routine to get a token. Also used nearly everywhere
internally, except for places where we know we can safely call
- the lexer directly, such as lexing a directive name.
+ _cpp_lex_token directly, such as lexing a directive name.
Macro expansions and directives are transparently handled,
including entering included files. Thus tokens are post-macro
void
cpp_scan_nooutput (cpp_reader *pfile)
{
- /* Request a CPP_EOF token at the end of this file, rather than
- transparently continuing with the including file. */
- pfile->buffer->return_at_eof = true;
-
if (CPP_OPTION (pfile, traditional))
while (_cpp_read_logical_line_trad (pfile))
;
/* Constraint 6.10.3.6 - duplicate parameter names. */
if (node->flags & NODE_MACRO_ARG)
{
- cpp_error (pfile, DL_ERROR, "duplicate macro parameter \"%s\"",
+ cpp_error (pfile, CPP_DL_ERROR, "duplicate macro parameter \"%s\"",
NODE_NAME (node));
return true;
}
len = macro->paramc * sizeof (union _cpp_hashnode_value);
if (len > pfile->macro_buffer_len)
{
- pfile->macro_buffer = (uchar *) xrealloc (pfile->macro_buffer, len);
+ pfile->macro_buffer = xrealloc (pfile->macro_buffer, len);
pfile->macro_buffer_len = len;
}
((union _cpp_hashnode_value *) pfile->macro_buffer)[macro->paramc - 1]
&& ! CPP_OPTION (pfile, discard_comments_in_macro_exp))
continue;
- cpp_error (pfile, DL_ERROR,
+ cpp_error (pfile, CPP_DL_ERROR,
"\"%s\" may not appear in macro parameter list",
cpp_token_as_text (pfile, token));
return false;
case CPP_NAME:
if (prev_ident)
{
- cpp_error (pfile, DL_ERROR,
+ cpp_error (pfile, CPP_DL_ERROR,
"macro parameters must be comma-separated");
return false;
}
case CPP_COMMA:
if (!prev_ident)
{
- cpp_error (pfile, DL_ERROR, "parameter name missing");
+ cpp_error (pfile, CPP_DL_ERROR, "parameter name missing");
return false;
}
prev_ident = 0;
pfile->spec_nodes.n__VA_ARGS__);
pfile->state.va_args_ok = 1;
if (! CPP_OPTION (pfile, c99) && CPP_OPTION (pfile, pedantic))
- cpp_error (pfile, DL_PEDWARN,
+ cpp_error (pfile, CPP_DL_PEDWARN,
"anonymous variadic macros were introduced in C99");
}
else if (CPP_OPTION (pfile, pedantic))
- cpp_error (pfile, DL_PEDWARN,
+ cpp_error (pfile, CPP_DL_PEDWARN,
"ISO C does not permit named variadic macros");
/* We're at the end, and just expect a closing parenthesis. */
/* Fall through. */
case CPP_EOF:
- cpp_error (pfile, DL_ERROR, "missing ')' in macro parameter list");
+ cpp_error (pfile, CPP_DL_ERROR, "missing ')' in macro parameter list");
return false;
}
}
macro->fun_like = 1;
}
else if (ctoken->type != CPP_EOF && !(ctoken->flags & PREV_WHITE))
- cpp_error (pfile, DL_PEDWARN,
+ cpp_error (pfile, CPP_DL_PEDWARN,
"ISO C requires whitespace after the macro name");
if (macro->fun_like)
/* Let assembler get away with murder. */
else if (CPP_OPTION (pfile, lang) != CLK_ASM)
{
- cpp_error (pfile, DL_ERROR,
+ cpp_error (pfile, CPP_DL_ERROR,
"'#' is not followed by a macro parameter");
return false;
}
if (macro->count == 0 || token->type == CPP_EOF)
{
- cpp_error (pfile, DL_ERROR,
+ cpp_error (pfile, CPP_DL_ERROR,
"'##' cannot appear at either end of a macro expansion");
return false;
}
if (warn_of_redefinition (pfile, node, macro))
{
- cpp_error_with_line (pfile, DL_PEDWARN, pfile->directive_line, 0,
+ cpp_error_with_line (pfile, CPP_DL_PEDWARN, pfile->directive_line, 0,
"\"%s\" redefined", NODE_NAME (node));
if (node->type == NT_MACRO && !(node->flags & NODE_BUILTIN))
- cpp_error_with_line (pfile, DL_PEDWARN,
+ cpp_error_with_line (pfile, CPP_DL_PEDWARN,
node->value.macro->line, 0,
"this is the location of the previous definition");
}
if (NODE_LEN (node) == len
&& !memcmp (p, NODE_NAME (node), len))
{
- cpp_error (pfile, DL_WARNING,
+ cpp_error (pfile, CPP_DL_WARNING,
"macro argument \"%s\" would be stringified in traditional C",
NODE_NAME (node));
break;
if (node->type != NT_MACRO || (node->flags & NODE_BUILTIN))
{
- cpp_error (pfile, DL_ICE,
+ cpp_error (pfile, CPP_DL_ICE,
"invalid hash type %d in cpp_macro_definition", node->type);
return 0;
}
if (len > pfile->macro_buffer_len)
{
- pfile->macro_buffer = (uchar *) xrealloc (pfile->macro_buffer, len);
+ pfile->macro_buffer = xrealloc (pfile->macro_buffer, len);
pfile->macro_buffer_len = len;
}