aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppfiles.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-05-04 04:38:01 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-05-04 04:38:01 +0000
commit12cf91fef042b190014d9dbd205fb29da2bb4ccf (patch)
tree32af1382b7b6344ab51affdb8e243e9ecedf4e69 /gcc/cppfiles.c
parent22a8784041d6222be1e1fbdbb81054d16ed5e092 (diff)
downloadgcc-12cf91fef042b190014d9dbd205fb29da2bb4ccf.zip
gcc-12cf91fef042b190014d9dbd205fb29da2bb4ccf.tar.gz
gcc-12cf91fef042b190014d9dbd205fb29da2bb4ccf.tar.bz2
cpphash.h (U): New define, to correct type of string constants.
gcc: * cpphash.h (U): New define, to correct type of string constants. (ustrcmp, ustrncmp, ustrlen, uxstrdup, ustrchr): New wrapper routines, to do casts when passing unsigned strings to libc. * cppexp.c, cppfiles.c, cpphash.c, cppinit.c, cpplib.c: Use them. * cppfiles.c (_cpp_execute_include): Make filename an U_CHAR *. * cpphash.c (_cpp_quote_string): Make string an U_CHAR *. * cppinit.c (dump_special_to_buffer): Make macro name an U_CHAR *. * cpplex.c (parse_ifdef, parse_include, validate_else): Make second argument an U_CHAR *. * cppinit.c (builtin_array): Make name and value U_CHAR *, add length field, clean up initializer. (ISTABLE): Add __extension__ to designated- initializers version. * cpplex.c (CHARTAB): Likewise. * mbchar.c: Add dummy external declaration to the !MULTIBYTE_CHARS case so the file won't be empty. include: * symcat.h: Remove #endif label. From-SVN: r33657
Diffstat (limited to 'gcc/cppfiles.c')
-rw-r--r--gcc/cppfiles.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c
index 5ec9d14..395976f 100644
--- a/gcc/cppfiles.c
+++ b/gcc/cppfiles.c
@@ -74,8 +74,8 @@ eq_IHASH (x, y)
const void *x;
const void *y;
{
- const U_CHAR *a = ((const IHASH *)x)->nshort;
- const U_CHAR *b = ((const IHASH *)y)->nshort;
+ const char *a = ((const IHASH *)x)->nshort;
+ const char *b = ((const IHASH *)y)->nshort;
return !strcmp (a, b);
}
@@ -132,7 +132,7 @@ redundant_include_p (pfile, ihash, ilist)
return (i->control_macro
&& (i->control_macro[0] == '\0'
|| cpp_defined (pfile, i->control_macro,
- strlen (i->control_macro))))
+ ustrlen (i->control_macro))))
? (IHASH *)-1 : i;
return 0;
@@ -147,7 +147,7 @@ cpp_included (pfile, fname)
{
IHASH dummy, *ptr;
dummy.nshort = fname;
- dummy.hash = _cpp_calc_hash (fname, strlen (fname));
+ dummy.hash = _cpp_calc_hash ((const U_CHAR *)fname, strlen (fname));
ptr = htab_find_with_hash (pfile->all_include_files,
(const void *)&dummy, dummy.hash);
return (ptr != NULL);
@@ -237,7 +237,7 @@ find_include_file (pfile, fname, search_start, ihash, before)
char *name;
dummy.nshort = fname;
- dummy.hash = _cpp_calc_hash (fname, strlen (fname));
+ dummy.hash = _cpp_calc_hash ((const U_CHAR *)fname, strlen (fname));
path = (fname[0] == '/') ? ABSOLUTE_PATH : search_start;
slot = (IHASH **) htab_find_slot_with_hash (pfile->all_include_files,
(const void *) &dummy,
@@ -308,7 +308,7 @@ _cpp_fake_ihash (pfile, fname)
IHASH dummy;
dummy.nshort = fname;
- dummy.hash = _cpp_calc_hash (fname, strlen (fname));
+ dummy.hash = _cpp_calc_hash ((const U_CHAR *)fname, strlen (fname));
slot = (IHASH **) htab_find_slot_with_hash (pfile->all_include_files,
(const void *) &dummy,
dummy.hash, INSERT);
@@ -515,14 +515,15 @@ remap_filename (pfile, name, loc)
void
-_cpp_execute_include (pfile, fname, len, no_reinclude, search_start)
+_cpp_execute_include (pfile, f, len, no_reinclude, search_start)
cpp_reader *pfile;
- char *fname;
+ U_CHAR *f;
unsigned int len;
int no_reinclude;
struct file_name_list *search_start;
{
IHASH *ihash;
+ char *fname = (char *)f;
int fd;
int angle_brackets = fname[0] == '<';
int before;
@@ -615,7 +616,7 @@ _cpp_execute_include (pfile, fname, len, no_reinclude, search_start)
/* Actually process the file. */
if (no_reinclude)
- ihash->control_macro = (const U_CHAR *) "";
+ ihash->control_macro = U"";
if (read_include_file (pfile, fd, ihash))
{
@@ -644,7 +645,7 @@ cpp_read_file (pfile, fname)
if (*fname == 0)
dummy.hash = 0;
else
- dummy.hash = _cpp_calc_hash (fname, strlen (fname));
+ dummy.hash = _cpp_calc_hash ((const U_CHAR *)fname, strlen (fname));
slot = (IHASH **) htab_find_slot_with_hash (pfile->all_include_files,
(const void *) &dummy,
dummy.hash, INSERT);
@@ -743,7 +744,7 @@ read_include_file (pfile, fd, ihash)
if (length < 0)
goto fail;
if (length == 0)
- ihash->control_macro = (const U_CHAR *) ""; /* never re-include */
+ ihash->control_macro = U""; /* never re-include */
close (fd);
fp->rlimit = fp->buf + length;