From f8344bea51379fdab43668c99099b48d6d3e3681 Mon Sep 17 00:00:00 2001 From: Manfred Hollstein Date: Thu, 12 Mar 1998 00:02:52 +0000 Subject: [PATCH] c-decl (finish_struct): Change type of min_align to unsigned. a gcc/ChangeLog: * c-decl (finish_struct): Change type of min_align to unsigned. * cplus-dem.c (demangle_function_name): Change type of variable i to size_t; remove unused variable len. * dwarf2out.c (reg_save): Add explicit cast of -1 to unsigned and a comment indicating this is proper behaviour. (reg_loc_descriptor): Remove redundant comparison of unsigned variable reg >= 0. (based_loc_descr): Likewise. * enquire.c (bitpattern): Change type of variable i to unsigned. * final.c (output_asm_insn): Don't cast insn_noperands to unsigned. * flow.c (life_analysis): Change type of variable i to size_t; remove unused variable insn. * gcc.c (translate_options): Change type of variables optlen, arglen and complen to size_t. (input_filename_length): Change type to size_t. (do_spec_1): Change type of variable bufsize to size_t. (main): Change type of variables i and j to size_t; remove subblock local definition of variable i. (lookup_compiler): Change type of second argument to size_t; change type of variable i to size_t. * genemit.c (output_init_mov_optab): Change type of variable i to size_t. * genopinit.c (get_insn): Change type of variable pindex to size_t. * genrecog.c (add_to_sequence): Change type of variable i to size_t. * global.c (global_alloc): Change type of variable i to size_t. * regclass.c (init_reg_sets): Change type of variables i and j to unsigned. * stmt.c (expand_end_bindings): Change type of variable i to size_t. (expand_end_case): Change type of variable count to size_t. * toplev.c (main): Change type of variable j to size_t. (set_target_switch): Change type of variable j to size_t. (print_switch_values): Change type of variable j to size_t; remove unused variable flags. * varasm.c (assemble_variable): Change type of variable align to size_t. (const_hash_rtx): Change type of variable i to size_t. gcc/cp/ChangeLog: Sun Mar 8 17:13:38 1998 Manfred Hollstein * decl2.c (lang_decode_option): Change j's type to size_t. * tree.c (layout_vbasetypes): record_align and desired_align are of type unsigned int; const_size and nonvirtual_const_size likewise. From-SVN: r18491 --- gcc/c-decl.c | 2 +- gcc/cp/tree.c | 13 ++++--- gcc/cplus-dem.c | 5 +-- gcc/enquire.c | 98 ++++++++++++++++++++++++++++++------------------- gcc/global.c | 2 +- gcc/regclass.c | 2 +- gcc/varasm.c | 5 ++- 7 files changed, 76 insertions(+), 51 deletions(-) diff --git a/gcc/c-decl.c b/gcc/c-decl.c index c3cf4fca6ca5..35a2357544c3 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -5834,7 +5834,7 @@ finish_struct (t, fieldlist, attributes) } else if (TREE_TYPE (x) != error_mark_node) { - int min_align = (DECL_PACKED (x) ? BITS_PER_UNIT + unsigned int min_align = (DECL_PACKED (x) ? BITS_PER_UNIT : TYPE_ALIGN (TREE_TYPE (x))); /* Non-bit-fields are aligned for their type, except packed fields which require only BITS_PER_UNIT alignment. */ diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 8fb0c9f586c4..4fb17244c3a7 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -648,20 +648,20 @@ layout_vbasetypes (rec, max) tree vbase_types = get_vbase_types (rec); #ifdef STRUCTURE_SIZE_BOUNDARY - unsigned record_align = MAX (STRUCTURE_SIZE_BOUNDARY, TYPE_ALIGN (rec)); + unsigned int record_align = MAX (STRUCTURE_SIZE_BOUNDARY, TYPE_ALIGN (rec)); #else - unsigned record_align = MAX (BITS_PER_UNIT, TYPE_ALIGN (rec)); + unsigned int record_align = MAX (BITS_PER_UNIT, TYPE_ALIGN (rec)); #endif - int desired_align; + unsigned int desired_align; /* Record size so far is CONST_SIZE + VAR_SIZE bits, where CONST_SIZE is an integer and VAR_SIZE is a tree expression. If VAR_SIZE is null, the size is just CONST_SIZE. Naturally we try to avoid using VAR_SIZE. */ - register unsigned const_size = 0; + register unsigned int const_size = 0; register tree var_size = 0; - int nonvirtual_const_size; + unsigned int nonvirtual_const_size; CLASSTYPE_VBASECLASSES (rec) = vbase_types; @@ -809,7 +809,8 @@ layout_basetypes (rec, binfos) for (i = 0; i < n_baseclasses; i++) { - int inc, desired_align, int_vbase_size; + int inc, int_vbase_size; + unsigned int desired_align; register tree base_binfo = TREE_VEC_ELT (binfos, i); register tree basetype = BINFO_TYPE (base_binfo); tree decl, offset; diff --git a/gcc/cplus-dem.c b/gcc/cplus-dem.c index cd50db0f357a..7c1f08ca0151 100644 --- a/gcc/cplus-dem.c +++ b/gcc/cplus-dem.c @@ -2907,8 +2907,7 @@ demangle_function_name (work, mangled, declp, scan) string *declp; const char *scan; { - int i; - int len; + size_t i; string type; const char *tem; @@ -2955,7 +2954,7 @@ demangle_function_name (work, mangled, declp, scan) { for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) { - len = declp->p - declp->b - 10; + int len = declp->p - declp->b - 10; if (strlen (optable[i].in) == len && memcmp (optable[i].in, declp->b + 10, len) == 0) { diff --git a/gcc/enquire.c b/gcc/enquire.c index 5bd34d8860a8..e8adb038c0d0 100644 --- a/gcc/enquire.c +++ b/gcc/enquire.c @@ -34,6 +34,9 @@ Changes by Stephen Moshier, installed Sep 93: (FPROP): Recognize 80387 or 68881 XFmode format. + Change by Manfred Hollstein, installed Mar 98: + (bitpattern): Change type of variable i to unsigned int. + COMPILING With luck and a following wind, just the following will work: @@ -421,6 +424,13 @@ #ifdef VERIFY #include "limits.h" +#endif + +#ifndef SYS_FLOAT_H_WRAP +#define SYS_FLOAT_H_WRAP 0 +#endif + +#if SYS_FLOAT_H_WRAP || defined VERIFY #include "float.h" #endif @@ -477,7 +487,8 @@ Procedure endian ARGS((int bits_per_byte)); int exponent ARGS((Long_double x, double *fract, int *exp)); int floor_log ARGS((int base, Long_double x)); Procedure f_define ARGS((char *desc, char *extra, char *sort, char *name, - int prec, Long_double val, char *mark)); + int prec, Long_double val, Long_double req, + char *mark)); Procedure i_define ARGS((char *desc, char *extra, char *sort, char *name, long val, long lim, long req, char *mark)); Procedure u_define ARGS((char *desc, char *extra, char *sort, char *name, @@ -704,6 +715,8 @@ int main(argc, argv) int argc; char *argv[]; { if (F) { printf ("#ifndef _FLOAT_H___\n"); printf ("#define _FLOAT_H___\n"); + if (SYS_FLOAT_H_WRAP) + printf ("#include_next \n"); } #ifdef ID printf("%sProduced on %s by enquire version %s, CWI, Amsterdam%s\n", @@ -772,7 +785,7 @@ int main(argc, argv) int argc; char *argv[]; { size/=2; } - Vprintf("%sMemory mallocatable ~= %ld Kbytes%s\n", + Vprintf("%sMemory allocable ~= %ld Kbytes%s\n", co, (total+511)/512, oc); } #endif @@ -798,6 +811,8 @@ Procedure describe(description, extra) char *description, *extra; { Procedure i_define(desc, extra, sort, name, val, lim, req, mark) char *desc, *extra, *sort, *name; long val, lim, req; char *mark; { + if (SYS_FLOAT_H_WRAP && F && val == req) + return; /* Produce a #define for a signed int type */ describe(desc, extra); printf("#undef %s%s\n", sort, name); @@ -812,15 +827,13 @@ Procedure i_define(desc, extra, sort, name, val, lim, req, mark) } else { printf("#define %s%s (%ld%s)\n", sort, name, val, mark); } - /* If VERIFY is not set, val and req are just the same value; - if it is set, val is the value as calculated, and req is - the #defined constant - */ +#ifdef VERIFY if (val != req) { printf("%s*** Verify failed for above #define!\n", co); printf(" Compiler has %ld for value%s\n\n", req, oc); bugs++; } +#endif Vprintf("\n"); } @@ -830,17 +843,21 @@ Procedure u_define(desc, extra, sort, name, val, req, mark) describe(desc, extra); printf("#undef %s%s\n", sort, name); printf("#define %s%s %lu%s%s\n", sort, name, val, U, mark); +#ifdef VERIFY if (val != req) { printf("%s*** Verify failed for above #define!\n", co); printf(" Compiler has %lu for value%s\n\n", req, oc); bugs++; } +#endif Vprintf("\n"); } -Procedure f_define(desc, extra, sort, name, precision, val, mark) +Procedure f_define(desc, extra, sort, name, precision, val, req, mark) char *desc, *extra, *sort, *name; int precision; - Long_double val; char *mark; { + Long_double val, req; char *mark; { + if (SYS_FLOAT_H_WRAP && F && val == req) + return; /* Produce a #define for a float/double/long double */ describe(desc, extra); printf ("#undef %s%s\n", sort, name); @@ -960,7 +977,8 @@ char *f_rep(precision, val) int precision; Long_double val; { Procedure bitpattern(p, size) char *p; unsigned int size; { /* Printf the bit-pattern of p */ char c; - int i, j; + unsigned int i; + int j; for (i=1; i<=size; i++) { c= *p; @@ -1590,18 +1608,20 @@ if (V) printf ("%s%s %s %s%s\n", co, "Type size_t is", Vprintf("\n%sPROPERTIES OF POINTERS%s\n", co, oc); - if ((long) (char *) &variable == (long) (int *) &variable) + if ((long) (char *) &variable == (long) (int *) &variable) { Vprintf("%sChar and int pointer formats seem identical%s\n", co, oc); - else + } else { Vprintf("%sChar and int pointer formats are different%s\n", co, oc); - if ((long) (char *) &variable == (long) (function *) &variable) + } + if ((long) (char *) &variable == (long) (function *) &variable) { Vprintf("%sChar and function pointer formats seem identical%s\n", co, oc); - else + } else { Vprintf("%sChar and function pointer formats are different%s\n", co, oc); + } if (V) { if ("abcd"=="abcd") @@ -1745,7 +1765,6 @@ extern char *f_rep(); #define UPROP usprop #define Uname "USHRT" -#ifdef VERIFY #ifdef SHRT_MAX #define I_MAX SHRT_MAX #endif @@ -1789,7 +1808,6 @@ extern char *f_rep(); #ifdef FLT_MAX_10_EXP #define F_MAX_10_EXP FLT_MAX_10_EXP #endif -#endif /* VERIFY */ #endif /* PASS1 */ @@ -1831,7 +1849,6 @@ extern char *f_rep(); #define UPROP uiprop #define Uname "UINT" -#ifdef VERIFY #ifdef INT_MAX #define I_MAX INT_MAX #endif @@ -1869,7 +1886,6 @@ extern char *f_rep(); #ifdef DBL_MAX_10_EXP #define F_MAX_10_EXP DBL_MAX_10_EXP #endif -#endif /* VERIFY */ #endif /* PASS2 */ @@ -1917,7 +1933,6 @@ extern char *f_rep(); #define UPROP ulprop #define Uname "ULONG" -#ifdef VERIFY #ifdef LONG_MAX #define I_MAX LONG_MAX #endif @@ -1955,52 +1970,53 @@ extern char *f_rep(); #ifdef LDBL_MAX_10_EXP #define F_MAX_10_EXP LDBL_MAX_10_EXP #endif -#endif /* VERIFY */ #endif /* PASS3 */ +#define UNDEFINED (-2) + #ifndef I_MAX -#define I_MAX int_max +#define I_MAX ((unsigned long) UNDEFINED) #endif #ifndef I_MIN -#define I_MIN int_min +#define I_MIN ((unsigned long) UNDEFINED) #endif #ifndef U_MAX -#define U_MAX u_max +#define U_MAX ((unsigned long) UNDEFINED) #endif #ifndef F_RADIX -#define F_RADIX f_radix +#define F_RADIX UNDEFINED #endif #ifndef F_MANT_DIG -#define F_MANT_DIG f_mant_dig +#define F_MANT_DIG UNDEFINED #endif #ifndef F_DIG -#define F_DIG f_dig +#define F_DIG UNDEFINED #endif #ifndef F_ROUNDS -#define F_ROUNDS f_rounds +#define F_ROUNDS UNDEFINED #endif #ifndef F_EPSILON -#define F_EPSILON f_epsilon +#define F_EPSILON ((Number) UNDEFINED) #endif #ifndef F_MIN_EXP -#define F_MIN_EXP f_min_exp +#define F_MIN_EXP UNDEFINED #endif #ifndef F_MIN -#define F_MIN f_min +#define F_MIN ((Number) UNDEFINED) #endif #ifndef F_MIN_10_EXP -#define F_MIN_10_EXP f_min_10_exp +#define F_MIN_10_EXP UNDEFINED #endif #ifndef F_MAX_EXP -#define F_MAX_EXP f_max_exp +#define F_MAX_EXP UNDEFINED #endif #ifndef F_MAX -#define F_MAX f_max +#define F_MAX ((Number) UNDEFINED) #endif #ifndef F_MAX_10_EXP -#define F_MAX_10_EXP f_max_10_exp +#define F_MAX_10_EXP UNDEFINED #endif #ifndef VERIFY @@ -2405,7 +2421,9 @@ int FPROP(bits_per_byte) int bits_per_byte; { } if (PASS == 1) { /* only for FLT */ flt_rounds= f_rounds; - if (F) + /* Prefer system float.h definition of F_ROUNDS, + since it's more likely to be right than our "1". */ + if (F && (!SYS_FLOAT_H_WRAP || F_ROUNDS == UNDEFINED)) i_define(D_FLT_ROUNDS, "", "FLT", "_ROUNDS", (long) f_rounds, 1L, (long) F_ROUNDS, ""); } else if (f_rounds != flt_rounds) { @@ -2492,7 +2510,9 @@ int FPROP(bits_per_byte) int bits_per_byte; { /* Possible loss of precision warnings here from non-stdc compilers */ if (F) f_define(D_EPSILON, thing, - Fname, "_EPSILON", digs, (Long_double) f_epsilon, MARK); + Fname, "_EPSILON", digs, + (Long_double) f_epsilon, + (Long_double) F_EPSILON, MARK); if (V || F) F_check(digs, (Long_double) f_epsilon); Unexpected(21); if (F) Validate(digs, (Long_double) f_epsilon, (Long_double) F_EPSILON, @@ -2570,7 +2590,9 @@ int FPROP(bits_per_byte) int bits_per_byte; { /* Possible loss of precision warnings here from non-stdc compilers */ if (setjmp(lab) == 0) { if (F) f_define(D_MIN, thing, - Fname, "_MIN", digs, (Long_double) f_min, MARK); + Fname, "_MIN", digs, + (Long_double) f_min, + (Long_double) F_MIN, MARK); if (V || F) F_check(digs, (Long_double) f_min); } else { eek_a_bug("xxx_MIN caused a trap"); @@ -2664,7 +2686,9 @@ int FPROP(bits_per_byte) int bits_per_byte; { if (setjmp(lab)==0) { /* Possible loss of precision warnings here from non-stdc compilers */ if (F) f_define(D_MAX, thing, - Fname, "_MAX", digs, (Long_double) f_max, MARK); + Fname, "_MAX", digs, + (Long_double) f_max, + (Long_double) F_MAX, MARK); if (V || F) F_check(digs, (Long_double) f_max); } else { eek_a_bug("xxx_MAX caused a trap"); diff --git a/gcc/global.c b/gcc/global.c index 5033f3953d68..a97c27d662f6 100644 --- a/gcc/global.c +++ b/gcc/global.c @@ -293,7 +293,7 @@ global_alloc (file) #endif || FRAME_POINTER_REQUIRED); - register int i; + register size_t i; rtx x; max_allocno = 0; diff --git a/gcc/regclass.c b/gcc/regclass.c index d43940d6976b..3432c79124f0 100644 --- a/gcc/regclass.c +++ b/gcc/regclass.c @@ -328,7 +328,7 @@ init_reg_sets () static void init_reg_sets_1 () { - register int i, j; + register unsigned int i, j; /* This macro allows the fixed or call-used registers to depend on target flags. */ diff --git a/gcc/varasm.c b/gcc/varasm.c index e81eff3547d4..b204b43c682a 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1142,7 +1142,7 @@ assemble_variable (decl, top_level, at_end, dont_output_data) int dont_output_data; { register char *name; - int align; + unsigned int align; tree size_tree; int reloc = 0; enum in_section saved_in_section; @@ -3216,7 +3216,8 @@ const_hash_rtx (mode, x) enum machine_mode mode; rtx x; { - register int hi, i; + register int hi; + register size_t i; struct rtx_const value; decode_rtx_const (mode, x, &value); -- 2.43.5