aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZack Weinberg <zack@rabi.phys.columbia.edu>1998-10-11 00:05:11 +0000
committerJeff Law <law@gcc.gnu.org>1998-10-10 18:05:11 -0600
commitfaa765969fa9ce85b27bd20d9a966b0cabba5cdb (patch)
tree2f9de21a1e1e04335878526769ff5fd361b7abd4
parent9265dacf25a26ef02473949bc8feec743e1e5b8c (diff)
downloadgcc-faa765969fa9ce85b27bd20d9a966b0cabba5cdb.zip
gcc-faa765969fa9ce85b27bd20d9a966b0cabba5cdb.tar.gz
gcc-faa765969fa9ce85b27bd20d9a966b0cabba5cdb.tar.bz2
cppexp.c: When forcing unsigned comparisons, cast both sides of the operation.
* cppexp.c: When forcing unsigned comparisons, cast both sides of the operation. * cpphash.h: Move static declaration of hashtab[]... * cpphash.c: ...here. * cpplib.c: Cast difference of two pointers to size_t before comparing it to size_t. Cast signed to unsigned before comparing to size_t. (FIXME: struct argdata should use unsigned buffer sizes.) * cpplib.h (struct cpp_reader): Declare token_buffer_size as unsigned int. (CPP_WRITTEN): Cast return value to size_t. (CPP_RESERVE): Parenthesize N for evaluation order, cast to size_t before comparison. From-SVN: r22980
-rw-r--r--gcc/ChangeLog17
-rw-r--r--gcc/cppexp.c5
-rw-r--r--gcc/cpphash.c2
-rw-r--r--gcc/cpphash.h1
-rw-r--r--gcc/cpplib.c6
-rw-r--r--gcc/cpplib.h6
6 files changed, 28 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1cd2d8a..5197ef3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,20 @@
+Sun Oct 11 01:03:05 1998 Zack Weinberg <zack@rabi.phys.columbia.edu>
+
+ * cppexp.c: When forcing unsigned comparisons, cast both sides
+ of the operation.
+
+ * cpphash.h: Move static declaration of hashtab[]...
+ * cpphash.c: ...here.
+
+ * cpplib.c: Cast difference of two pointers to size_t before
+ comparing it to size_t. Cast signed to unsigned
+ before comparing to size_t. (FIXME: struct argdata should use
+ unsigned buffer sizes.)
+ * cpplib.h (struct cpp_reader): Declare token_buffer_size as
+ unsigned int. (CPP_WRITTEN): Cast return value to size_t.
+ (CPP_RESERVE): Parenthesize N for evaluation order, cast to
+ size_t before comparison.
+
Sun Oct 11 00:15:29 1998 Jeffrey A Law (law@cygnus.com)
* flow.c (find_basic_blocks): Delte "live_reachable_p" argument.
diff --git a/gcc/cppexp.c b/gcc/cppexp.c
index 44f8a665..8fc5f04 100644
--- a/gcc/cppexp.c
+++ b/gcc/cppexp.c
@@ -365,7 +365,7 @@ cpp_lex (pfile, skip_evaluation)
{
c = cpp_parse_escape (pfile, (char **) &ptr);
if (width < HOST_BITS_PER_INT
- && (unsigned) c >= (1 << width))
+ && (unsigned) c >= (unsigned)(1 << width))
cpp_pedwarn (pfile,
"escape sequence out of range for character");
}
@@ -649,7 +649,8 @@ right_shift (pfile, a, unsignedp, b)
#define COMPARE(OP) \
top->unsignedp = 0;\
- top->value = (unsigned1 || unsigned2) ? (unsigned long) v1 OP v2 : (v1 OP v2)
+ top->value = (unsigned1 || unsigned2) \
+ ? (unsigned long) v1 OP (unsigned long) v2 : (v1 OP v2)
/* Parse and evaluate a C expression, reading from PFILE.
Returns the value of the expression. */
diff --git a/gcc/cpphash.c b/gcc/cpphash.c
index 6aa9e9c..d20f7bb 100644
--- a/gcc/cpphash.c
+++ b/gcc/cpphash.c
@@ -30,6 +30,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern char *xmalloc PARAMS ((unsigned));
+static HASHNODE *hashtab[HASHSIZE];
+
/* Return hash function on name. must be compatible with the one
computed a step at a time, elsewhere */
diff --git a/gcc/cpphash.h b/gcc/cpphash.h
index 2b0668d..c536ce4 100644
--- a/gcc/cpphash.h
+++ b/gcc/cpphash.h
@@ -31,7 +31,6 @@ typedef struct hashnode HASHNODE;
politeness, for use when speed isn't so important. */
#define HASHSIZE 1403
-static HASHNODE *hashtab[HASHSIZE];
#define HASHSTEP(old, c) ((old << 2) + c)
#define MAKE_POS(v) (v & 0x7fffffff) /* make number positive */
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index da2f54a..b56790e 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -1512,7 +1512,7 @@ create_definition (buf, limit, pfile, predefinition)
while (is_idchar[*bp]) {
bp++;
/* do we have a "special" rest-args extension here? */
- if (limit - bp > REST_EXTENSION_LENGTH
+ if ((size_t)(limit - bp) > REST_EXTENSION_LENGTH
&& strncmp (rest_extension, bp, REST_EXTENSION_LENGTH) == 0) {
rest_args = 1;
temp->rest_args = 1;
@@ -2747,7 +2747,7 @@ macroexpand (pfile, hp)
one space except within an string or char token.*/
if (is_space[c])
{
- if (CPP_WRITTEN (pfile) > arg->stringified
+ if (CPP_WRITTEN (pfile) > (unsigned)arg->stringified
&& (CPP_PWRITTEN (pfile))[-1] == '@')
{
/* "@ " escape markers are removed */
@@ -5528,7 +5528,7 @@ open_include_file (pfile, filename, searchptr)
p = filename;
if (searchptr
&& searchptr->fname
- && strlen (searchptr->fname) == p - filename
+ && strlen (searchptr->fname) == (size_t) (p - filename)
&& ! strncmp (searchptr->fname, filename, p - filename))
{
/* FILENAME is in SEARCHPTR, which we've already checked. */
diff --git a/gcc/cpplib.h b/gcc/cpplib.h
index 12b111b..ab63719 100644
--- a/gcc/cpplib.h
+++ b/gcc/cpplib.h
@@ -179,7 +179,7 @@ struct cpp_reader {
/* A buffer used for both for cpp_get_token's output, and also internally. */
unsigned char *token_buffer;
/* Allocated size of token_buffer. CPP_RESERVE allocates space. */
- int token_buffer_size;
+ unsigned int token_buffer_size;
/* End of the written part of token_buffer. */
unsigned char *limit;
@@ -279,12 +279,12 @@ struct cpp_reader {
#define CPP_OUT_BUFFER(PFILE) ((PFILE)->token_buffer)
/* Number of characters currently in PFILE's output buffer. */
-#define CPP_WRITTEN(PFILE) ((PFILE)->limit - (PFILE)->token_buffer)
+#define CPP_WRITTEN(PFILE) ((size_t)((PFILE)->limit - (PFILE)->token_buffer))
#define CPP_PWRITTEN(PFILE) ((PFILE)->limit)
/* Make sure PFILE->token_buffer has space for at least N more characters. */
#define CPP_RESERVE(PFILE, N) \
- (CPP_WRITTEN (PFILE) + N > (PFILE)->token_buffer_size \
+ (CPP_WRITTEN (PFILE) + (size_t)(N) > (PFILE)->token_buffer_size \
&& (cpp_grow_buffer (PFILE, N), 0))
/* Append string STR (of length N) to PFILE's output buffer.