From faa765969fa9ce85b27bd20d9a966b0cabba5cdb Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Sun, 11 Oct 1998 00:05:11 +0000 Subject: 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 --- gcc/cpplib.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/cpplib.h') 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. -- cgit v1.1