re PR preprocessor/12847 (xxx.c:1:20: xxxx.h: No such file or directory)

PR preprocessor/12847
	* cppfiles.c, cppexp.c, cpperror.c, cpplib.h, cpplib.c, cpplex.c,
	cppinit.c, cpptrad.c, cppmacro.c, fix-header.c, cpppch.c, c-pch.c,
	c-incpath.c, cppcharset.c (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN,
	DL_ERROR, DL_ICE, DL_EXTRACT, DL_WARNING_P): Prefix macro names with
	"CPP_".

From-SVN: r73183
This commit is contained in:
John David Anglin 2003-11-01 22:56:54 +00:00 committed by John David Anglin
parent 2f7b62efc5
commit 0527bc4ebf
15 changed files with 237 additions and 210 deletions

View File

@ -1,3 +1,12 @@
2003-11-01 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR preprocessor/12847
* cppfiles.c, cppexp.c, cpperror.c, cpplib.h, cpplib.c, cpplex.c,
cppinit.c, cpptrad.c, cppmacro.c, fix-header.c, cpppch.c, c-pch.c,
c-incpath.c, cppcharset.c (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN,
DL_ERROR, DL_ICE, DL_EXTRACT, DL_WARNING_P): Prefix macro names with
"CPP_".
2003-11-01 Fariborz Jahanian <fjahanian@apple.com>
* config/rs6000/rs6000.c (rs6000_mixed_function_arg): Correct

View File

@ -187,12 +187,12 @@ remove_duplicates (cpp_reader *pfile, struct cpp_dir *head,
{
/* Dirs that don't exist are silently ignored, unless verbose. */
if (errno != ENOENT)
cpp_errno (pfile, DL_ERROR, cur->name);
cpp_errno (pfile, CPP_DL_ERROR, cur->name);
else
reason = REASON_NOENT;
}
else if (!S_ISDIR (st.st_mode))
cpp_error_with_line (pfile, DL_ERROR, 0, 0,
cpp_error_with_line (pfile, CPP_DL_ERROR, 0, 0,
"%s: not a directory", cur->name);
else
{

View File

@ -225,15 +225,15 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd)
if (memcmp (ident, pch_ident, 5) == 0)
/* It's a PCH, for the right language, but has the wrong version.
*/
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"%s: not compatible with this GCC version", name);
else if (memcmp (ident, pch_ident, 4) == 0)
/* It's a PCH for the wrong language. */
cpp_error (pfile, DL_WARNING, "%s: not for %s", name,
cpp_error (pfile, CPP_DL_WARNING, "%s: not for %s", name,
lang_hooks.name);
else
/* Not any kind of PCH. */
cpp_error (pfile, DL_WARNING, "%s: not a PCH file", name);
cpp_error (pfile, CPP_DL_WARNING, "%s: not a PCH file", name);
}
return 2;
}
@ -251,7 +251,7 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd)
|| memcmp (host_machine, short_strings, strlen (host_machine)) != 0)
{
if (cpp_get_options (pfile)->warn_invalid_pch)
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"%s: created on host `%.*s', but used on host `%s'", name,
v.host_machine_length, short_strings, host_machine);
return 2;
@ -261,7 +261,7 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd)
strlen (target_machine)) != 0)
{
if (cpp_get_options (pfile)->warn_invalid_pch)
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"%s: created for target `%.*s', but used for target `%s'",
name, v.target_machine_length,
short_strings + v.host_machine_length, target_machine);
@ -274,7 +274,7 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd)
v.version_length) != 0)
{
if (cpp_get_options (pfile)->warn_invalid_pch)
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"%s: created by version `%.*s', but this is version `%s'",
name, v.version_length,
(short_strings + v.host_machine_length
@ -290,7 +290,7 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd)
&& write_symbols != NO_DEBUG)
{
if (cpp_get_options (pfile)->warn_invalid_pch)
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"%s: created with -g%s, but used with -g%s", name,
debug_type_names[v.debug_info_type],
debug_type_names[write_symbols]);
@ -304,7 +304,7 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd)
if (v.pch_init != &pch_init)
{
if (cpp_get_options (pfile)->warn_invalid_pch)
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"%s: had text segment at different address", name);
return 2;
}
@ -322,7 +322,7 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd)
if (msg != NULL)
{
if (cpp_get_options (pfile)->warn_invalid_pch)
cpp_error (pfile, DL_WARNING, "%s: %s", name, msg);
cpp_error (pfile, CPP_DL_WARNING, "%s: %s", name, msg);
return 2;
}
}
@ -353,7 +353,7 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
f = fdopen (fd, "rb");
if (f == NULL)
{
cpp_errno (pfile, DL_ERROR, "calling fdopen");
cpp_errno (pfile, CPP_DL_ERROR, "calling fdopen");
return;
}
@ -361,7 +361,7 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
if (fread (&h, sizeof (h), 1, f) != 1)
{
cpp_errno (pfile, DL_ERROR, "reading");
cpp_errno (pfile, CPP_DL_ERROR, "reading");
return;
}
@ -373,7 +373,7 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
size = 16384;
if (fread (buf, size, 1, f) != 1
|| fwrite (buf, size, 1, asm_out_file) != 1)
cpp_errno (pfile, DL_ERROR, "reading");
cpp_errno (pfile, CPP_DL_ERROR, "reading");
written += size;
}
free (buf);

View File

