Commit 0527bc4e by John David Anglin Committed by John David Anglin

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
parent 2f7b62ef
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> 2003-11-01 Fariborz Jahanian <fjahanian@apple.com>
* config/rs6000/rs6000.c (rs6000_mixed_function_arg): Correct * config/rs6000/rs6000.c (rs6000_mixed_function_arg): Correct
......
...@@ -187,12 +187,12 @@ remove_duplicates (cpp_reader *pfile, struct cpp_dir *head, ...@@ -187,12 +187,12 @@ remove_duplicates (cpp_reader *pfile, struct cpp_dir *head,
{ {
/* Dirs that don't exist are silently ignored, unless verbose. */ /* Dirs that don't exist are silently ignored, unless verbose. */
if (errno != ENOENT) if (errno != ENOENT)
cpp_errno (pfile, DL_ERROR, cur->name); cpp_errno (pfile, CPP_DL_ERROR, cur->name);
else else
reason = REASON_NOENT; reason = REASON_NOENT;
} }
else if (!S_ISDIR (st.st_mode)) 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); "%s: not a directory", cur->name);
else else
{ {
......
...@@ -225,15 +225,15 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd) ...@@ -225,15 +225,15 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd)
if (memcmp (ident, pch_ident, 5) == 0) if (memcmp (ident, pch_ident, 5) == 0)
/* It's a PCH, for the right language, but has the wrong version. /* 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); "%s: not compatible with this GCC version", name);
else if (memcmp (ident, pch_ident, 4) == 0) else if (memcmp (ident, pch_ident, 4) == 0)
/* It's a PCH for the wrong language. */ /* 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); lang_hooks.name);
else else
/* Not any kind of PCH. */ /* 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; return 2;
} }
...@@ -251,7 +251,7 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd) ...@@ -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) || memcmp (host_machine, short_strings, strlen (host_machine)) != 0)
{ {
if (cpp_get_options (pfile)->warn_invalid_pch) 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, "%s: created on host `%.*s', but used on host `%s'", name,
v.host_machine_length, short_strings, host_machine); v.host_machine_length, short_strings, host_machine);
return 2; return 2;
...@@ -261,7 +261,7 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd) ...@@ -261,7 +261,7 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd)
strlen (target_machine)) != 0) strlen (target_machine)) != 0)
{ {
if (cpp_get_options (pfile)->warn_invalid_pch) 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'", "%s: created for target `%.*s', but used for target `%s'",
name, v.target_machine_length, name, v.target_machine_length,
short_strings + v.host_machine_length, target_machine); short_strings + v.host_machine_length, target_machine);
...@@ -274,7 +274,7 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd) ...@@ -274,7 +274,7 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd)
v.version_length) != 0) v.version_length) != 0)
{ {
if (cpp_get_options (pfile)->warn_invalid_pch) 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'", "%s: created by version `%.*s', but this is version `%s'",
name, v.version_length, name, v.version_length,
(short_strings + v.host_machine_length (short_strings + v.host_machine_length
...@@ -290,7 +290,7 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd) ...@@ -290,7 +290,7 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd)
&& write_symbols != NO_DEBUG) && write_symbols != NO_DEBUG)
{ {
if (cpp_get_options (pfile)->warn_invalid_pch) 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, "%s: created with -g%s, but used with -g%s", name,
debug_type_names[v.debug_info_type], debug_type_names[v.debug_info_type],
debug_type_names[write_symbols]); debug_type_names[write_symbols]);
...@@ -304,7 +304,7 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd) ...@@ -304,7 +304,7 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd)
if (v.pch_init != &pch_init) if (v.pch_init != &pch_init)
{ {
if (cpp_get_options (pfile)->warn_invalid_pch) 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); "%s: had text segment at different address", name);
return 2; return 2;
} }
...@@ -322,7 +322,7 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd) ...@@ -322,7 +322,7 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd)
if (msg != NULL) if (msg != NULL)
{ {
if (cpp_get_options (pfile)->warn_invalid_pch) 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; return 2;
} }
} }
...@@ -353,7 +353,7 @@ c_common_read_pch (cpp_reader *pfile, const char *name, ...@@ -353,7 +353,7 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
f = fdopen (fd, "rb"); f = fdopen (fd, "rb");
if (f == NULL) if (f == NULL)
{ {
cpp_errno (pfile, DL_ERROR, "calling fdopen"); cpp_errno (pfile, CPP_DL_ERROR, "calling fdopen");
return; return;
} }
...@@ -361,7 +361,7 @@ c_common_read_pch (cpp_reader *pfile, const char *name, ...@@ -361,7 +361,7 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
if (fread (&h, sizeof (h), 1, f) != 1) if (fread (&h, sizeof (h), 1, f) != 1)
{ {
cpp_errno (pfile, DL_ERROR, "reading"); cpp_errno (pfile, CPP_DL_ERROR, "reading");
return; return;
} }
...@@ -373,7 +373,7 @@ c_common_read_pch (cpp_reader *pfile, const char *name, ...@@ -373,7 +373,7 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
size = 16384; size = 16384;
if (fread (buf, size, 1, f) != 1 if (fread (buf, size, 1, f) != 1
|| fwrite (buf, size, 1, asm_out_file) != 1) || fwrite (buf, size, 1, asm_out_file) != 1)
cpp_errno (pfile, DL_ERROR, "reading"); cpp_errno (pfile, CPP_DL_ERROR, "reading");
written += size; written += size;
} }
free (buf); free (buf);
......
...@@ -649,18 +649,18 @@ init_iconv_desc (cpp_reader *pfile, const char *to, const char *from) ...@@ -649,18 +649,18 @@ init_iconv_desc (cpp_reader *pfile, const char *to, const char *from)
if (ret.cd == (iconv_t) -1) if (ret.cd == (iconv_t) -1)
{ {
if (errno == EINVAL) 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", "conversion from %s to %s not supported by iconv",
from, to); from, to);
else else
cpp_errno (pfile, DL_ERROR, "iconv_open"); cpp_errno (pfile, CPP_DL_ERROR, "iconv_open");
ret.func = convert_no_conversion; ret.func = convert_no_conversion;
} }
} }
else 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", "no iconv implementation, cannot convert from %s to %s",
from, to); from, to);
ret.func = convert_no_conversion; ret.func = convert_no_conversion;
...@@ -804,10 +804,10 @@ _cpp_valid_ucn (cpp_reader *pfile, const uchar **pstr, ...@@ -804,10 +804,10 @@ _cpp_valid_ucn (cpp_reader *pfile, const uchar **pstr,
const uchar *base = str - 2; const uchar *base = str - 2;
if (!CPP_OPTION (pfile, cplusplus) && !CPP_OPTION (pfile, c99)) 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"); "universal character names are only valid in C++ and C99");
else if (CPP_WTRADITIONAL (pfile) && identifier_pos == 0) 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", "the meaning of '\\%c' is different in traditional C",
(int) str[-1]); (int) str[-1]);
...@@ -833,7 +833,8 @@ _cpp_valid_ucn (cpp_reader *pfile, const uchar **pstr, ...@@ -833,7 +833,8 @@ _cpp_valid_ucn (cpp_reader *pfile, const uchar **pstr,
if (length) if (length)
{ {
/* We'll error when we try it out as the start of an identifier. */ /* 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); (int) (str - base), base);
result = 1; result = 1;
} }
...@@ -844,7 +845,8 @@ _cpp_valid_ucn (cpp_reader *pfile, const uchar **pstr, ...@@ -844,7 +845,8 @@ _cpp_valid_ucn (cpp_reader *pfile, const uchar **pstr,
|| (result & 0x80000000) || (result & 0x80000000)
|| (result >= 0xD800 && result <= 0xDFFF)) || (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); (int) (str - base), base);
result = 1; result = 1;
} }
...@@ -853,11 +855,11 @@ _cpp_valid_ucn (cpp_reader *pfile, const uchar **pstr, ...@@ -853,11 +855,11 @@ _cpp_valid_ucn (cpp_reader *pfile, const uchar **pstr,
int validity = ucn_valid_in_identifier (pfile, result); int validity = ucn_valid_in_identifier (pfile, result);
if (validity == 0) if (validity == 0)
cpp_error (pfile, DL_ERROR, cpp_error (pfile, CPP_DL_ERROR,
"universal character %.*s is not valid in an identifier", "universal character %.*s is not valid in an identifier",
(int) (str - base), base); (int) (str - base), base);
else if (validity == 2 && identifier_pos == 1) 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", "universal character %.*s is not valid at the start of an identifier",
(int) (str - base), base); (int) (str - base), base);
} }
...@@ -892,10 +894,12 @@ convert_ucn (cpp_reader *pfile, const uchar *from, const uchar *limit, ...@@ -892,10 +894,12 @@ convert_ucn (cpp_reader *pfile, const uchar *from, const uchar *limit,
if (rval) if (rval)
{ {
errno = 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)) 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; return from;
} }
...@@ -959,7 +963,7 @@ convert_hex (cpp_reader *pfile, const uchar *from, const uchar *limit, ...@@ -959,7 +963,7 @@ convert_hex (cpp_reader *pfile, const uchar *from, const uchar *limit,
size_t mask = width_to_mask (width); size_t mask = width_to_mask (width);
if (CPP_WTRADITIONAL (pfile)) if (CPP_WTRADITIONAL (pfile))
cpp_error (pfile, DL_WARNING, cpp_error (pfile, CPP_DL_WARNING,
"the meaning of '\\x' is different in traditional C"); "the meaning of '\\x' is different in traditional C");
from++; /* skip 'x' */ from++; /* skip 'x' */
...@@ -976,14 +980,14 @@ convert_hex (cpp_reader *pfile, const uchar *from, const uchar *limit, ...@@ -976,14 +980,14 @@ convert_hex (cpp_reader *pfile, const uchar *from, const uchar *limit,
if (!digits_found) if (!digits_found)
{ {
cpp_error (pfile, DL_ERROR, cpp_error (pfile, CPP_DL_ERROR,
"\\x used with no following hex digits"); "\\x used with no following hex digits");
return from; return from;
} }
if (overflow | (n != (n & mask))) if (overflow | (n != (n & mask)))
{ {
cpp_error (pfile, DL_PEDWARN, cpp_error (pfile, CPP_DL_PEDWARN,
"hex escape sequence out of range"); "hex escape sequence out of range");
n &= mask; n &= mask;
} }
...@@ -1022,7 +1026,7 @@ convert_oct (cpp_reader *pfile, const uchar *from, const uchar *limit, ...@@ -1022,7 +1026,7 @@ convert_oct (cpp_reader *pfile, const uchar *from, const uchar *limit,
if (n != (n & mask)) if (n != (n & mask))
{ {
cpp_error (pfile, DL_PEDWARN, cpp_error (pfile, CPP_DL_PEDWARN,
"octal escape sequence out of range"); "octal escape sequence out of range");
n &= mask; n &= mask;
} }
...@@ -1090,14 +1094,14 @@ convert_escape (cpp_reader *pfile, const uchar *from, const uchar *limit, ...@@ -1090,14 +1094,14 @@ convert_escape (cpp_reader *pfile, const uchar *from, const uchar *limit,
case 'a': case 'a':
if (CPP_WTRADITIONAL (pfile)) if (CPP_WTRADITIONAL (pfile))
cpp_error (pfile, DL_WARNING, cpp_error (pfile, CPP_DL_WARNING,
"the meaning of '\\a' is different in traditional C"); "the meaning of '\\a' is different in traditional C");
c = charconsts[0]; c = charconsts[0];
break; break;
case 'e': case 'E': case 'e': case 'E':
if (CPP_PEDANTIC (pfile)) if (CPP_PEDANTIC (pfile))
cpp_error (pfile, DL_PEDWARN, cpp_error (pfile, CPP_DL_PEDWARN,
"non-ISO-standard escape sequence, '\\%c'", (int) c); "non-ISO-standard escape sequence, '\\%c'", (int) c);
c = charconsts[2]; c = charconsts[2];
break; break;
...@@ -1105,16 +1109,16 @@ convert_escape (cpp_reader *pfile, const uchar *from, const uchar *limit, ...@@ -1105,16 +1109,16 @@ convert_escape (cpp_reader *pfile, const uchar *from, const uchar *limit,
default: default:
unknown: unknown:
if (ISGRAPH (c)) if (ISGRAPH (c))
cpp_error (pfile, DL_PEDWARN, cpp_error (pfile, CPP_DL_PEDWARN,
"unknown escape sequence '\\%c'", (int) c); "unknown escape sequence '\\%c'", (int) c);
else else
cpp_error (pfile, DL_PEDWARN, cpp_error (pfile, CPP_DL_PEDWARN,
"unknown escape sequence: '\\%03o'", (int) c); "unknown escape sequence: '\\%03o'", (int) c);
} }
/* Now convert what we have to the execution character set. */ /* Now convert what we have to the execution character set. */
if (!APPLY_CONVERSION (cvt, &c, 1, tbuf)) 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"); "converting escape sequence to execution character set");
return from + 1; return from + 1;
...@@ -1174,7 +1178,7 @@ cpp_interpret_string (cpp_reader *pfile, const cpp_string *from, size_t count, ...@@ -1174,7 +1178,7 @@ cpp_interpret_string (cpp_reader *pfile, const cpp_string *from, size_t count,
return true; return true;
fail: 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); free (tbuf.text);
return false; return false;
} }
...@@ -1236,10 +1240,11 @@ narrow_str_to_charconst (cpp_reader *pfile, cpp_string str, ...@@ -1236,10 +1240,11 @@ narrow_str_to_charconst (cpp_reader *pfile, cpp_string str,
if (i > max_chars) if (i > max_chars)
{ {
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)) 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. */ /* Multichar constants are of type int and therefore signed. */
if (i > 1) if (i > 1)
...@@ -1298,7 +1303,8 @@ wide_str_to_charconst (cpp_reader *pfile, cpp_string str, ...@@ -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 exactly fills a wchar_t, so a multi-character wide
character constant is guaranteed to overflow. */ character constant is guaranteed to overflow. */
if (off > 0) 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 /* Truncate the constant to its natural width, and simultaneously
sign- or zero-extend to the full width of cppchar_t. */ 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, ...@@ -1330,7 +1336,7 @@ cpp_interpret_charconst (cpp_reader *pfile, const cpp_token *token,
/* an empty constant will appear as L'' or '' */ /* an empty constant will appear as L'' or '' */
if (token->val.str.len == (size_t) (2 + wide)) 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; return 0;
} }
else if (!cpp_interpret_string (pfile, &token->val.str, 1, &str, wide)) else if (!cpp_interpret_string (pfile, &token->val.str, 1, &str, wide))
......
...@@ -72,43 +72,43 @@ int ...@@ -72,43 +72,43 @@ int
_cpp_begin_message (cpp_reader *pfile, int code, fileline line, _cpp_begin_message (cpp_reader *pfile, int code, fileline line,
unsigned int column) unsigned int column)
{ {
int level = DL_EXTRACT (code); int level = CPP_DL_EXTRACT (code);
switch (level) switch (level)
{ {
case DL_WARNING: case CPP_DL_WARNING:
case DL_PEDWARN: case CPP_DL_PEDWARN:
if (CPP_IN_SYSTEM_HEADER (pfile) if (CPP_IN_SYSTEM_HEADER (pfile)
&& ! CPP_OPTION (pfile, warn_system_headers)) && ! CPP_OPTION (pfile, warn_system_headers))
return 0; return 0;
/* Fall through. */ /* Fall through. */
case DL_WARNING_SYSHDR: case CPP_DL_WARNING_SYSHDR:
if (CPP_OPTION (pfile, warnings_are_errors) 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)) if (CPP_OPTION (pfile, inhibit_errors))
return 0; return 0;
level = DL_ERROR; level = CPP_DL_ERROR;
pfile->errors++; pfile->errors++;
} }
else if (CPP_OPTION (pfile, inhibit_warnings)) else if (CPP_OPTION (pfile, inhibit_warnings))
return 0; return 0;
break; break;
case DL_ERROR: case CPP_DL_ERROR:
if (CPP_OPTION (pfile, inhibit_errors)) if (CPP_OPTION (pfile, inhibit_errors))
return 0; return 0;
/* ICEs cannot be inhibited. */ /* ICEs cannot be inhibited. */
case DL_ICE: case CPP_DL_ICE:
pfile->errors++; pfile->errors++;
break; break;
} }
print_location (pfile, line, column); print_location (pfile, line, column);
if (DL_WARNING_P (level)) if (CPP_DL_WARNING_P (level))
fputs (_("warning: "), stderr); fputs (_("warning: "), stderr);
else if (level == DL_ICE) else if (level == CPP_DL_ICE)
fputs (_("internal error: "), stderr); fputs (_("internal error: "), stderr);
return 1; return 1;
......
...@@ -71,9 +71,10 @@ static void check_promotion (cpp_reader *, const struct op *); ...@@ -71,9 +71,10 @@ static void check_promotion (cpp_reader *, const struct op *);
/* With -O2, gcc appears to produce nice code, moving the error /* With -O2, gcc appears to produce nice code, moving the error
message load and subsequent jump completely out of the main path. */ message load and subsequent jump completely out of the main path. */
#define SYNTAX_ERROR(msgid) \ #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) \ #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 /* Subroutine of cpp_classify_number. S points to a float suffix of
length LEN, possibly zero. Returns 0 for an invalid suffix, or a 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) ...@@ -213,7 +214,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token)
if (float_flag != NOT_FLOAT) if (float_flag != NOT_FLOAT)
{ {
if (radix == 16 && CPP_PEDANTIC (pfile) && !CPP_OPTION (pfile, c99)) 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"); "use of C99 hexadecimal floating constant");
if (float_flag == AFTER_EXPON) if (float_flag == AFTER_EXPON)
...@@ -235,7 +236,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token) ...@@ -235,7 +236,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token)
result = interpret_float_suffix (str, limit - str); result = interpret_float_suffix (str, limit - str);
if (result == 0) if (result == 0)
{ {
cpp_error (pfile, DL_ERROR, cpp_error (pfile, CPP_DL_ERROR,
"invalid suffix \"%.*s\" on floating constant", "invalid suffix \"%.*s\" on floating constant",
(int) (limit - str), str); (int) (limit - str), str);
return CPP_N_INVALID; return CPP_N_INVALID;
...@@ -245,7 +246,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token) ...@@ -245,7 +246,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token)
if (limit != str if (limit != str
&& CPP_WTRADITIONAL (pfile) && CPP_WTRADITIONAL (pfile)
&& ! cpp_sys_macro_p (pfile)) && ! cpp_sys_macro_p (pfile))
cpp_error (pfile, DL_WARNING, cpp_error (pfile, CPP_DL_WARNING,
"traditional C rejects the \"%.*s\" suffix", "traditional C rejects the \"%.*s\" suffix",
(int) (limit - str), str); (int) (limit - str), str);
...@@ -256,7 +257,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token) ...@@ -256,7 +257,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token)
result = interpret_int_suffix (str, limit - str); result = interpret_int_suffix (str, limit - str);
if (result == 0) if (result == 0)
{ {
cpp_error (pfile, DL_ERROR, cpp_error (pfile, CPP_DL_ERROR,
"invalid suffix \"%.*s\" on integer constant", "invalid suffix \"%.*s\" on integer constant",
(int) (limit - str), str); (int) (limit - str), str);
return CPP_N_INVALID; return CPP_N_INVALID;
...@@ -270,7 +271,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token) ...@@ -270,7 +271,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token)
int large = (result & CPP_N_WIDTH) == CPP_N_LARGE; int large = (result & CPP_N_WIDTH) == CPP_N_LARGE;
if (u_or_i || (large && CPP_OPTION (pfile, warn_long_long))) 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", "traditional C rejects the \"%.*s\" suffix",
(int) (limit - str), str); (int) (limit - str), str);
} }
...@@ -278,13 +279,15 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token) ...@@ -278,13 +279,15 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token)
if ((result & CPP_N_WIDTH) == CPP_N_LARGE if ((result & CPP_N_WIDTH) == CPP_N_LARGE
&& ! CPP_OPTION (pfile, c99) && ! CPP_OPTION (pfile, c99)
&& CPP_OPTION (pfile, warn_long_long)) && 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; result |= CPP_N_INTEGER;
} }
if ((result & CPP_N_IMAGINARY) && CPP_PEDANTIC (pfile)) 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) if (radix == 10)
result |= CPP_N_DECIMAL; result |= CPP_N_DECIMAL;
...@@ -369,7 +372,7 @@ cpp_interpret_integer (cpp_reader *pfile, const cpp_token *token, ...@@ -369,7 +372,7 @@ cpp_interpret_integer (cpp_reader *pfile, const cpp_token *token,
} }
if (overflow) if (overflow)
cpp_error (pfile, DL_PEDWARN, cpp_error (pfile, CPP_DL_PEDWARN,
"integer constant is too large for its type"); "integer constant is too large for its type");
/* If too big to be signed, consider it unsigned. Only warn for /* If too big to be signed, consider it unsigned. Only warn for
decimal numbers. Traditional numbers were always signed (but decimal numbers. Traditional numbers were always signed (but
...@@ -381,7 +384,7 @@ cpp_interpret_integer (cpp_reader *pfile, const cpp_token *token, ...@@ -381,7 +384,7 @@ cpp_interpret_integer (cpp_reader *pfile, const cpp_token *token,
&& !num_positive (result, precision)) && !num_positive (result, precision))
{ {
if (base == 10) if (base == 10)
cpp_error (pfile, DL_WARNING, cpp_error (pfile, CPP_DL_WARNING,
"integer constant is so large that it is unsigned"); "integer constant is so large that it is unsigned");
result.unsignedp = true; result.unsignedp = true;
} }
...@@ -464,13 +467,13 @@ parse_defined (cpp_reader *pfile) ...@@ -464,13 +467,13 @@ parse_defined (cpp_reader *pfile)
node = token->val.node; node = token->val.node;
if (paren && cpp_get_token (pfile)->type != CPP_CLOSE_PAREN) 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; node = 0;
} }
} }
else else
{ {
cpp_error (pfile, DL_ERROR, cpp_error (pfile, CPP_DL_ERROR,
"operator \"defined\" requires an identifier"); "operator \"defined\" requires an identifier");
if (token->flags & NAMED_OP) if (token->flags & NAMED_OP)
{ {
...@@ -478,7 +481,7 @@ parse_defined (cpp_reader *pfile) ...@@ -478,7 +481,7 @@ parse_defined (cpp_reader *pfile)
op.flags = 0; op.flags = 0;
op.type = token->type; op.type = token->type;
cpp_error (pfile, DL_ERROR, cpp_error (pfile, CPP_DL_ERROR,
"(\"%s\" is an alternative token for \"%s\" in C++)", "(\"%s\" is an alternative token for \"%s\" in C++)",
cpp_token_as_text (pfile, token), cpp_token_as_text (pfile, token),
cpp_token_as_text (pfile, &op)); cpp_token_as_text (pfile, &op));
...@@ -488,7 +491,7 @@ parse_defined (cpp_reader *pfile) ...@@ -488,7 +491,7 @@ parse_defined (cpp_reader *pfile)
if (node) if (node)
{ {
if (pfile->context != initial_context && CPP_PEDANTIC (pfile)) 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"); "this use of \"defined\" may not be portable");
_cpp_mark_macro_used (node); _cpp_mark_macro_used (node);
...@@ -524,13 +527,13 @@ eval_token (cpp_reader *pfile, const cpp_token *token) ...@@ -524,13 +527,13 @@ eval_token (cpp_reader *pfile, const cpp_token *token)
switch (temp & CPP_N_CATEGORY) switch (temp & CPP_N_CATEGORY)
{ {
case CPP_N_FLOATING: case CPP_N_FLOATING:
cpp_error (pfile, DL_ERROR, cpp_error (pfile, CPP_DL_ERROR,
"floating constant in preprocessor expression"); "floating constant in preprocessor expression");
break; break;
case CPP_N_INTEGER: case CPP_N_INTEGER:
if (!(temp & CPP_N_IMAGINARY)) if (!(temp & CPP_N_IMAGINARY))
return cpp_interpret_integer (pfile, token, temp); return cpp_interpret_integer (pfile, token, temp);
cpp_error (pfile, DL_ERROR, cpp_error (pfile, CPP_DL_ERROR,
"imaginary number in preprocessor expression"); "imaginary number in preprocessor expression");
break; break;
...@@ -576,7 +579,7 @@ eval_token (cpp_reader *pfile, const cpp_token *token) ...@@ -576,7 +579,7 @@ eval_token (cpp_reader *pfile, const cpp_token *token)
result.high = 0; result.high = 0;
result.low = 0; result.low = 0;
if (CPP_OPTION (pfile, warn_undef) && !pfile->state.skip_eval) 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)); NODE_NAME (token->val.node));
} }
break; break;
...@@ -805,7 +808,7 @@ _cpp_parse_expr (cpp_reader *pfile) ...@@ -805,7 +808,7 @@ _cpp_parse_expr (cpp_reader *pfile)
if (top != pfile->op_stack) 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: syntax_error:
return false; /* Return false on syntax error. */ return false; /* Return false on syntax error. */
} }
...@@ -824,7 +827,7 @@ reduce (cpp_reader *pfile, struct op *top, enum cpp_ttype op) ...@@ -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) if (top->op <= CPP_EQ || top->op > CPP_LAST_CPP_OP + 2)
{ {
bad_op: 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; return 0;
} }
...@@ -916,7 +919,7 @@ reduce (cpp_reader *pfile, struct op *top, enum cpp_ttype op) ...@@ -916,7 +919,7 @@ reduce (cpp_reader *pfile, struct op *top, enum cpp_ttype op)
case CPP_OPEN_PAREN: case CPP_OPEN_PAREN:
if (op != CPP_CLOSE_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; return 0;
} }
top--; top--;
...@@ -937,7 +940,7 @@ reduce (cpp_reader *pfile, struct op *top, enum cpp_ttype op) ...@@ -937,7 +940,7 @@ reduce (cpp_reader *pfile, struct op *top, enum cpp_ttype op)
continue; continue;
case CPP_QUERY: case CPP_QUERY:
cpp_error (pfile, DL_ERROR, "'?' without following ':'"); cpp_error (pfile, CPP_DL_ERROR, "'?' without following ':'");
return 0; return 0;
default: default:
...@@ -946,13 +949,13 @@ reduce (cpp_reader *pfile, struct op *top, enum cpp_ttype op) ...@@ -946,13 +949,13 @@ reduce (cpp_reader *pfile, struct op *top, enum cpp_ttype op)
top--; top--;
if (top->value.overflow && !pfile->state.skip_eval) if (top->value.overflow && !pfile->state.skip_eval)
cpp_error (pfile, DL_PEDWARN, cpp_error (pfile, CPP_DL_PEDWARN,
"integer overflow in preprocessor expression"); "integer overflow in preprocessor expression");
} }
if (op == CPP_CLOSE_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; return 0;
} }
...@@ -983,12 +986,12 @@ check_promotion (cpp_reader *pfile, const struct op *op) ...@@ -983,12 +986,12 @@ check_promotion (cpp_reader *pfile, const struct op *op)
if (op->value.unsignedp) if (op->value.unsignedp)
{ {
if (!num_positive (op[-1].value, CPP_OPTION (pfile, precision))) 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", "the left operand of \"%s\" changes sign when promoted",
cpp_token_as_text (pfile, op->token)); cpp_token_as_text (pfile, op->token));
} }
else if (!num_positive (op->value, CPP_OPTION (pfile, precision))) 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", "the right operand of \"%s\" changes sign when promoted",
cpp_token_as_text (pfile, op->token)); cpp_token_as_text (pfile, op->token));
} }
...@@ -1246,7 +1249,7 @@ num_unary_op (cpp_reader *pfile, cpp_num num, enum cpp_ttype op) ...@@ -1246,7 +1249,7 @@ num_unary_op (cpp_reader *pfile, cpp_num num, enum cpp_ttype op)
{ {
case CPP_UPLUS: case CPP_UPLUS:
if (CPP_WTRADITIONAL (pfile) && !pfile->state.skip_eval) 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"); "traditional C rejects the unary plus operator");
num.overflow = false; num.overflow = false;
break; break;
...@@ -1345,7 +1348,7 @@ num_binary_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op) ...@@ -1345,7 +1348,7 @@ num_binary_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op)
/* Comma. */ /* Comma. */
default: /* case CPP_COMMA: */ default: /* case CPP_COMMA: */
if (CPP_PEDANTIC (pfile) && !pfile->state.skip_eval) 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"); "comma operator in operand of #if");
lhs = rhs; lhs = rhs;
break; break;
...@@ -1477,7 +1480,7 @@ num_div_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op) ...@@ -1477,7 +1480,7 @@ num_div_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op)
else else
{ {
if (!pfile->state.skip_eval) 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; return lhs;
} }
......
...@@ -354,7 +354,7 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir, bool f ...@@ -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. */ /* Ensure we get no confusion between cached files and directories. */
if (start_dir == NULL) 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 **) hash_slot = (struct file_hash_entry **)
htab_find_slot (pfile->file_hash, fname, INSERT); htab_find_slot (pfile->file_hash, fname, INSERT);
...@@ -432,7 +432,7 @@ read_file_guts (cpp_reader *pfile, _cpp_file *file) ...@@ -432,7 +432,7 @@ read_file_guts (cpp_reader *pfile, _cpp_file *file)
if (S_ISBLK (file->st.st_mode)) 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; return false;
} }
...@@ -449,7 +449,7 @@ read_file_guts (cpp_reader *pfile, _cpp_file *file) ...@@ -449,7 +449,7 @@ read_file_guts (cpp_reader *pfile, _cpp_file *file)
does not bite us. */ does not bite us. */
if (file->st.st_size > INTTYPE_MAXIMUM (ssize_t)) 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; return false;
} }
...@@ -478,12 +478,13 @@ read_file_guts (cpp_reader *pfile, _cpp_file *file) ...@@ -478,12 +478,13 @@ read_file_guts (cpp_reader *pfile, _cpp_file *file)
if (count < 0) if (count < 0)
{ {
cpp_errno (pfile, DL_ERROR, file->path); cpp_errno (pfile, CPP_DL_ERROR, file->path);
return false; return false;
} }
if (regular && total != size && STAT_SIZE_RELIABLE (file->st)) 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. */ /* Shrink buffer if we allocated substantially too much. */
if (total + 4096 < size) if (total + 4096 < size)
...@@ -675,7 +676,7 @@ search_path_head (cpp_reader *pfile, const char *fname, int angle_brackets, ...@@ -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); return make_cpp_dir (pfile, dir_name_of_file (file), pfile->map->sysp);
if (dir == NULL) if (dir == NULL)
cpp_error (pfile, DL_ERROR, cpp_error (pfile, CPP_DL_ERROR,
"no include path in which to search for %s", fname); "no include path in which to search for %s", fname);
return dir; return dir;
...@@ -732,9 +733,9 @@ open_file_failed (cpp_reader *pfile, _cpp_file *file) ...@@ -732,9 +733,9 @@ open_file_failed (cpp_reader *pfile, _cpp_file *file)
/* If we are outputting dependencies but not for this file then /* If we are outputting dependencies but not for this file then
don't error because we can still produce correct output. */ don't error because we can still produce correct output. */
if (CPP_OPTION (pfile, deps.style) && ! print_dep) if (CPP_OPTION (pfile, deps.style) && ! print_dep)
cpp_errno (pfile, DL_WARNING, file->path); cpp_errno (pfile, CPP_DL_WARNING, file->path);
else else
cpp_errno (pfile, DL_ERROR, file->path); cpp_errno (pfile, CPP_DL_ERROR, file->path);
} }
} }
......
...@@ -383,36 +383,37 @@ static void sanity_checks (cpp_reader *pfile) ...@@ -383,36 +383,37 @@ static void sanity_checks (cpp_reader *pfile)
type precisions made by cpplib. */ type precisions made by cpplib. */
test--; test--;
if (test < 1) 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) 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;" "preprocessor arithmetic has maximum precision of %lu bits;"
" target requires %lu bits", " target requires %lu bits",
(unsigned long) max_precision, (unsigned long) max_precision,
(unsigned long) CPP_OPTION (pfile, precision)); (unsigned long) CPP_OPTION (pfile, precision));
if (CPP_OPTION (pfile, precision) < CPP_OPTION (pfile, int_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"); "CPP arithmetic must be at least as precise as a target int");
if (CPP_OPTION (pfile, char_precision) < 8) 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)) 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"); "target wchar_t is narrower than target char");
if (CPP_OPTION (pfile, int_precision) < CPP_OPTION (pfile, char_precision)) 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"); "target int is narrower than target char");
/* This is assumed in eval_token() and could be fixed if necessary. */ /* This is assumed in eval_token() and could be fixed if necessary. */
if (sizeof (cppchar_t) > sizeof (cpp_num_part)) 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) 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" "CPP on this host cannot handle wide character constants over"
" %lu bits, but the target requires %lu bits", " %lu bits, but the target requires %lu bits",
(unsigned long) BITS_PER_CPPCHAR_T, (unsigned long) BITS_PER_CPPCHAR_T,
......
...@@ -270,12 +270,12 @@ _cpp_process_line_notes (cpp_reader *pfile, int in_comment) ...@@ -270,12 +270,12 @@ _cpp_process_line_notes (cpp_reader *pfile, int in_comment)
if (note->type == '\\' || note->type == ' ') if (note->type == '\\' || note->type == ' ')
{ {
if (note->type == ' ' && !in_comment) 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"); "backslash and newline separated by space");
if (buffer->next_line > buffer->rlimit) 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"); "backslash-newline at end of file");
/* Prevent "no newline at end of file" warning. */ /* Prevent "no newline at end of file" warning. */
buffer->next_line = buffer->rlimit; buffer->next_line = buffer->rlimit;
...@@ -290,14 +290,14 @@ _cpp_process_line_notes (cpp_reader *pfile, int in_comment) ...@@ -290,14 +290,14 @@ _cpp_process_line_notes (cpp_reader *pfile, int in_comment)
&& (!in_comment || warn_in_comment (pfile, note))) && (!in_comment || warn_in_comment (pfile, note)))
{ {
if (CPP_OPTION (pfile, trigraphs)) 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", "trigraph ??%c converted to %c",
note->type, note->type,
(int) _cpp_trigraph_map[note->type]); (int) _cpp_trigraph_map[note->type]);
else else
{ {
cpp_error_with_line cpp_error_with_line
(pfile, DL_WARNING, pfile->line, col, (pfile, CPP_DL_WARNING, pfile->line, col,
"trigraph ??%c ignored, use -trigraphs to enable", "trigraph ??%c ignored, use -trigraphs to enable",
note->type); note->type);
} }
...@@ -342,7 +342,7 @@ _cpp_skip_block_comment (cpp_reader *pfile) ...@@ -342,7 +342,7 @@ _cpp_skip_block_comment (cpp_reader *pfile)
&& cur[0] == '*' && cur[1] != '/') && cur[0] == '*' && cur[1] != '/')
{ {
buffer->cur = cur; buffer->cur = cur;
cpp_error_with_line (pfile, DL_WARNING, cpp_error_with_line (pfile, CPP_DL_WARNING,
pfile->line, CPP_BUF_COL (buffer), pfile->line, CPP_BUF_COL (buffer),
"\"/*\" within comment"); "\"/*\" within comment");
} }
...@@ -396,7 +396,7 @@ skip_whitespace (cpp_reader *pfile, cppchar_t c) ...@@ -396,7 +396,7 @@ skip_whitespace (cpp_reader *pfile, cppchar_t c)
else if (c == '\0') else if (c == '\0')
saw_NUL = true; saw_NUL = true;
else if (pfile->state.in_directive && CPP_PEDANTIC (pfile)) 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), CPP_BUF_COL (buffer),
"%s in preprocessing directive", "%s in preprocessing directive",
c == '\f' ? "form feed" : "vertical tab"); c == '\f' ? "form feed" : "vertical tab");
...@@ -407,7 +407,7 @@ skip_whitespace (cpp_reader *pfile, cppchar_t c) ...@@ -407,7 +407,7 @@ skip_whitespace (cpp_reader *pfile, cppchar_t c)
while (is_nvspace (c)); while (is_nvspace (c));
if (saw_NUL) if (saw_NUL)
cpp_error (pfile, DL_WARNING, "null character(s) ignored"); cpp_error (pfile, CPP_DL_WARNING, "null character(s) ignored");
buffer->cur--; buffer->cur--;
} }
...@@ -442,7 +442,7 @@ forms_identifier_p (cpp_reader *pfile, int first) ...@@ -442,7 +442,7 @@ forms_identifier_p (cpp_reader *pfile, int first)
if (CPP_OPTION (pfile, warn_dollars) && !pfile->state.skipping) if (CPP_OPTION (pfile, warn_dollars) && !pfile->state.skipping)
{ {
CPP_OPTION (pfile, warn_dollars) = 0; 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; return true;
...@@ -489,14 +489,14 @@ lex_identifier (cpp_reader *pfile, const uchar *base) ...@@ -489,14 +489,14 @@ lex_identifier (cpp_reader *pfile, const uchar *base)
{ {
/* It is allowed to poison the same identifier twice. */ /* It is allowed to poison the same identifier twice. */
if ((result->flags & NODE_POISONED) && !pfile->state.poisoned_ok) 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)); NODE_NAME (result));
/* Constraint 6.10.3.5: __VA_ARGS__ should only appear in the /* Constraint 6.10.3.5: __VA_ARGS__ should only appear in the
replacement list of a variadic macro. */ replacement list of a variadic macro. */
if (result == pfile->spec_nodes.n__VA_ARGS__ if (result == pfile->spec_nodes.n__VA_ARGS__
&& !pfile->state.va_args_ok) && !pfile->state.va_args_ok)
cpp_error (pfile, DL_PEDWARN, cpp_error (pfile, CPP_DL_PEDWARN,
"__VA_ARGS__ can only appear in the expansion" "__VA_ARGS__ can only appear in the expansion"
" of a C99 variadic macro"); " of a C99 variadic macro");
} }
...@@ -592,7 +592,8 @@ lex_string (cpp_reader *pfile, cpp_token *token, const uchar *base) ...@@ -592,7 +592,8 @@ lex_string (cpp_reader *pfile, cpp_token *token, const uchar *base)
} }
if (saw_NUL && !pfile->state.skipping) 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; pfile->buffer->cur = cur;
create_literal (pfile, token, base, cur - base, type); create_literal (pfile, token, base, cur - base, type);
...@@ -771,7 +772,7 @@ _cpp_get_fresh_line (cpp_reader *pfile) ...@@ -771,7 +772,7 @@ _cpp_get_fresh_line (cpp_reader *pfile)
{ {
/* Only warn once. */ /* Only warn once. */
buffer->next_line = buffer->rlimit; 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), CPP_BUF_COLUMN (buffer, buffer->cur),
"no newline at end of file"); "no newline at end of file");
} }
...@@ -912,7 +913,7 @@ _cpp_lex_direct (cpp_reader *pfile) ...@@ -912,7 +913,7 @@ _cpp_lex_direct (cpp_reader *pfile)
if (c == '*') if (c == '*')
{ {
if (_cpp_skip_block_comment (pfile)) 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) else if (c == '/' && (CPP_OPTION (pfile, cplusplus_comments)
|| CPP_IN_SYSTEM_HEADER (pfile))) || CPP_IN_SYSTEM_HEADER (pfile)))
...@@ -922,15 +923,15 @@ _cpp_lex_direct (cpp_reader *pfile) ...@@ -922,15 +923,15 @@ _cpp_lex_direct (cpp_reader *pfile)
if (CPP_OPTION (pfile, lang) == CLK_GNUC89 && CPP_PEDANTIC (pfile) if (CPP_OPTION (pfile, lang) == CLK_GNUC89 && CPP_PEDANTIC (pfile)
&& ! buffer->warned_cplusplus_comments) && ! buffer->warned_cplusplus_comments)
{ {
cpp_error (pfile, DL_PEDWARN, cpp_error (pfile, CPP_DL_PEDWARN,
"C++ style comments are not allowed in ISO C90"); "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)"); "(this will be reported only once per input file)");
buffer->warned_cplusplus_comments = 1; buffer->warned_cplusplus_comments = 1;
} }
if (skip_line_comment (pfile) && CPP_OPTION (pfile, warn_comments)) 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 == '=') else if (c == '=')
{ {
...@@ -1193,7 +1194,8 @@ cpp_spell_token (cpp_reader *pfile, const cpp_token *token, ...@@ -1193,7 +1194,8 @@ cpp_spell_token (cpp_reader *pfile, const cpp_token *token,
break; break;
case SPELL_NONE: 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; break;
} }
......
...@@ -655,21 +655,21 @@ cpp_num cpp_num_sign_extend (cpp_num, size_t); ...@@ -655,21 +655,21 @@ cpp_num cpp_num_sign_extend (cpp_num, size_t);
with a line number of zero. */ with a line number of zero. */
/* Warning, an error with -Werror. */ /* Warning, an error with -Werror. */
#define DL_WARNING 0x00 #define CPP_DL_WARNING 0x00
/* Same as DL_WARNING, except it is not suppressed in system headers. */ /* Same as CPP_DL_WARNING, except it is not suppressed in system headers. */
#define DL_WARNING_SYSHDR 0x01 #define CPP_DL_WARNING_SYSHDR 0x01
/* Warning, an error with -pedantic-errors or -Werror. */ /* Warning, an error with -pedantic-errors or -Werror. */
#define DL_PEDWARN 0x02 #define CPP_DL_PEDWARN 0x02
/* An error. */ /* An error. */
#define DL_ERROR 0x03 #define CPP_DL_ERROR 0x03
/* An internal consistency check failed. Prints "internal error: ", /* An internal consistency check failed. Prints "internal error: ",
otherwise the same as DL_ERROR. */ otherwise the same as CPP_DL_ERROR. */
#define DL_ICE 0x04 #define CPP_DL_ICE 0x04
/* Extracts a diagnostic level from an int. */ /* 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. */ /* Nonzero if a diagnostic level is one of the warnings. */
#define DL_WARNING_P(l) (DL_EXTRACT (l) >= DL_WARNING \ #define CPP_DL_WARNING_P(l) (CPP_DL_EXTRACT (l) >= CPP_DL_WARNING \
&& DL_EXTRACT (l) <= DL_PEDWARN) && CPP_DL_EXTRACT (l) <= CPP_DL_PEDWARN)
/* N.B. The error-message-printer prototypes have not been nicely /* N.B. The error-message-printer prototypes have not been nicely
formatted because exgettext needs to see 'msgid' on the same line formatted because exgettext needs to see 'msgid' on the same line
......
...@@ -81,7 +81,7 @@ _cpp_warn_if_unused_macro (cpp_reader *pfile, cpp_hashnode *node, ...@@ -81,7 +81,7 @@ _cpp_warn_if_unused_macro (cpp_reader *pfile, cpp_hashnode *node,
if (!macro->used if (!macro->used
&& MAIN_FILE_P (linemap_lookup (&pfile->line_maps, macro->line))) && 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)); "macro \"%s\" is not used", NODE_NAME (node));
} }
...@@ -122,7 +122,7 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node) ...@@ -122,7 +122,7 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
switch (node->value.builtin) switch (node->value.builtin)
{ {
default: 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)); NODE_NAME (node));
break; break;
...@@ -217,7 +217,7 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node) ...@@ -217,7 +217,7 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
} }
else else
{ {
cpp_errno (pfile, DL_WARNING, cpp_errno (pfile, CPP_DL_WARNING,
"could not determine date and time"); "could not determine date and time");
pfile->date = U"\"??? ?? ????\""; pfile->date = U"\"??? ?? ????\"";
...@@ -277,7 +277,7 @@ builtin_macro (cpp_reader *pfile, cpp_hashnode *node) ...@@ -277,7 +277,7 @@ builtin_macro (cpp_reader *pfile, cpp_hashnode *node)
pfile->cur_token = _cpp_temp_token (pfile); pfile->cur_token = _cpp_temp_token (pfile);
push_token_context (pfile, NULL, _cpp_lex_direct (pfile), 1); push_token_context (pfile, NULL, _cpp_lex_direct (pfile), 1);
if (pfile->buffer->cur != pfile->buffer->rlimit) 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)); NODE_NAME (node));
_cpp_pop_buffer (pfile); _cpp_pop_buffer (pfile);
...@@ -389,7 +389,7 @@ stringify_arg (cpp_reader *pfile, macro_arg *arg) ...@@ -389,7 +389,7 @@ stringify_arg (cpp_reader *pfile, macro_arg *arg)
/* Ignore the final \ of invalid string literals. */ /* Ignore the final \ of invalid string literals. */
if (backslash_count & 1) if (backslash_count & 1)
{ {
cpp_error (pfile, DL_WARNING, cpp_error (pfile, CPP_DL_WARNING,
"invalid string literal, ignoring final '\\'"); "invalid string literal, ignoring final '\\'");
dest--; dest--;
} }
...@@ -472,7 +472,7 @@ paste_all_tokens (cpp_reader *pfile, const cpp_token *lhs) ...@@ -472,7 +472,7 @@ paste_all_tokens (cpp_reader *pfile, const cpp_token *lhs)
/* Mandatory error for all apart from assembler. */ /* Mandatory error for all apart from assembler. */
if (CPP_OPTION (pfile, lang) != CLK_ASM) 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", "pasting \"%s\" and \"%s\" does not give a valid preprocessing token",
cpp_token_as_text (pfile, lhs), cpp_token_as_text (pfile, lhs),
cpp_token_as_text (pfile, rhs)); cpp_token_as_text (pfile, rhs));
...@@ -510,17 +510,17 @@ _cpp_arguments_ok (cpp_reader *pfile, cpp_macro *macro, const cpp_hashnode *node ...@@ -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 (argc + 1 == macro->paramc && macro->variadic)
{ {
if (CPP_PEDANTIC (pfile) && ! macro->syshdr) 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"); "ISO C99 requires rest arguments to be used");
return true; return true;
} }
cpp_error (pfile, DL_ERROR, cpp_error (pfile, CPP_DL_ERROR,
"macro \"%s\" requires %u arguments, but only %u given", "macro \"%s\" requires %u arguments, but only %u given",
NODE_NAME (node), macro->paramc, argc); NODE_NAME (node), macro->paramc, argc);
} }
else else
cpp_error (pfile, DL_ERROR, cpp_error (pfile, CPP_DL_ERROR,
"macro \"%s\" passed %u arguments, but takes just %u", "macro \"%s\" passed %u arguments, but takes just %u",
NODE_NAME (node), argc, macro->paramc); NODE_NAME (node), argc, macro->paramc);
...@@ -631,7 +631,7 @@ collect_args (cpp_reader *pfile, const cpp_hashnode *node) ...@@ -631,7 +631,7 @@ collect_args (cpp_reader *pfile, const cpp_hashnode *node)
callers at the end of an -include-d file. */ callers at the end of an -include-d file. */
if (pfile->context->prev || pfile->state.in_directive) if (pfile->context->prev || pfile->state.in_directive)
_cpp_backup_tokens (pfile, 1); _cpp_backup_tokens (pfile, 1);
cpp_error (pfile, DL_ERROR, cpp_error (pfile, CPP_DL_ERROR,
"unterminated argument list invoking macro \"%s\"", "unterminated argument list invoking macro \"%s\"",
NODE_NAME (node)); NODE_NAME (node));
} }
...@@ -734,7 +734,7 @@ enter_macro_context (cpp_reader *pfile, cpp_hashnode *node) ...@@ -734,7 +734,7 @@ enter_macro_context (cpp_reader *pfile, cpp_hashnode *node)
if (buff == NULL) if (buff == NULL)
{ {
if (CPP_WTRADITIONAL (pfile) && ! node->value.macro->syshdr) 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", "function-like macro \"%s\" must be used with arguments in traditional C",
NODE_NAME (node)); NODE_NAME (node));
...@@ -1238,7 +1238,7 @@ _cpp_save_parameter (cpp_reader *pfile, cpp_macro *macro, cpp_hashnode *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. */ /* Constraint 6.10.3.6 - duplicate parameter names. */
if (node->flags & NODE_MACRO_ARG) 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)); NODE_NAME (node));
return true; return true;
} }
...@@ -1282,7 +1282,7 @@ parse_params (cpp_reader *pfile, cpp_macro *macro) ...@@ -1282,7 +1282,7 @@ parse_params (cpp_reader *pfile, cpp_macro *macro)
&& ! CPP_OPTION (pfile, discard_comments_in_macro_exp)) && ! CPP_OPTION (pfile, discard_comments_in_macro_exp))
continue; continue;
cpp_error (pfile, DL_ERROR, cpp_error (pfile, CPP_DL_ERROR,
"\"%s\" may not appear in macro parameter list", "\"%s\" may not appear in macro parameter list",
cpp_token_as_text (pfile, token)); cpp_token_as_text (pfile, token));
return false; return false;
...@@ -1290,7 +1290,7 @@ parse_params (cpp_reader *pfile, cpp_macro *macro) ...@@ -1290,7 +1290,7 @@ parse_params (cpp_reader *pfile, cpp_macro *macro)
case CPP_NAME: case CPP_NAME:
if (prev_ident) if (prev_ident)
{ {
cpp_error (pfile, DL_ERROR, cpp_error (pfile, CPP_DL_ERROR,
"macro parameters must be comma-separated"); "macro parameters must be comma-separated");
return false; return false;
} }
...@@ -1308,7 +1308,7 @@ parse_params (cpp_reader *pfile, cpp_macro *macro) ...@@ -1308,7 +1308,7 @@ parse_params (cpp_reader *pfile, cpp_macro *macro)
case CPP_COMMA: case CPP_COMMA:
if (!prev_ident) if (!prev_ident)
{ {
cpp_error (pfile, DL_ERROR, "parameter name missing"); cpp_error (pfile, CPP_DL_ERROR, "parameter name missing");
return false; return false;
} }
prev_ident = 0; prev_ident = 0;
...@@ -1322,11 +1322,11 @@ parse_params (cpp_reader *pfile, cpp_macro *macro) ...@@ -1322,11 +1322,11 @@ parse_params (cpp_reader *pfile, cpp_macro *macro)
pfile->spec_nodes.n__VA_ARGS__); pfile->spec_nodes.n__VA_ARGS__);
pfile->state.va_args_ok = 1; pfile->state.va_args_ok = 1;
if (! CPP_OPTION (pfile, c99) && CPP_OPTION (pfile, pedantic)) 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"); "anonymous variadic macros were introduced in C99");
} }
else if (CPP_OPTION (pfile, pedantic)) 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"); "ISO C does not permit named variadic macros");
/* We're at the end, and just expect a closing parenthesis. */ /* We're at the end, and just expect a closing parenthesis. */
...@@ -1336,7 +1336,7 @@ parse_params (cpp_reader *pfile, cpp_macro *macro) ...@@ -1336,7 +1336,7 @@ parse_params (cpp_reader *pfile, cpp_macro *macro)
/* Fall through. */ /* Fall through. */
case CPP_EOF: 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; return false;
} }
} }
...@@ -1398,7 +1398,7 @@ create_iso_definition (cpp_reader *pfile, cpp_macro *macro) ...@@ -1398,7 +1398,7 @@ create_iso_definition (cpp_reader *pfile, cpp_macro *macro)
macro->fun_like = 1; macro->fun_like = 1;
} }
else if (ctoken->type != CPP_EOF && !(ctoken->flags & PREV_WHITE)) 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"); "ISO C requires whitespace after the macro name");
if (macro->fun_like) if (macro->fun_like)
...@@ -1426,7 +1426,7 @@ create_iso_definition (cpp_reader *pfile, cpp_macro *macro) ...@@ -1426,7 +1426,7 @@ create_iso_definition (cpp_reader *pfile, cpp_macro *macro)
/* Let assembler get away with murder. */ /* Let assembler get away with murder. */
else if (CPP_OPTION (pfile, lang) != CLK_ASM) 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"); "'#' is not followed by a macro parameter");
return false; return false;
} }
...@@ -1445,7 +1445,7 @@ create_iso_definition (cpp_reader *pfile, cpp_macro *macro) ...@@ -1445,7 +1445,7 @@ create_iso_definition (cpp_reader *pfile, cpp_macro *macro)
if (macro->count == 0 || token->type == CPP_EOF) 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"); "'##' cannot appear at either end of a macro expansion");
return false; return false;
} }
...@@ -1529,11 +1529,11 @@ _cpp_create_definition (cpp_reader *pfile, cpp_hashnode *node) ...@@ -1529,11 +1529,11 @@ _cpp_create_definition (cpp_reader *pfile, cpp_hashnode *node)
if (warn_of_redefinition (pfile, node, macro)) 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)); "\"%s\" redefined", NODE_NAME (node));
if (node->type == NT_MACRO && !(node->flags & NODE_BUILTIN)) 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, node->value.macro->line, 0,
"this is the location of the previous definition"); "this is the location of the previous definition");
} }
...@@ -1584,7 +1584,7 @@ check_trad_stringification (cpp_reader *pfile, const cpp_macro *macro, ...@@ -1584,7 +1584,7 @@ check_trad_stringification (cpp_reader *pfile, const cpp_macro *macro,
if (NODE_LEN (node) == len if (NODE_LEN (node) == len
&& !memcmp (p, NODE_NAME (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", "macro argument \"%s\" would be stringified in traditional C",
NODE_NAME (node)); NODE_NAME (node));
break; break;
...@@ -1607,7 +1607,7 @@ cpp_macro_definition (cpp_reader *pfile, const cpp_hashnode *node) ...@@ -1607,7 +1607,7 @@ cpp_macro_definition (cpp_reader *pfile, const cpp_hashnode *node)
if (node->type != NT_MACRO || (node->flags & NODE_BUILTIN)) 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); "invalid hash type %d in cpp_macro_definition", node->type);
return 0; return 0;
} }
......
...@@ -80,7 +80,8 @@ write_macdef (cpp_reader *pfile, cpp_hashnode *hn, void *file_p) ...@@ -80,7 +80,8 @@ write_macdef (cpp_reader *pfile, cpp_hashnode *hn, void *file_p)
if (fwrite (&s, sizeof (s), 1, f) != 1 if (fwrite (&s, sizeof (s), 1, f) != 1
|| fwrite (defn, 1, s.definition_length, f) != s.definition_length) || 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; return 0;
} }
} }
...@@ -328,7 +329,7 @@ cpp_write_pch_deps (cpp_reader *r, FILE *f) ...@@ -328,7 +329,7 @@ cpp_write_pch_deps (cpp_reader *r, FILE *f)
if (fwrite (&z, sizeof (z), 1, f) != 1 if (fwrite (&z, sizeof (z), 1, f) != 1
|| fwrite (ss->definedstrs, ss->hashsize, 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; return -1;
} }
free (ss->definedstrs); free (ss->definedstrs);
...@@ -352,7 +353,7 @@ cpp_write_pch_state (cpp_reader *r, FILE *f) ...@@ -352,7 +353,7 @@ cpp_write_pch_state (cpp_reader *r, FILE *f)
memset (&z, 0, sizeof (z)); memset (&z, 0, sizeof (z));
if (fwrite (&z, sizeof (z), 1, f) != 1) 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; return -1;
} }
...@@ -361,7 +362,7 @@ cpp_write_pch_state (cpp_reader *r, FILE *f) ...@@ -361,7 +362,7 @@ cpp_write_pch_state (cpp_reader *r, FILE *f)
if (deps_save (r->deps, f) != 0) 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; return -1;
} }
...@@ -458,7 +459,7 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd) ...@@ -458,7 +459,7 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
|| h->flags & NODE_POISONED) || h->flags & NODE_POISONED)
{ {
if (CPP_OPTION (r, warn_invalid_pch)) 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", "%s: not used because `%.*s' not defined",
name, m.name_length, namebuf); name, m.name_length, namebuf);
goto fail; goto fail;
...@@ -470,7 +471,7 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd) ...@@ -470,7 +471,7 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
|| memcmp (namebuf, newdefn, m.definition_length) != 0) || memcmp (namebuf, newdefn, m.definition_length) != 0)
{ {
if (CPP_OPTION (r, warn_invalid_pch)) 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'", "%s: not used because `%.*s' defined as `%s' not `%.*s'",
name, m.name_length, namebuf, newdefn + m.name_length, name, m.name_length, namebuf, newdefn + m.name_length,
m.definition_length - m.name_length, m.definition_length - m.name_length,
...@@ -511,7 +512,7 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd) ...@@ -511,7 +512,7 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
else else
{ {
if (CPP_OPTION (r, warn_invalid_pch)) 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", "%s: not used because `%s' is defined",
name, first); name, first);
goto fail; goto fail;
...@@ -525,7 +526,7 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd) ...@@ -525,7 +526,7 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
return 0; return 0;
error: error:
cpp_errno (r, DL_ERROR, "while reading precompiled header"); cpp_errno (r, CPP_DL_ERROR, "while reading precompiled header");
return -1; return -1;
fail: fail:
...@@ -711,6 +712,6 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f, ...@@ -711,6 +712,6 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f,
return 0; return 0;
error: error:
cpp_errno (r, DL_ERROR, "while reading precompiled header"); cpp_errno (r, CPP_DL_ERROR, "while reading precompiled header");
return -1; return -1;
} }
...@@ -158,7 +158,7 @@ copy_comment (cpp_reader *pfile, const uchar *cur, int in_define) ...@@ -158,7 +158,7 @@ copy_comment (cpp_reader *pfile, const uchar *cur, int in_define)
unterminated = _cpp_skip_block_comment (pfile); unterminated = _cpp_skip_block_comment (pfile);
if (unterminated) 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"); "unterminated comment");
/* Comments in directives become spaces so that tokens are properly /* 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) ...@@ -667,7 +667,7 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro)
_cpp_release_buff (pfile, fmacro.buff); _cpp_release_buff (pfile, fmacro.buff);
if (lex_state == ls_fun_close) 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\"", "unterminated argument list invoking macro \"%s\"",
NODE_NAME (fmacro.node)); NODE_NAME (fmacro.node));
return result; return result;
...@@ -736,7 +736,7 @@ recursive_macro (cpp_reader *pfile, cpp_hashnode *node) ...@@ -736,7 +736,7 @@ recursive_macro (cpp_reader *pfile, cpp_hashnode *node)
} }
if (recursing) if (recursing)
cpp_error (pfile, DL_ERROR, cpp_error (pfile, CPP_DL_ERROR,
"detected recursion whilst expanding macro \"%s\"", "detected recursion whilst expanding macro \"%s\"",
NODE_NAME (node)); NODE_NAME (node));
......
...@@ -645,7 +645,7 @@ read_scan_file (char *in_fname, int argc, char **argv) ...@@ -645,7 +645,7 @@ read_scan_file (char *in_fname, int argc, char **argv)
} }
if (i < argc) 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)) if (cpp_errors (scan_in))
exit (FATAL_EXIT_CODE); exit (FATAL_EXIT_CODE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment