* cppexp.c (struct op, parse_number): Replace U_CHAR with uchar.
* cppfiles.c (read_include_file): Similarly.
* cpphash.h (DSC, U_CHAR, ustrcmp, ustrncmp, ustrlen,
uxstrdup ustrchr, ufputs): Similarly.
* cppinit.c (TRIGRAPH_MAP, cpp_destroy): Similarly.
* cpplex.c (parse_slow, unescaped_terminator_p, save_comment,
cpp_ideq, parse_identifier, parse_number): Similarly.
* cpplib.c (struct directive, dequote_string, D, run_directive,
cpp_push_buffer): Similarly.
* cppmacro.c (new_string_token, builtin_macro, cpp_quote_string,
_cpp_create_definition, check_trad_stringification,
cpp_macro_definition): Similarly.
From-SVN: r52587
+2002-04-21 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cppexp.c (struct op, parse_number): Replace U_CHAR with uchar.
+ * cppfiles.c (read_include_file): Similarly.
+ * cpphash.h (DSC, U_CHAR, ustrcmp, ustrncmp, ustrlen,
+ uxstrdup ustrchr, ufputs): Similarly.
+ * cppinit.c (TRIGRAPH_MAP, cpp_destroy): Similarly.
+ * cpplex.c (parse_slow, unescaped_terminator_p, save_comment,
+ cpp_ideq, parse_identifier, parse_number): Similarly.
+ * cpplib.c (struct directive, dequote_string, D, run_directive,
+ cpp_push_buffer): Similarly.
+ * cppmacro.c (new_string_token, builtin_macro, cpp_quote_string,
+ _cpp_create_definition, check_trad_stringification,
+ cpp_macro_definition): Similarly.
+
2002-04-21 Neil Booth <neil@daikokuya.demon.co.uk>
* cppmacro.c (funlike_invocation_p): Don't step back
struct op
{
enum cpp_ttype op;
- U_CHAR prio; /* Priority of op. */
- U_CHAR flags;
- U_CHAR unsignedp; /* True if value should be treated as unsigned. */
+ uchar prio; /* Priority of op. */
+ uchar flags;
+ uchar unsignedp; /* True if value should be treated as unsigned. */
HOST_WIDEST_INT value; /* The value logically "right" of op. */
};
const cpp_token *tok;
{
struct op op;
- const U_CHAR *start = tok->val.str.text;
- const U_CHAR *end = start + tok->val.str.len;
- const U_CHAR *p = start;
+ const uchar *start = tok->val.str.text;
+ const uchar *end = start + tok->val.str.len;
+ const uchar *p = start;
int c = 0, i, nsuff;
unsigned HOST_WIDEST_INT n = 0, nd, MAX_over_base;
int base = 10;
struct include_file *inc;
{
ssize_t size, offset, count;
- U_CHAR *buf;
+ uchar *buf;
#if MMAP_THRESHOLD
static int pagesize = -1;
#endif
if (SHOULD_MMAP (size, pagesize))
{
- buf = (U_CHAR *) mmap (0, size, PROT_READ, MAP_PRIVATE, inc->fd, 0);
- if (buf == (U_CHAR *)-1)
+ buf = (uchar *) mmap (0, size, PROT_READ, MAP_PRIVATE, inc->fd, 0);
+ if (buf == (uchar *)-1)
goto perror_fail;
inc->mapped = 1;
}
else
#endif
{
- buf = (U_CHAR *) xmalloc (size + 1);
+ buf = (uchar *) xmalloc (size + 1);
offset = 0;
while (offset < size)
{
bigger than the majority of C source files. */
size = 8 * 1024;
- buf = (U_CHAR *) xmalloc (size + 1);
+ buf = (uchar *) xmalloc (size + 1);
offset = 0;
while ((count = read (inc->fd, buf + offset, size - offset)) > 0)
{
extern void _cpp_pop_buffer PARAMS ((cpp_reader *));
/* Utility routines and macros. */
-#define DSC(str) (const U_CHAR *)str, sizeof str - 1
+#define DSC(str) (const uchar *)str, sizeof str - 1
#define xnew(T) (T *) xmalloc (sizeof(T))
#define xcnew(T) (T *) xcalloc (1, sizeof(T))
#define xnewvec(T, N) (T *) xmalloc (sizeof(T) * (N))
/* These are inline functions instead of macros so we can get type
checking. */
-typedef unsigned char U_CHAR;
-#define U (const U_CHAR *) /* Intended use: U"string" */
+typedef unsigned char uchar;
+#define U (const uchar *) /* Intended use: U"string" */
-static inline int ustrcmp PARAMS ((const U_CHAR *, const U_CHAR *));
-static inline int ustrncmp PARAMS ((const U_CHAR *, const U_CHAR *,
+static inline int ustrcmp PARAMS ((const uchar *, const uchar *));
+static inline int ustrncmp PARAMS ((const uchar *, const uchar *,
size_t));
-static inline size_t ustrlen PARAMS ((const U_CHAR *));
-static inline U_CHAR *uxstrdup PARAMS ((const U_CHAR *));
-static inline U_CHAR *ustrchr PARAMS ((const U_CHAR *, int));
-static inline int ufputs PARAMS ((const U_CHAR *, FILE *));
+static inline size_t ustrlen PARAMS ((const uchar *));
+static inline uchar *uxstrdup PARAMS ((const uchar *));
+static inline uchar *ustrchr PARAMS ((const uchar *, int));
+static inline int ufputs PARAMS ((const uchar *, FILE *));
static inline int
ustrcmp (s1, s2)
- const U_CHAR *s1, *s2;
+ const uchar *s1, *s2;
{
return strcmp ((const char *)s1, (const char *)s2);
}
static inline int
ustrncmp (s1, s2, n)
- const U_CHAR *s1, *s2;
+ const uchar *s1, *s2;
size_t n;
{
return strncmp ((const char *)s1, (const char *)s2, n);
static inline size_t
ustrlen (s1)
- const U_CHAR *s1;
+ const uchar *s1;
{
return strlen ((const char *)s1);
}
-static inline U_CHAR *
+static inline uchar *
uxstrdup (s1)
- const U_CHAR *s1;
+ const uchar *s1;
{
- return (U_CHAR *) xstrdup ((const char *)s1);
+ return (uchar *) xstrdup ((const char *)s1);
}
-static inline U_CHAR *
+static inline uchar *
ustrchr (s1, c)
- const U_CHAR *s1;
+ const uchar *s1;
int c;
{
- return (U_CHAR *) strchr ((const char *)s1, c);
+ return (uchar *) strchr ((const char *)s1, c);
}
static inline int
ufputs (s, f)
- const U_CHAR *s;
+ const uchar *s;
FILE *f;
{
return fputs ((const char *)s, f);
#define init_trigraph_map() /* Nothing. */
#define TRIGRAPH_MAP \
-__extension__ const U_CHAR _cpp_trigraph_map[UCHAR_MAX + 1] = {
+__extension__ const uchar _cpp_trigraph_map[UCHAR_MAX + 1] = {
#define END };
#define s(p, v) [p] = v,
#else
-#define TRIGRAPH_MAP U_CHAR _cpp_trigraph_map[UCHAR_MAX + 1] = { 0 }; \
+#define TRIGRAPH_MAP uchar _cpp_trigraph_map[UCHAR_MAX + 1] = { 0 }; \
static void init_trigraph_map PARAMS ((void)) { \
unsigned char *x = _cpp_trigraph_map;
Also, macros with CPLUS set in the flags field are entered only for C++. */
struct builtin
{
- const U_CHAR *name;
+ const uchar *name;
const char *value;
unsigned char builtin;
unsigned char operator;
static void adjust_column PARAMS ((cpp_reader *));
static int skip_whitespace PARAMS ((cpp_reader *, cppchar_t));
static cpp_hashnode *parse_identifier PARAMS ((cpp_reader *));
-static U_CHAR *parse_slow PARAMS ((cpp_reader *, const U_CHAR *, int,
+static uchar *parse_slow PARAMS ((cpp_reader *, const uchar *, int,
unsigned int *));
static void parse_number PARAMS ((cpp_reader *, cpp_string *, int));
-static int unescaped_terminator_p PARAMS ((cpp_reader *, const U_CHAR *));
+static int unescaped_terminator_p PARAMS ((cpp_reader *, const uchar *));
static void parse_string PARAMS ((cpp_reader *, cpp_token *, cppchar_t));
static bool trigraph_p PARAMS ((cpp_reader *));
-static void save_comment PARAMS ((cpp_reader *, cpp_token *, const U_CHAR *,
+static void save_comment PARAMS ((cpp_reader *, cpp_token *, const uchar *,
cppchar_t));
static int name_p PARAMS ((cpp_reader *, const cpp_string *));
static int maybe_read_ucs PARAMS ((cpp_reader *, const unsigned char **,
if (token->type != CPP_NAME)
return 0;
- return !ustrcmp (NODE_NAME (token->val.node), (const U_CHAR *) string);
+ return !ustrcmp (NODE_NAME (token->val.node), (const uchar *) string);
}
/* Call when meeting a newline, assumed to be in buffer->cur[-1].
cpp_reader *pfile;
{
cpp_hashnode *result;
- const U_CHAR *cur, *base;
+ const uchar *cur, *base;
/* Fast-path loop. Skim over a normal identifier.
N.B. ISIDNUM does not include $. */
1 if it's a number, and 2 if it has a leading period. Returns a
pointer to the token's NUL-terminated spelling in permanent
storage, and sets PLEN to its length. */
-static U_CHAR *
+static uchar *
parse_slow (pfile, cur, number_p, plen)
cpp_reader *pfile;
- const U_CHAR *cur;
+ const uchar *cur;
int number_p;
unsigned int *plen;
{
cpp_buffer *buffer = pfile->buffer;
- const U_CHAR *base = buffer->cur - 1;
+ const uchar *base = buffer->cur - 1;
struct obstack *stack = &pfile->hash_table->stack;
unsigned int c, prevc, saw_dollar = 0;
cpp_string *number;
int leading_period;
{
- const U_CHAR *cur;
+ const uchar *cur;
/* Fast-path loop. Skim over a normal number.
N.B. ISIDNUM does not include $. */
number->text = parse_slow (pfile, cur, 1 + leading_period, &number->len);
else
{
- const U_CHAR *base = pfile->buffer->cur - 1;
- U_CHAR *dest;
+ const uchar *base = pfile->buffer->cur - 1;
+ uchar *dest;
number->len = cur - base + leading_period;
dest = _cpp_unaligned_alloc (pfile, number->len + 1);
struct directive
{
directive_handler handler; /* Function to handle directive. */
- const U_CHAR *name; /* Name of directive. */
+ const uchar *name; /* Name of directive. */
unsigned short length; /* Length of name. */
unsigned char origin; /* Origin of directive. */
unsigned char flags; /* Flags describing this directive. */
static void push_conditional PARAMS ((cpp_reader *, int, int,
const cpp_hashnode *));
static unsigned int read_flag PARAMS ((cpp_reader *, unsigned int));
-static U_CHAR *dequote_string PARAMS ((cpp_reader *, const U_CHAR *,
+static uchar *dequote_string PARAMS ((cpp_reader *, const uchar *,
unsigned int));
-static int strtoul_for_line PARAMS ((const U_CHAR *, unsigned int,
+static int strtoul_for_line PARAMS ((const uchar *, unsigned int,
unsigned long *));
static void do_diagnostic PARAMS ((cpp_reader *, int, int));
static cpp_hashnode *lex_macro_node PARAMS ((cpp_reader *));
/* Don't invoke CONCAT2 with any whitespace or K&R cc will fail. */
#define D(name, t, origin, flags) \
-{ CONCAT2(do_,name), (const U_CHAR *) STRINGX(name), \
+{ CONCAT2(do_,name), (const uchar *) STRINGX(name), \
sizeof STRINGX(name) - 1, origin, flags },
static const directive dtable[] =
{
const char *buf;
size_t count;
{
- cpp_push_buffer (pfile, (const U_CHAR *) buf, count,
+ cpp_push_buffer (pfile, (const uchar *) buf, count,
/* from_stage3 */ true, 1);
start_directive (pfile);
/* We don't want a leading # to be interpreted as a directive. */
/* Subroutine of do_line and do_linemarker. Returns a version of STR
which has a NUL terminator and all escape sequences converted to
their equivalents. Temporary, hopefully. */
-static U_CHAR *
+static uchar *
dequote_string (pfile, str, len)
cpp_reader *pfile;
- const U_CHAR *str;
+ const uchar *str;
unsigned int len;
{
- U_CHAR *result = _cpp_unaligned_alloc (pfile, len + 1);
- U_CHAR *dst = result;
- const U_CHAR *limit = str + len;
+ uchar *result = _cpp_unaligned_alloc (pfile, len + 1);
+ uchar *dst = result;
+ const uchar *limit = str + len;
unsigned int c;
unsigned HOST_WIDE_INT mask;
if (c != '\\')
*dst++ = c;
else
- *dst++ = cpp_parse_escape (pfile, (const U_CHAR **)&str, limit, mask);
+ *dst++ = cpp_parse_escape (pfile, (const uchar **)&str, limit, mask);
}
*dst++ = '\0';
return result;
number was well-formed, 1 if not. Temporary, hopefully. */
static int
strtoul_for_line (str, len, nump)
- const U_CHAR *str;
+ const uchar *str;
unsigned int len;
unsigned long *nump;
{
unsigned long reg = 0;
- U_CHAR c;
+ uchar c;
while (len--)
{
c = *str++;
cpp_buffer *
cpp_push_buffer (pfile, buffer, len, from_stage3, return_at_eof)
cpp_reader *pfile;
- const U_CHAR *buffer;
+ const uchar *buffer;
size_t len;
int from_stage3;
int return_at_eof;
static const cpp_token *padding_token
PARAMS ((cpp_reader *, const cpp_token *));
static void expand_arg PARAMS ((cpp_reader *, macro_arg *));
-static const cpp_token *new_string_token PARAMS ((cpp_reader *, U_CHAR *,
+static const cpp_token *new_string_token PARAMS ((cpp_reader *, uchar *,
unsigned int));
static const cpp_token *new_number_token PARAMS ((cpp_reader *, unsigned int));
static const cpp_token *stringify_arg PARAMS ((cpp_reader *, macro_arg *));
{
unsigned int len;
const char *name;
- U_CHAR *buf;
+ uchar *buf;
const struct line_map *map = pfile->map;
if (node->value.builtin == BT_BASE_FILE)
backslashes and double quotes. Non-printable characters are
converted to octal. DEST must be of sufficient size. Returns
a pointer to the end of the string. */
-U_CHAR *
+uchar *
cpp_quote_string (dest, src, len)
- U_CHAR *dest;
- const U_CHAR *src;
+ uchar *dest;
+ const uchar *src;
unsigned int len;
{
while (len--)
{
- U_CHAR c = *src++;
+ uchar c = *src++;
if (c == '\\' || c == '"')
{
goto cleanup2;
/* Success. Commit the parameter array. */
- BUFF_FRONT (pfile->a_buff) = (U_CHAR *) ¯o->params[macro->paramc];
+ BUFF_FRONT (pfile->a_buff) = (uchar *) ¯o->params[macro->paramc];
macro->fun_like = 1;
}
else if (ctoken->type != CPP_EOF && !(ctoken->flags & PREV_WHITE))
macro->expansion[0].flags &= ~PREV_WHITE;
/* Commit the memory. */
- BUFF_FRONT (pfile->a_buff) = (U_CHAR *) ¯o->expansion[macro->count];
+ BUFF_FRONT (pfile->a_buff) = (uchar *) ¯o->expansion[macro->count];
/* Implement the macro-defined-to-itself optimisation. */
if (macro->count == 1 && !macro->fun_like
const cpp_string *string;
{
unsigned int i, len;
- const U_CHAR *p, *q, *limit = string->text + string->len;
+ const uchar *p, *q, *limit = string->text + string->len;
/* Loop over the string. */
for (p = string->text; p < limit; p = q)
if (len > pfile->macro_buffer_len)
{
- pfile->macro_buffer = (U_CHAR *) xrealloc (pfile->macro_buffer, len);
+ pfile->macro_buffer = (uchar *) xrealloc (pfile->macro_buffer, len);
pfile->macro_buffer_len = len;
}