@ -649,18 +649,18 @@ init_iconv_desc (cpp_reader *pfile, const char *to, const char *from)
if (ret.cd == (iconv_t) -1)
{
if (errno == EINVAL)
cpp_error (pfile, DL_ERROR, /* XXX should be DL_SORRY */
cpp_error (pfile, CPP_DL_ERROR, /* XXX should be DL_SORRY */
"conversion from %s to %s not supported by iconv",
from, to);
else
cpp_errno (pfile, DL_ERROR, "iconv_open");
cpp_errno (pfile, CPP_DL_ERROR, "iconv_open");
ret.func = convert_no_conversion;
}
}
else
{
cpp_error (pfile, DL_ERROR, /* XXX should be DL_SORRY */
cpp_error (pfile, CPP_DL_ERROR, /* XXX should be DL_SORRY */
"no iconv implementation, cannot convert from %s to %s",
from, to);
ret.func = convert_no_conversion;
@ -804,10 +804,10 @@ _cpp_valid_ucn (cpp_reader *pfile, const uchar **pstr,
const uchar *base = str - 2;
if (!CPP_OPTION (pfile, cplusplus) && !CPP_OPTION (pfile, c99))
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"universal character names are only valid in C++ and C99");
else if (CPP_WTRADITIONAL (pfile) && identifier_pos == 0)
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"the meaning of '\\%c' is different in traditional C",
(int) str[-1]);
@ -833,7 +833,8 @@ _cpp_valid_ucn (cpp_reader *pfile, const uchar **pstr,
if (length)
{
/* We'll error when we try it out as the start of an identifier. */
cpp_error (pfile, DL_ERROR, "incomplete universal character name %.*s",
cpp_error (pfile, CPP_DL_ERROR,
"incomplete universal character name %.*s",
(int) (str - base), base);
result = 1;
}
@ -844,7 +845,8 @@ _cpp_valid_ucn (cpp_reader *pfile, const uchar **pstr,
|| (result & 0x80000000)
|| (result >= 0xD800 && result <= 0xDFFF))
{
cpp_error (pfile, DL_ERROR, "%.*s is not a valid universal character",
cpp_error (pfile, CPP_DL_ERROR,
"%.*s is not a valid universal character",
(int) (str - base), base);
result = 1;
}
@ -853,11 +855,11 @@ _cpp_valid_ucn (cpp_reader *pfile, const uchar **pstr,
int validity = ucn_valid_in_identifier (pfile, result);
if (validity == 0)
cpp_error (pfile, DL_ERROR,
cpp_error (pfile, CPP_DL_ERROR,
"universal character %.*s is not valid in an identifier",
(int) (str - base), base);
else if (validity == 2 && identifier_pos == 1)
cpp_error (pfile, DL_ERROR,
cpp_error (pfile, CPP_DL_ERROR,
"universal character %.*s is not valid at the start of an identifier",
(int) (str - base), base);
}
@ -892,10 +894,12 @@ convert_ucn (cpp_reader *pfile, const uchar *from, const uchar *limit,
if (rval)
{
errno = rval;
cpp_errno (pfile, DL_ERROR, "converting UCN to source character set");
cpp_errno (pfile, CPP_DL_ERROR,
"converting UCN to source character set");
}
else if (!APPLY_CONVERSION (cvt, buf, 6 - bytesleft, tbuf))
cpp_errno (pfile, DL_ERROR, "converting UCN to execution character set");
cpp_errno (pfile, CPP_DL_ERROR,
"converting UCN to execution character set");
return from;
}
@ -959,7 +963,7 @@ convert_hex (cpp_reader *pfile, const uchar *from, const uchar *limit,
size_t mask = width_to_mask (width);
if (CPP_WTRADITIONAL (pfile))
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"the meaning of '\\x' is different in traditional C");
from++; /* skip 'x' */
@ -976,14 +980,14 @@ convert_hex (cpp_reader *pfile, const uchar *from, const uchar *limit,
if (!digits_found)
{
cpp_error (pfile, DL_ERROR,
cpp_error (pfile, CPP_DL_ERROR,
"\\x used with no following hex digits");
return from;
}
if (overflow | (n != (n & mask)))
{
cpp_error (pfile, DL_PEDWARN,
cpp_error (pfile, CPP_DL_PEDWARN,
"hex escape sequence out of range");
n &= mask;
}
@ -1022,7 +1026,7 @@ convert_oct (cpp_reader *pfile, const uchar *from, const uchar *limit,
if (n != (n & mask))
{
cpp_error (pfile, DL_PEDWARN,
cpp_error (pfile, CPP_DL_PEDWARN,
"octal escape sequence out of range");
n &= mask;
}
@ -1090,14 +1094,14 @@ convert_escape (cpp_reader *pfile, const uchar *from, const uchar *limit,
case 'a':
if (CPP_WTRADITIONAL (pfile))
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"the meaning of '\\a' is different in traditional C");
c = charconsts[0];
break;
case 'e': case 'E':
if (CPP_PEDANTIC (pfile))
cpp_error (pfile, DL_PEDWARN,
cpp_error (pfile, CPP_DL_PEDWARN,
"non-ISO-standard escape sequence, '\\%c'", (int) c);
c = charconsts[2];
break;
@ -1105,16 +1109,16 @@ convert_escape (cpp_reader *pfile, const uchar *from, const uchar *limit,
default:
unknown:
if (ISGRAPH (c))
cpp_error (pfile, DL_PEDWARN,
cpp_error (pfile, CPP_DL_PEDWARN,
"unknown escape sequence '\\%c'", (int) c);
else
cpp_error (pfile, DL_PEDWARN,
cpp_error (pfile, CPP_DL_PEDWARN,
"unknown escape sequence: '\\%03o'", (int) c);
}
/* Now convert what we have to the execution character set. */
if (!APPLY_CONVERSION (cvt, &c, 1, tbuf))
cpp_errno (pfile, DL_ERROR,
cpp_errno (pfile, CPP_DL_ERROR,
"converting escape sequence to execution character set");
return from + 1;
@ -1174,7 +1178,7 @@ cpp_interpret_string (cpp_reader *pfile, const cpp_string *from, size_t count,
return true;
fail:
cpp_errno (pfile, DL_ERROR, "converting to execution character set");
cpp_errno (pfile, CPP_DL_ERROR, "converting to execution character set");
free (tbuf.text);
return false;
}
@ -1236,10 +1240,11 @@ narrow_str_to_charconst (cpp_reader *pfile, cpp_string str,
if (i > max_chars)
{
i = max_chars;
cpp_error (pfile, DL_WARNING, "character constant too long for its type");
cpp_error (pfile, CPP_DL_WARNING,
"character constant too long for its type");
}
else if (i > 1 && CPP_OPTION (pfile, warn_multichar))
cpp_error (pfile, DL_WARNING, "multi-character character constant");
cpp_error (pfile, CPP_DL_WARNING, "multi-character character constant");
/* Multichar constants are of type int and therefore signed. */
if (i > 1)
@ -1298,7 +1303,8 @@ wide_str_to_charconst (cpp_reader *pfile, cpp_string str,
character exactly fills a wchar_t, so a multi-character wide
character constant is guaranteed to overflow. */
if (off > 0)
cpp_error (pfile, DL_WARNING, "character constant too long for its type");
cpp_error (pfile, CPP_DL_WARNING,
"character constant too long for its type");
/* Truncate the constant to its natural width, and simultaneously
sign- or zero-extend to the full width of cppchar_t. */
@ -1330,7 +1336,7 @@ cpp_interpret_charconst (cpp_reader *pfile, const cpp_token *token,
/* an empty constant will appear as L'' or '' */
if (token->val.str.len == (size_t) (2 + wide))
{
cpp_error (pfile, DL_ERROR, "empty character constant");
cpp_error (pfile, CPP_DL_ERROR, "empty character constant");
return 0;
}
else if (!cpp_interpret_string (pfile, &token->val.str, 1, &str, wide))

View File

@ -72,43 +72,43 @@ int
_cpp_begin_message (cpp_reader *pfile, int code, fileline line,
unsigned int column)
{
int level = DL_EXTRACT (code);
int level = CPP_DL_EXTRACT (code);
switch (level)
{
case DL_WARNING:
case DL_PEDWARN:
case CPP_DL_WARNING:
case CPP_DL_PEDWARN:
if (CPP_IN_SYSTEM_HEADER (pfile)
&& ! CPP_OPTION (pfile, warn_system_headers))
return 0;
/* Fall through. */
case DL_WARNING_SYSHDR:
case CPP_DL_WARNING_SYSHDR:
if (CPP_OPTION (pfile, warnings_are_errors)
|| (level == DL_PEDWARN && CPP_OPTION (pfile, pedantic_errors)))
|| (level == CPP_DL_PEDWARN && CPP_OPTION (pfile, pedantic_errors)))
{
if (CPP_OPTION (pfile, inhibit_errors))
return 0;
level = DL_ERROR;
level = CPP_DL_ERROR;
pfile->errors++;
}
else if (CPP_OPTION (pfile, inhibit_warnings))
return 0;
break;
case DL_ERROR:
case CPP_DL_ERROR:
if (CPP_OPTION (pfile, inhibit_errors))
return 0;
/* ICEs cannot be inhibited. */
case DL_ICE:
case CPP_DL_ICE:
pfile->errors++;
break;
}
print_location (pfile, line, column);
if (DL_WARNING_P (level))
if (CPP_DL_WARNING_P (level))
fputs (_("warning: "), stderr);
else if (level == DL_ICE)
else if (level == CPP_DL_ICE)
fputs (_("internal error: "), stderr);
return 1;

View File

@ -71,9 +71,10 @@ static void check_promotion (cpp_reader *, const struct op *);
/* With -O2, gcc appears to produce nice code, moving the error
message load and subsequent jump completely out of the main path. */
#define SYNTAX_ERROR(msgid) \
do { cpp_error (pfile, DL_ERROR, msgid); goto syntax_error; } while(0)
do { cpp_error (pfile, CPP_DL_ERROR, msgid); goto syntax_error; } while(0)
#define SYNTAX_ERROR2(msgid, arg) \
do { cpp_error (pfile, DL_ERROR, msgid, arg); goto syntax_error; } while(0)
do { cpp_error (pfile, CPP_DL_ERROR, msgid, arg); goto syntax_error; } \
while(0)
/* Subroutine of cpp_classify_number. S points to a float suffix of
length LEN, possibly zero. Returns 0 for an invalid suffix, or a
@ -213,7 +214,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token)
if (float_flag != NOT_FLOAT)
{
if (radix == 16 && CPP_PEDANTIC (pfile) && !CPP_OPTION (pfile, c99))
cpp_error (pfile, DL_PEDWARN,
cpp_error (pfile, CPP_DL_PEDWARN,
"use of C99 hexadecimal floating constant");
if (float_flag == AFTER_EXPON)
@ -235,7 +236,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token)
result = interpret_float_suffix (str, limit - str);
if (result == 0)
{
cpp_error (pfile, DL_ERROR,
cpp_error (pfile, CPP_DL_ERROR,
"invalid suffix \"%.*s\" on floating constant",
(int) (limit - str), str);
return CPP_N_INVALID;
@ -245,7 +246,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token)
if (limit != str
&& CPP_WTRADITIONAL (pfile)
&& ! cpp_sys_macro_p (pfile))
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"traditional C rejects the \"%.*s\" suffix",
(int) (limit - str), str);
@ -256,7 +257,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token)
result = interpret_int_suffix (str, limit - str);
if (result == 0)
{
cpp_error (pfile, DL_ERROR,
cpp_error (pfile, CPP_DL_ERROR,
"invalid suffix \"%.*s\" on integer constant",
(int) (limit - str), str);
return CPP_N_INVALID;
@ -270,7 +271,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token)
int large = (result & CPP_N_WIDTH) == CPP_N_LARGE;
if (u_or_i || (large && CPP_OPTION (pfile, warn_long_long)))
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"traditional C rejects the \"%.*s\" suffix",
(int) (limit - str), str);
}
@ -278,13 +279,15 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token)
if ((result & CPP_N_WIDTH) == CPP_N_LARGE
&& ! CPP_OPTION (pfile, c99)
&& CPP_OPTION (pfile, warn_long_long))
cpp_error (pfile, DL_PEDWARN, "use of C99 long long integer constant");
cpp_error (pfile, CPP_DL_PEDWARN,
"use of C99 long long integer constant");
result |= CPP_N_INTEGER;
}
if ((result & CPP_N_IMAGINARY) && CPP_PEDANTIC (pfile))
cpp_error (pfile, DL_PEDWARN, "imaginary constants are a GCC extension");
cpp_error (pfile, CPP_DL_PEDWARN,
"imaginary constants are a GCC extension");
if (radix == 10)
result |= CPP_N_DECIMAL;
@ -369,7 +372,7 @@ cpp_interpret_integer (cpp_reader *pfile, const cpp_token *token,
}
if (overflow)
cpp_error (pfile, DL_PEDWARN,
cpp_error (pfile, CPP_DL_PEDWARN,
"integer constant is too large for its type");
/* If too big to be signed, consider it unsigned. Only warn for
decimal numbers. Traditional numbers were always signed (but
@ -381,7 +384,7 @@ cpp_interpret_integer (cpp_reader *pfile, const cpp_token *token,
&& !num_positive (result, precision))
{
if (base == 10)
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"integer constant is so large that it is unsigned");
result.unsignedp = true;
}
@ -464,13 +467,13 @@ parse_defined (cpp_reader *pfile)
node = token->val.node;
if (paren && cpp_get_token (pfile)->type != CPP_CLOSE_PAREN)
{
cpp_error (pfile, DL_ERROR, "missing ')' after \"defined\"");
cpp_error (pfile, CPP_DL_ERROR, "missing ')' after \"defined\"");
node = 0;
}
}
else
{
cpp_error (pfile, DL_ERROR,
cpp_error (pfile, CPP_DL_ERROR,
"operator \"defined\" requires an identifier");
if (token->flags & NAMED_OP)
{
@ -478,7 +481,7 @@ parse_defined (cpp_reader *pfile)
op.flags = 0;
op.type = token->type;
cpp_error (pfile, DL_ERROR,
cpp_error (pfile, CPP_DL_ERROR,
"(\"%s\" is an alternative token for \"%s\" in C++)",
cpp_token_as_text (pfile, token),
cpp_token_as_text (pfile, &op));
@ -488,7 +491,7 @@ parse_defined (cpp_reader *pfile)
if (node)
{
if (pfile->context != initial_context && CPP_PEDANTIC (pfile))
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"this use of \"defined\" may not be portable");
_cpp_mark_macro_used (node);
@ -524,13 +527,13 @@ eval_token (cpp_reader *pfile, const cpp_token *token)
switch (temp & CPP_N_CATEGORY)
{
case CPP_N_FLOATING:
cpp_error (pfile, DL_ERROR,
cpp_error (pfile, CPP_DL_ERROR,
"floating constant in preprocessor expression");
break;
case CPP_N_INTEGER:
if (!(temp & CPP_N_IMAGINARY))
return cpp_interpret_integer (pfile, token, temp);
cpp_error (pfile, DL_ERROR,
cpp_error (pfile, CPP_DL_ERROR,
"imaginary number in preprocessor expression");
break;
@ -576,7 +579,7 @@ eval_token (cpp_reader *pfile, const cpp_token *token)
result.high = 0;
result.low = 0;
if (CPP_OPTION (pfile, warn_undef) && !pfile->state.skip_eval)
cpp_error (pfile, DL_WARNING, "\"%s\" is not defined",
cpp_error (pfile, CPP_DL_WARNING, "\"%s\" is not defined",
NODE_NAME (token->val.node));
}
break;
@ -805,7 +808,7 @@ _cpp_parse_expr (cpp_reader *pfile)
if (top != pfile->op_stack)
{
cpp_error (pfile, DL_ICE, "unbalanced stack in #if");
cpp_error (pfile, CPP_DL_ICE, "unbalanced stack in #if");
syntax_error:
return false; /* Return false on syntax error. */
}
@ -824,7 +827,7 @@ reduce (cpp_reader *pfile, struct op *top, enum cpp_ttype op)
if (top->op <= CPP_EQ || top->op > CPP_LAST_CPP_OP + 2)
{
bad_op:
cpp_error (pfile, DL_ICE, "impossible operator '%u'", top->op);
cpp_error (pfile, CPP_DL_ICE, "impossible operator '%u'", top->op);
return 0;
}
@ -916,7 +919,7 @@ reduce (cpp_reader *pfile, struct op *top, enum cpp_ttype op)
case CPP_OPEN_PAREN:
if (op != CPP_CLOSE_PAREN)
{
cpp_error (pfile, DL_ERROR, "missing ')' in expression");
cpp_error (pfile, CPP_DL_ERROR, "missing ')' in expression");
return 0;
}
top--;
@ -937,7 +940,7 @@ reduce (cpp_reader *pfile, struct op *top, enum cpp_ttype op)
continue;
case CPP_QUERY:
cpp_error (pfile, DL_ERROR, "'?' without following ':'");
cpp_error (pfile, CPP_DL_ERROR, "'?' without following ':'");
return 0;
default:
@ -946,13 +949,13 @@ reduce (cpp_reader *pfile, struct op *top, enum cpp_ttype op)
top--;
if (top->value.overflow && !pfile->state.skip_eval)
cpp_error (pfile, DL_PEDWARN,
cpp_error (pfile, CPP_DL_PEDWARN,
"integer overflow in preprocessor expression");
}
if (op == CPP_CLOSE_PAREN)
{
cpp_error (pfile, DL_ERROR, "missing '(' in expression");
cpp_error (pfile, CPP_DL_ERROR, "missing '(' in expression");
return 0;
}
@ -983,12 +986,12 @@ check_promotion (cpp_reader *pfile, const struct op *op)
if (op->value.unsignedp)
{
if (!num_positive (op[-1].value, CPP_OPTION (pfile, precision)))
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"the left operand of \"%s\" changes sign when promoted",
cpp_token_as_text (pfile, op->token));
}
else if (!num_positive (op->value, CPP_OPTION (pfile, precision)))
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"the right operand of \"%s\" changes sign when promoted",
cpp_token_as_text (pfile, op->token));
}
@ -1246,7 +1249,7 @@ num_unary_op (cpp_reader *pfile, cpp_num num, enum cpp_ttype op)
{
case CPP_UPLUS:
if (CPP_WTRADITIONAL (pfile) && !pfile->state.skip_eval)
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"traditional C rejects the unary plus operator");
num.overflow = false;
break;
@ -1345,7 +1348,7 @@ num_binary_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op)
/* Comma. */
default: /* case CPP_COMMA: */
if (CPP_PEDANTIC (pfile) && !pfile->state.skip_eval)
cpp_error (pfile, DL_PEDWARN,
cpp_error (pfile, CPP_DL_PEDWARN,
"comma operator in operand of #if");
lhs = rhs;
break;
@ -1477,7 +1480,7 @@ num_div_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op)
else
{
if (!pfile->state.skip_eval)
cpp_error (pfile, DL_ERROR, "division by zero in #if");
cpp_error (pfile, CPP_DL_ERROR, "division by zero in #if");
return lhs;
}

View File

@ -354,7 +354,7 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir, bool f
/* Ensure we get no confusion between cached files and directories. */
if (start_dir == NULL)
cpp_error (pfile, DL_ICE, "NULL directory in find_file");
cpp_error (pfile, CPP_DL_ICE, "NULL directory in find_file");
hash_slot = (struct file_hash_entry **)
htab_find_slot (pfile->file_hash, fname, INSERT);
@ -432,7 +432,7 @@ read_file_guts (cpp_reader *pfile, _cpp_file *file)
if (S_ISBLK (file->st.st_mode))
{
cpp_error (pfile, DL_ERROR, "%s is a block device", file->path);
cpp_error (pfile, CPP_DL_ERROR, "%s is a block device", file->path);
return false;
}
@ -449,7 +449,7 @@ read_file_guts (cpp_reader *pfile, _cpp_file *file)
does not bite us. */
if (file->st.st_size > INTTYPE_MAXIMUM (ssize_t))
{
cpp_error (pfile, DL_ERROR, "%s is too large", file->path);
cpp_error (pfile, CPP_DL_ERROR, "%s is too large", file->path);
return false;
}
@ -478,12 +478,13 @@ read_file_guts (cpp_reader *pfile, _cpp_file *file)
if (count < 0)
{
cpp_errno (pfile, DL_ERROR, file->path);
cpp_errno (pfile, CPP_DL_ERROR, file->path);
return false;
}
if (regular && total != size && STAT_SIZE_RELIABLE (file->st))
cpp_error (pfile, DL_WARNING, "%s is shorter than expected", file->path);
cpp_error (pfile, CPP_DL_WARNING,
"%s is shorter than expected", file->path);
/* Shrink buffer if we allocated substantially too much. */
if (total + 4096 < size)
@ -675,7 +676,7 @@ search_path_head (cpp_reader *pfile, const char *fname, int angle_brackets,
return make_cpp_dir (pfile, dir_name_of_file (file), pfile->map->sysp);
if (dir == NULL)
cpp_error (pfile, DL_ERROR,
cpp_error (pfile, CPP_DL_ERROR,
"no include path in which to search for %s", fname);
return dir;
@ -732,9 +733,9 @@ open_file_failed (cpp_reader *pfile, _cpp_file *file)
/* If we are outputting dependencies but not for this file then
don't error because we can still produce correct output. */
if (CPP_OPTION (pfile, deps.style) && ! print_dep)
cpp_errno (pfile, DL_WARNING, file->path);
cpp_errno (pfile, CPP_DL_WARNING, file->path);
else
cpp_errno (pfile, DL_ERROR, file->path);
cpp_errno (pfile, CPP_DL_ERROR, file->path);
}
}

View File

@ -383,36 +383,37 @@ static void sanity_checks (cpp_reader *pfile)
type precisions made by cpplib. */
test--;
if (test < 1)
cpp_error (pfile, DL_ICE, "cppchar_t must be an unsigned type");
cpp_error (pfile, CPP_DL_ICE, "cppchar_t must be an unsigned type");
if (CPP_OPTION (pfile, precision) > max_precision)
cpp_error (pfile, DL_ICE,
cpp_error (pfile, CPP_DL_ICE,
"preprocessor arithmetic has maximum precision of %lu bits;"
" target requires %lu bits",
(unsigned long) max_precision,
(unsigned long) CPP_OPTION (pfile, precision));
if (CPP_OPTION (pfile, precision) < CPP_OPTION (pfile, int_precision))
cpp_error (pfile, DL_ICE,
cpp_error (pfile, CPP_DL_ICE,
"CPP arithmetic must be at least as precise as a target int");
if (CPP_OPTION (pfile, char_precision) < 8)
cpp_error (pfile, DL_ICE, "target char is less than 8 bits wide");
cpp_error (pfile, CPP_DL_ICE, "target char is less than 8 bits wide");
if (CPP_OPTION (pfile, wchar_precision) < CPP_OPTION (pfile, char_precision))
cpp_error (pfile, DL_ICE,
cpp_error (pfile, CPP_DL_ICE,
"target wchar_t is narrower than target char");
if (CPP_OPTION (pfile, int_precision) < CPP_OPTION (pfile, char_precision))
cpp_error (pfile, DL_ICE,
cpp_error (pfile, CPP_DL_ICE,
"target int is narrower than target char");
/* This is assumed in eval_token() and could be fixed if necessary. */
if (sizeof (cppchar_t) > sizeof (cpp_num_part))
cpp_error (pfile, DL_ICE, "CPP half-integer narrower than CPP character");
cpp_error (pfile, CPP_DL_ICE,
"CPP half-integer narrower than CPP character");
if (CPP_OPTION (pfile, wchar_precision) > BITS_PER_CPPCHAR_T)
cpp_error (pfile, DL_ICE,
cpp_error (pfile, CPP_DL_ICE,
"CPP on this host cannot handle wide character constants over"
" %lu bits, but the target requires %lu bits",
(unsigned long) BITS_PER_CPPCHAR_T,

View File

@ -270,12 +270,12 @@ _cpp_process_line_notes (cpp_reader *pfile, int in_comment)
if (note->type == '\\' || note->type == ' ')
{
if (note->type == ' ' && !in_comment)
cpp_error_with_line (pfile, DL_WARNING, pfile->line, col,
cpp_error_with_line (pfile, CPP_DL_WARNING, pfile->line, col,
"backslash and newline separated by space");
if (buffer->next_line > buffer->rlimit)
{
cpp_error_with_line (pfile, DL_PEDWARN, pfile->line, col,
cpp_error_with_line (pfile, CPP_DL_PEDWARN, pfile->line, col,
"backslash-newline at end of file");
/* Prevent "no newline at end of file" warning. */
buffer->next_line = buffer->rlimit;
@ -290,14 +290,14 @@ _cpp_process_line_notes (cpp_reader *pfile, int in_comment)
&& (!in_comment || warn_in_comment (pfile, note)))
{
if (CPP_OPTION (pfile, trigraphs))
cpp_error_with_line (pfile, DL_WARNING, pfile->line, col,
cpp_error_with_line (pfile, CPP_DL_WARNING, pfile->line, col,
"trigraph ??%c converted to %c",
note->type,
(int) _cpp_trigraph_map[note->type]);
else
{
cpp_error_with_line
(pfile, DL_WARNING, pfile->line, col,
(pfile, CPP_DL_WARNING, pfile->line, col,
"trigraph ??%c ignored, use -trigraphs to enable",
note->type);
}
@ -342,7 +342,7 @@ _cpp_skip_block_comment (cpp_reader *pfile)
&& cur[0] == '*' && cur[1] != '/')
{
buffer->cur = cur;
cpp_error_with_line (pfile, DL_WARNING,
cpp_error_with_line (pfile, CPP_DL_WARNING,
pfile->line, CPP_BUF_COL (buffer),
"\"/*\" within comment");
}
@ -396,7 +396,7 @@ skip_whitespace (cpp_reader *pfile, cppchar_t c)
else if (c == '\0')
saw_NUL = true;
else if (pfile->state.in_directive && CPP_PEDANTIC (pfile))
cpp_error_with_line (pfile, DL_PEDWARN, pfile->line,
cpp_error_with_line (pfile, CPP_DL_PEDWARN, pfile->line,
CPP_BUF_COL (buffer),
"%s in preprocessing directive",
c == '\f' ? "form feed" : "vertical tab");
@ -407,7 +407,7 @@ skip_whitespace (cpp_reader *pfile, cppchar_t c)
while (is_nvspace (c));
if (saw_NUL)
cpp_error (pfile, DL_WARNING, "null character(s) ignored");
cpp_error (pfile, CPP_DL_WARNING, "null character(s) ignored");
buffer->cur--;
}
@ -442,7 +442,7 @@ forms_identifier_p (cpp_reader *pfile, int first)
if (CPP_OPTION (pfile, warn_dollars) && !pfile->state.skipping)
{
CPP_OPTION (pfile, warn_dollars) = 0;
cpp_error (pfile, DL_PEDWARN, "'$' in identifier or number");
cpp_error (pfile, CPP_DL_PEDWARN, "'$' in identifier or number");
}
return true;
@ -489,14 +489,14 @@ lex_identifier (cpp_reader *pfile, const uchar *base)
{
/* It is allowed to poison the same identifier twice. */
if ((result->flags & NODE_POISONED) && !pfile->state.poisoned_ok)
cpp_error (pfile, DL_ERROR, "attempt to use poisoned \"%s\"",
cpp_error (pfile, CPP_DL_ERROR, "attempt to use poisoned \"%s\"",
NODE_NAME (result));
/* Constraint 6.10.3.5: __VA_ARGS__ should only appear in the
replacement list of a variadic macro. */
if (result == pfile->spec_nodes.n__VA_ARGS__
&& !pfile->state.va_args_ok)
cpp_error (pfile, DL_PEDWARN,
cpp_error (pfile, CPP_DL_PEDWARN,
"__VA_ARGS__ can only appear in the expansion"
" of a C99 variadic macro");
}
@ -592,7 +592,8 @@ lex_string (cpp_reader *pfile, cpp_token *token, const uchar *base)
}
if (saw_NUL && !pfile->state.skipping)
cpp_error (pfile, DL_WARNING, "null character(s) preserved in literal");
cpp_error (pfile, CPP_DL_WARNING,
"null character(s) preserved in literal");
pfile->buffer->cur = cur;
create_literal (pfile, token, base, cur - base, type);
@ -771,7 +772,7 @@ _cpp_get_fresh_line (cpp_reader *pfile)
{
/* Only warn once. */
buffer->next_line = buffer->rlimit;
cpp_error_with_line (pfile, DL_PEDWARN, pfile->line - 1,
cpp_error_with_line (pfile, CPP_DL_PEDWARN, pfile->line - 1,
CPP_BUF_COLUMN (buffer, buffer->cur),
"no newline at end of file");
}
@ -912,7 +913,7 @@ _cpp_lex_direct (cpp_reader *pfile)
if (c == '*')
{
if (_cpp_skip_block_comment (pfile))
cpp_error (pfile, DL_ERROR, "unterminated comment");
cpp_error (pfile, CPP_DL_ERROR, "unterminated comment");
}
else if (c == '/' && (CPP_OPTION (pfile, cplusplus_comments)
|| CPP_IN_SYSTEM_HEADER (pfile)))
@ -922,15 +923,15 @@ _cpp_lex_direct (cpp_reader *pfile)
if (CPP_OPTION (pfile, lang) == CLK_GNUC89 && CPP_PEDANTIC (pfile)
&& ! buffer->warned_cplusplus_comments)
{
cpp_error (pfile, DL_PEDWARN,
cpp_error (pfile, CPP_DL_PEDWARN,
"C++ style comments are not allowed in ISO C90");
cpp_error (pfile, DL_PEDWARN,
cpp_error (pfile, CPP_DL_PEDWARN,
"(this will be reported only once per input file)");
buffer->warned_cplusplus_comments = 1;
}
if (skip_line_comment (pfile) && CPP_OPTION (pfile, warn_comments))
cpp_error (pfile, DL_WARNING, "multi-line comment");
cpp_error (pfile, CPP_DL_WARNING, "multi-line comment");
}
else if (c == '=')
{
@ -1193,7 +1194,8 @@ cpp_spell_token (cpp_reader *pfile, const cpp_token *token,
break;
case SPELL_NONE:
cpp_error (pfile, DL_ICE, "unspellable token %s", TOKEN_NAME (token));
cpp_error (pfile, CPP_DL_ICE,
"unspellable token %s", TOKEN_NAME (token));
break;
}

View File

@ -215,7 +215,7 @@ static void
check_eol (cpp_reader *pfile)
{
if (! SEEN_EOL () && _cpp_lex_token (pfile)->type != CPP_EOF)
cpp_error (pfile, DL_PEDWARN, "extra tokens at end of #%s directive",
cpp_error (pfile, CPP_DL_PEDWARN, "extra tokens at end of #%s directive",
pfile->directive->name);
}
@ -298,7 +298,7 @@ directive_diagnostics (cpp_reader *pfile, const directive *dir, int indented)
if (CPP_PEDANTIC (pfile)
&& ! pfile->state.skipping
&& dir->origin == EXTENSION)
cpp_error (pfile, DL_PEDWARN, "#%s is a GCC extension", dir->name);
cpp_error (pfile, CPP_DL_PEDWARN, "#%s is a GCC extension", dir->name);
/* Traditionally, a directive is ignored unless its # is in
column 1. Therefore in code intended to work with K+R
@ -309,14 +309,14 @@ directive_diagnostics (cpp_reader *pfile, const directive *dir, int indented)
if (CPP_WTRADITIONAL (pfile))
{
if (dir == &dtable[T_ELIF])
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"suggest not using #elif in traditional C");
else if (indented && dir->origin == KANDR)
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"traditional C ignores #%s with the # indented",
dir->name);
else if (!indented && dir->origin != KANDR)
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"suggest hiding #%s from traditional C with an indented #",
dir->name);
}
@ -338,7 +338,7 @@ _cpp_handle_directive (cpp_reader *pfile, int indented)
if (was_parsing_args)
{
if (CPP_OPTION (pfile, pedantic))
cpp_error (pfile, DL_PEDWARN,
cpp_error (pfile, CPP_DL_PEDWARN,
"embedding a directive within macro arguments is not portable");
pfile->state.parsing_args = 0;
pfile->state.prevent_expansion = 0;
@ -358,7 +358,7 @@ _cpp_handle_directive (cpp_reader *pfile, int indented)
dir = &linemarker_dir;
if (CPP_PEDANTIC (pfile) && ! CPP_OPTION (pfile, preprocessed)
&& ! pfile->state.skipping)
cpp_error (pfile, DL_PEDWARN,
cpp_error (pfile, CPP_DL_PEDWARN,
"style of line directive is a GCC extension");
}
@ -409,7 +409,7 @@ _cpp_handle_directive (cpp_reader *pfile, int indented)
if (CPP_OPTION (pfile, lang) == CLK_ASM)
skip = 0;
else if (!pfile->state.skipping)
cpp_error (pfile, DL_ERROR, "invalid preprocessing directive #%s",
cpp_error (pfile, CPP_DL_ERROR, "invalid preprocessing directive #%s",
cpp_token_as_text (pfile, dname));
}
@ -477,20 +477,20 @@ lex_macro_node (cpp_reader *pfile)
cpp_hashnode *node = token->val.node;
if (node == pfile->spec_nodes.n_defined)
cpp_error (pfile, DL_ERROR,
cpp_error (pfile, CPP_DL_ERROR,
"\"defined\" cannot be used as a macro name");
else if (! (node->flags & NODE_POISONED))
return node;
}
else if (token->flags & NAMED_OP)
cpp_error (pfile, DL_ERROR,
cpp_error (pfile, CPP_DL_ERROR,
"\"%s\" cannot be used as a macro name as it is an operator in C++",
NODE_NAME (token->val.node));
else if (token->type == CPP_EOF)
cpp_error (pfile, DL_ERROR, "no macro name given in #%s directive",
cpp_error (pfile, CPP_DL_ERROR, "no macro name given in #%s directive",
pfile->directive->name);
else
cpp_error (pfile, DL_ERROR, "macro names must be identifiers");
cpp_error (pfile, CPP_DL_ERROR, "macro names must be identifiers");
return NULL;
}
@ -528,7 +528,8 @@ do_undef (cpp_reader *pfile)
pfile->cb.undef (pfile, pfile->directive_line, node);
if (node->flags & NODE_WARN)
cpp_error (pfile, DL_WARNING, "undefining \"%s\"", NODE_NAME (node));
cpp_error (pfile, CPP_DL_WARNING,
"undefining \"%s\"", NODE_NAME (node));
if (CPP_OPTION (pfile, warn_unused_macros))
_cpp_warn_if_unused_macro (pfile, node, NULL);
@ -598,7 +599,7 @@ glue_header_name (cpp_reader *pfile)
break;
if (token->type == CPP_EOF)
{
cpp_error (pfile, DL_ERROR, "missing terminating > character");
cpp_error (pfile, CPP_DL_ERROR, "missing terminating > character");
break;
}
@ -651,7 +652,7 @@ parse_include (cpp_reader *pfile, int *pangle_brackets)
dir = U"pragma dependency";
else
dir = pfile->directive->name;
cpp_error (pfile, DL_ERROR, "#%s expects \"FILENAME\" or <FILENAME>",
cpp_error (pfile, CPP_DL_ERROR, "#%s expects \"FILENAME\" or <FILENAME>",
dir);
return NULL;
@ -674,7 +675,7 @@ do_include_common (cpp_reader *pfile, enum include_type type)
/* Prevent #include recursion. */
if (pfile->line_maps.depth >= CPP_STACK_MAX)
cpp_error (pfile, DL_ERROR, "#include nested too deeply");
cpp_error (pfile, CPP_DL_ERROR, "#include nested too deeply");
else
{
/* Get out of macro context, if we are. */
@ -711,7 +712,7 @@ do_include_next (cpp_reader *pfile)
search logic. */
if (! pfile->buffer->prev)
{
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"#include_next in primary source file");
type = IT_INCLUDE;
}
@ -738,7 +739,7 @@ read_flag (cpp_reader *pfile, unsigned int last)
}
if (token->type != CPP_EOF)
cpp_error (pfile, DL_ERROR, "invalid flag \"%s\" in line directive",
cpp_error (pfile, CPP_DL_ERROR, "invalid flag \"%s\" in line directive",
cpp_token_as_text (pfile, token));
return 0;
}
@ -782,14 +783,14 @@ do_line (cpp_reader *pfile)
|| strtoul_for_line (token->val.str.text, token->val.str.len,
&new_lineno))
{
cpp_error (pfile, DL_ERROR,
cpp_error (pfile, CPP_DL_ERROR,
"\"%s\" after #line is not a positive integer",
cpp_token_as_text (pfile, token));
return;
}
if (CPP_PEDANTIC (pfile) && (new_lineno == 0 || new_lineno > cap))
cpp_error (pfile, DL_PEDWARN, "line number out of range");
cpp_error (pfile, CPP_DL_PEDWARN, "line number out of range");
token = cpp_get_token (pfile);
if (token->type == CPP_STRING)
@ -801,7 +802,7 @@ do_line (cpp_reader *pfile)
}
else if (token->type != CPP_EOF)
{
cpp_error (pfile, DL_ERROR, "\"%s\" is not a valid filename",
cpp_error (pfile, CPP_DL_ERROR, "\"%s\" is not a valid filename",
cpp_token_as_text (pfile, token));
return;
}
@ -835,7 +836,8 @@ do_linemarker (cpp_reader *pfile)
|| strtoul_for_line (token->val.str.text, token->val.str.len,
&new_lineno))
{
cpp_error (pfile, DL_ERROR, "\"%s\" after # is not a positive integer",
cpp_error (pfile, CPP_DL_ERROR,
"\"%s\" after # is not a positive integer",
cpp_token_as_text (pfile, token));
return;
}
@ -873,7 +875,7 @@ do_linemarker (cpp_reader *pfile)
}
else if (token->type != CPP_EOF)
{
cpp_error (pfile, DL_ERROR, "\"%s\" is not a valid filename",
cpp_error (pfile, CPP_DL_ERROR, "\"%s\" is not a valid filename",
cpp_token_as_text (pfile, token));
return;
}
@ -918,14 +920,14 @@ do_diagnostic (cpp_reader *pfile, int code, int print_dir)
static void
do_error (cpp_reader *pfile)
{
do_diagnostic (pfile, DL_ERROR, 1);
do_diagnostic (pfile, CPP_DL_ERROR, 1);
}
static void
do_warning (cpp_reader *pfile)
{
/* We want #warning diagnostics to be emitted in system headers too. */
do_diagnostic (pfile, DL_WARNING_SYSHDR, 1);
do_diagnostic (pfile, CPP_DL_WARNING_SYSHDR, 1);
}
/* Report program identification. */
@ -935,7 +937,7 @@ do_ident (cpp_reader *pfile)
const cpp_token *str = cpp_get_token (pfile);
if (str->type != CPP_STRING)
cpp_error (pfile, DL_ERROR, "invalid #ident directive");
cpp_error (pfile, CPP_DL_ERROR, "invalid #ident directive");
else if (pfile->cb.ident)
pfile->cb.ident (pfile, pfile->directive_line, &str->val.str);
@ -1014,14 +1016,14 @@ cpp_register_pragma (cpp_reader *pfile, const char *space, const char *name,
{
if (entry->is_nspace)
clash:
cpp_error (pfile, DL_ICE,
cpp_error (pfile, CPP_DL_ICE,
"registering \"%s\" as both a pragma and a pragma namespace",
NODE_NAME (node));
else if (space)
cpp_error (pfile, DL_ICE, "#pragma %s %s is already registered",
cpp_error (pfile, CPP_DL_ICE, "#pragma %s %s is already registered",
space, name);
else
cpp_error (pfile, DL_ICE, "#pragma %s is already registered", name);
cpp_error (pfile, CPP_DL_ICE, "#pragma %s is already registered", name);
}
else
insert_pragma_entry (pfile, chain, node, handler);
@ -1166,7 +1168,7 @@ static void
do_pragma_once (cpp_reader *pfile)
{
if (pfile->buffer->prev == NULL)
cpp_error (pfile, DL_WARNING, "#pragma once in main file");
cpp_error (pfile, CPP_DL_WARNING, "#pragma once in main file");
check_eol (pfile);
_cpp_mark_file_once_only (pfile, pfile->buffer->file);
@ -1188,7 +1190,8 @@ do_pragma_poison (cpp_reader *pfile)
break;
if (tok->type != CPP_NAME)
{
cpp_error (pfile, DL_ERROR, "invalid #pragma GCC poison directive");
cpp_error (pfile, CPP_DL_ERROR,
"invalid #pragma GCC poison directive");
break;
}
@ -1197,7 +1200,7 @@ do_pragma_poison (cpp_reader *pfile)
continue;
if (hp->type == NT_MACRO)
cpp_error (pfile, DL_WARNING, "poisoning existing macro \"%s\"",
cpp_error (pfile, CPP_DL_WARNING, "poisoning existing macro \"%s\"",
NODE_NAME (hp));
_cpp_free_definition (hp);
hp->flags |= NODE_POISONED | NODE_DIAGNOSTIC;
@ -1217,7 +1220,7 @@ do_pragma_system_header (cpp_reader *pfile)
cpp_buffer *buffer = pfile->buffer;
if (buffer->prev == 0)
cpp_error (pfile, DL_WARNING,
cpp_error (pfile, CPP_DL_WARNING,
"#pragma system_header ignored outside include file");
else
{
@ -1242,14 +1245,15 @@ do_pragma_dependency (cpp_reader *pfile)
ordering = _cpp_compare_file_date (pfile, fname, angle_brackets);
if (ordering < 0)
cpp_error (pfile, DL_WARNING, "cannot find source file %s", fname);
cpp_error (pfile, CPP_DL_WARNING, "cannot find source file %s", fname);
else if (ordering > 0)
{
cpp_error (pfile, DL_WARNING, "current file is older than %s", fname);
cpp_error (pfile, CPP_DL_WARNING,
"current file is older than %s", fname);
if (cpp_get_token (pfile)->type != CPP_EOF)
{
_cpp_backup_tokens (pfile, 1);
do_diagnostic (pfile, DL_WARNING, 0);
do_diagnostic (pfile, CPP_DL_WARNING, 0);
}
}
@ -1358,7 +1362,7 @@ _cpp_do__Pragma (cpp_reader *pfile)
if (string)
destringize_and_run (pfile, &string->val.str);
else
cpp_error (pfile, DL_ERROR,
cpp_error (pfile, CPP_DL_ERROR,
"_Pragma takes a parenthesized string literal");
}
@ -1437,13 +1441,13 @@ do_else (cpp_reader *pfile)
struct if_stack *ifs = buffer->if_stack;
if (ifs == NULL)
cpp_error (pfile, DL_ERROR, "#else without #if");
cpp_error (pfile, CPP_DL_ERROR, "#else without #if");
else
{
if (ifs->type == T_ELSE)
{
cpp_error (pfile, DL_ERROR, "#else after #else");
cpp_error_with_line (pfile, DL_ERROR, ifs->line, 0,
cpp_error (pfile, CPP_DL_ERROR, "#else after #else");
cpp_error_with_line (pfile, CPP_DL_ERROR, ifs->line, 0,
"the conditional began here");
}
ifs->type = T_ELSE;
@ -1470,13 +1474,13 @@ do_elif (cpp_reader *pfile)
struct if_stack *ifs = buffer->if_stack;
if (ifs == NULL)
cpp_error (pfile, DL_ERROR, "#elif without #if");
cpp_error (pfile, CPP_DL_ERROR, "#elif without #if");
else
{
if (ifs->type == T_ELSE)
{
cpp_error (pfile, DL_ERROR, "#elif after #else");
cpp_error_with_line (pfile, DL_ERROR, ifs->line, 0,
cpp_error (pfile, CPP_DL_ERROR, "#elif after #else");
cpp_error_with_line (pfile, CPP_DL_ERROR, ifs->line, 0,
"the conditional began here");
}
ifs->type = T_ELIF;
@ -1505,7 +1509,7 @@ do_endif (cpp_reader *pfile)
struct if_stack *ifs = buffer->if_stack;
if (ifs == NULL)
cpp_error (pfile, DL_ERROR, "#endif without #if");
cpp_error (pfile, CPP_DL_ERROR, "#endif without #if");
else
{
/* Only check EOL if was not originally skipping. */
@ -1582,7 +1586,7 @@ parse_answer (cpp_reader *pfile, struct answer **answerp, int type)
if (type == T_UNASSERT && paren->type == CPP_EOF)
return 0;
cpp_error (pfile, DL_ERROR, "missing '(' after predicate");
cpp_error (pfile, CPP_DL_ERROR, "missing '(' after predicate");
return 1;
}
@ -1597,7 +1601,7 @@ parse_answer (cpp_reader *pfile, struct answer **answerp, int type)
if (token->type == CPP_EOF)
{
cpp_error (pfile, DL_ERROR, "missing ')' to complete answer");
cpp_error (pfile, CPP_DL_ERROR, "missing ')' to complete answer");
return 1;
}
@ -1617,7 +1621,7 @@ parse_answer (cpp_reader *pfile, struct answer **answerp, int type)
if (acount == 0)
{
cpp_error (pfile, DL_ERROR, "predicate's answer is empty");
cpp_error (pfile, CPP_DL_ERROR, "predicate's answer is empty");
return 1;
}
@ -1644,9 +1648,9 @@ parse_assertion (cpp_reader *pfile, struct answer **answerp, int type)
*answerp = 0;
predicate = cpp_get_token (pfile);
if (predicate->type == CPP_EOF)
cpp_error (pfile, DL_ERROR, "assertion without predicate");
cpp_error (pfile, CPP_DL_ERROR, "assertion without predicate");
else if (predicate->type != CPP_NAME)
cpp_error (pfile, DL_ERROR, "predicate must be an identifier");
cpp_error (pfile, CPP_DL_ERROR, "predicate must be an identifier");
else if (parse_answer (pfile, answerp, type) == 0)
{
unsigned int len = NODE_LEN (predicate->val.node);
@ -1730,7 +1734,7 @@ do_assert (cpp_reader *pfile)
{
if (*find_answer (node, new_answer))
{
cpp_error (pfile, DL_WARNING, "\"%s\" re-asserted",
cpp_error (pfile, CPP_DL_WARNING, "\"%s\" re-asserted",
NODE_NAME (node) + 1);
return;
}
@ -1940,7 +1944,7 @@ _cpp_pop_buffer (cpp_reader *pfile)
/* Walk back up the conditional stack till we reach its level at
entry to this file, issuing error messages. */
for (ifs = buffer->if_stack; ifs; ifs = ifs->next)
cpp_error_with_line (pfile, DL_ERROR, ifs->line, 0,
cpp_error_with_line (pfile, CPP_DL_ERROR, ifs->line, 0,
"unterminated #%s", dtable[ifs->type].name);
/* In case of a missing #endif. */

View File

@ -655,21 +655,21 @@ cpp_num cpp_num_sign_extend (cpp_num, size_t);
with a line number of zero. */
/* Warning, an error with -Werror. */
#define DL_WARNING 0x00
/* Same as DL_WARNING, except it is not suppressed in system headers. */
#define DL_WARNING_SYSHDR 0x01
#define CPP_DL_WARNING 0x00
/* Same as CPP_DL_WARNING, except it is not suppressed in system headers. */
#define CPP_DL_WARNING_SYSHDR 0x01
/* Warning, an error with -pedantic-errors or -Werror. */
#define DL_PEDWARN 0x02
#define CPP_DL_PEDWARN 0x02
/* An error. */
#define DL_ERROR 0x03
#define CPP_DL_ERROR 0x03
/* An internal consistency check failed. Prints "internal error: ",
otherwise the same as DL_ERROR. */
#define DL_ICE 0x04
otherwise the same as CPP_DL_ERROR. */
#define CPP_DL_ICE 0x04
/* Extracts a diagnostic level from an int. */
#define DL_EXTRACT(l) (l & 0xf)
#define CPP_DL_EXTRACT(l) (l & 0xf)
/* Nonzero if a diagnostic level is one of the warnings. */
#define DL_WARNING_P(l) (DL_EXTRACT (l) >= DL_WARNING \
&& DL_EXTRACT (l) <= DL_PEDWARN)
#define CPP_DL_WARNING_P(l) (CPP_DL_EXTRACT (l) >= CPP_DL_WARNING \
&& CPP_DL_EXTRACT (l) <= CPP_DL_PEDWARN)
/* N.B. The error-message-printer prototypes have not been nicely
formatted because exgettext needs to see 'msgid' on the same line

View File

@ -81,7 +81,7 @@ _cpp_warn_if_unused_macro (cpp_reader *pfile, cpp_hashnode *node,
if (!macro->used
&& MAIN_FILE_P (linemap_lookup (&pfile->line_maps, macro->line)))
cpp_error_with_line (pfile, DL_WARNING, macro->line, 0,
cpp_error_with_line (pfile, CPP_DL_WARNING, macro->line, 0,
"macro \"%s\" is not used", NODE_NAME (node));
}
@ -122,7 +122,7 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *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;
@ -217,7 +217,7 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
}
else
{
cpp_errno (pfile, DL_WARNING,
cpp_errno (pfile, CPP_DL_WARNING,
"could not determine date and time");
pfile->date = U"\"??? ?? ????\"";
@ -277,7 +277,7 @@ builtin_macro (cpp_reader *pfile, cpp_hashnode *node)
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);
@ -389,7 +389,7 @@ stringify_arg (cpp_reader *pfile, macro_arg *arg)
/* 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--;
}
@ -472,7 +472,7 @@ paste_all_tokens (cpp_reader *pfile, const cpp_token *lhs)
/* 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));
@ -510,17 +510,17 @@ _cpp_arguments_ok (cpp_reader *pfile, cpp_macro *macro, const cpp_hashnode *node
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);
@ -631,7 +631,7 @@ collect_args (cpp_reader *pfile, const cpp_hashnode *node)
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));
}
@ -734,7 +734,7 @@ enter_macro_context (cpp_reader *pfile, cpp_hashnode *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));
@ -1238,7 +1238,7 @@ _cpp_save_parameter (cpp_reader *pfile, cpp_macro *macro, cpp_hashnode *node)
/* 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;
}
@ -1282,7 +1282,7 @@ parse_params (cpp_reader *pfile, cpp_macro *macro)
&& ! 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;
@ -1290,7 +1290,7 @@ parse_params (cpp_reader *pfile, cpp_macro *macro)
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;
}
@ -1308,7 +1308,7 @@ parse_params (cpp_reader *pfile, cpp_macro *macro)
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;
@ -1322,11 +1322,11 @@ parse_params (cpp_reader *pfile, cpp_macro *macro)
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. */
@ -1336,7 +1336,7 @@ parse_params (cpp_reader *pfile, cpp_macro *macro)
/* 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;
}
}
@ -1398,7 +1398,7 @@ create_iso_definition (cpp_reader *pfile, cpp_macro *macro)
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)
@ -1426,7 +1426,7 @@ create_iso_definition (cpp_reader *pfile, cpp_macro *macro)
/* 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;
}
@ -1445,7 +1445,7 @@ create_iso_definition (cpp_reader *pfile, cpp_macro *macro)
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;
}
@ -1529,11 +1529,11 @@ _cpp_create_definition (cpp_reader *pfile, cpp_hashnode *node)
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");
}
@ -1584,7 +1584,7 @@ check_trad_stringification (cpp_reader *pfile, const cpp_macro *macro,
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;
@ -1607,7 +1607,7 @@ cpp_macro_definition (cpp_reader *pfile, const cpp_hashnode *node)
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;
}

View File

@ -80,7 +80,8 @@ write_macdef (cpp_reader *pfile, cpp_hashnode *hn, void *file_p)
if (fwrite (&s, sizeof (s), 1, f) != 1
|| fwrite (defn, 1, s.definition_length, f) != s.definition_length)
{
cpp_errno (pfile, DL_ERROR, "while writing precompiled header");
cpp_errno (pfile, CPP_DL_ERROR,
"while writing precompiled header");
return 0;
}
}
@ -328,7 +329,7 @@ cpp_write_pch_deps (cpp_reader *r, FILE *f)
if (fwrite (&z, sizeof (z), 1, f) != 1
|| fwrite (ss->definedstrs, ss->hashsize, 1, f) != 1)
{
cpp_errno (r, DL_ERROR, "while writing precompiled header");
cpp_errno (r, CPP_DL_ERROR, "while writing precompiled header");
return -1;
}
free (ss->definedstrs);
@ -352,7 +353,7 @@ cpp_write_pch_state (cpp_reader *r, FILE *f)
memset (&z, 0, sizeof (z));
if (fwrite (&z, sizeof (z), 1, f) != 1)
{
cpp_errno (r, DL_ERROR, "while writing precompiled header");
cpp_errno (r, CPP_DL_ERROR, "while writing precompiled header");
return -1;
}
@ -361,7 +362,7 @@ cpp_write_pch_state (cpp_reader *r, FILE *f)
if (deps_save (r->deps, f) != 0)
{
cpp_errno (r, DL_ERROR, "while writing precompiled header");
cpp_errno (r, CPP_DL_ERROR, "while writing precompiled header");
return -1;
}
@ -458,7 +459,7 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
|| h->flags & NODE_POISONED)
{
if (CPP_OPTION (r, warn_invalid_pch))
cpp_error (r, DL_WARNING_SYSHDR,
cpp_error (r, CPP_DL_WARNING_SYSHDR,
"%s: not used because `%.*s' not defined",
name, m.name_length, namebuf);
goto fail;
@ -470,7 +471,7 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
|| memcmp (namebuf, newdefn, m.definition_length) != 0)
{
if (CPP_OPTION (r, warn_invalid_pch))
cpp_error (r, DL_WARNING_SYSHDR,
cpp_error (r, CPP_DL_WARNING_SYSHDR,
"%s: not used because `%.*s' defined as `%s' not `%.*s'",
name, m.name_length, namebuf, newdefn + m.name_length,
m.definition_length - m.name_length,
@ -511,7 +512,7 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
else
{
if (CPP_OPTION (r, warn_invalid_pch))
cpp_error (r, DL_WARNING_SYSHDR,
cpp_error (r, CPP_DL_WARNING_SYSHDR,
"%s: not used because `%s' is defined",
name, first);
goto fail;
@ -525,7 +526,7 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
return 0;
error:
cpp_errno (r, DL_ERROR, "while reading precompiled header");
cpp_errno (r, CPP_DL_ERROR, "while reading precompiled header");
return -1;
fail:
@ -711,6 +712,6 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f,
return 0;
error:
cpp_errno (r, DL_ERROR, "while reading precompiled header");
cpp_errno (r, CPP_DL_ERROR, "while reading precompiled header");
return -1;
}

View File

@ -158,7 +158,7 @@ copy_comment (cpp_reader *pfile, const uchar *cur, int in_define)
unterminated = _cpp_skip_block_comment (pfile);
if (unterminated)
cpp_error_with_line (pfile, DL_ERROR, from_line, 0,
cpp_error_with_line (pfile, CPP_DL_ERROR, from_line, 0,
"unterminated comment");
/* Comments in directives become spaces so that tokens are properly
@ -667,7 +667,7 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro)
_cpp_release_buff (pfile, fmacro.buff);
if (lex_state == ls_fun_close)
cpp_error_with_line (pfile, DL_ERROR, fmacro.line, 0,
cpp_error_with_line (pfile, CPP_DL_ERROR, fmacro.line, 0,
"unterminated argument list invoking macro \"%s\"",
NODE_NAME (fmacro.node));
return result;
@ -736,7 +736,7 @@ recursive_macro (cpp_reader *pfile, cpp_hashnode *node)
}
if (recursing)
cpp_error (pfile, DL_ERROR,
cpp_error (pfile, CPP_DL_ERROR,
"detected recursion whilst expanding macro \"%s\"",
NODE_NAME (node));

View File

@ -645,7 +645,7 @@ read_scan_file (char *in_fname, int argc, char **argv)
}
if (i < argc)
cpp_error (scan_in, DL_ERROR, "invalid option `%s'", argv[i]);
cpp_error (scan_in, CPP_DL_ERROR, "invalid option `%s'", argv[i]);
if (cpp_errors (scan_in))
exit (FATAL_EXIT_CODE);