c-lex.c: Include <stdlib.h> and <string.h>/<strings.h>.

a
	* c-lex.c: Include <stdlib.h> and <string.h>/<strings.h>.  Add
	prototype for `handle_sysv_pragma', and make it static.  Add
	parentheses around assignment used as truth value.
	* combine.c (combine_instructions): Protect variable `prev' with
	macro HAVE_cc0.
	(can_combine_p): Protect variable `link' with AUTO_INC_DEC.
	(extract_left_shift): Add parentheses around operand of &.
	(merge_outer_ops): Avoid an empty body in an else-statement.
	(gen_rtx_combine): Remove unused variable `i'.
	* sparc/gmon-sol2.c: Include <fcntl.h>.  Make return type of
        function monstartup `void'.  Likewise for internal_mcount.  Add
        `static void' prototype for moncontrol.  Reconcile sprintf format
        vs. args.
	* sparc/sparc.c: Include <stdlib.h> and <string.h>/<strings.h>.
	Make return type of function_arg_slotno explicitly `int'.
	(reg_unused_after): Add	parentheses around assignment used as
	truth value.
	(save_regs): Add explicit braces to avoid ambiguous `else'.
	(function_arg_slotno): Add parentheses around && within ||.
	(function_arg_pass_by_reference): Likewise.
	(sparc_flat_output_function_prologue): Reconcile fprintf format
	vs. args.
	* svr4.h (ASM_OUTPUT_LIMITED_STRING): Add parentheses around
	assignment used as truth value.
	* cplus-dem.c: Include <stdlib.h>.
	(demangle_signature): Avoid an empty body in an else-statement.
	(do_type): Remove unused variable `lvl'.
	* cppexp.c: Don't have <stdlib.h> depend on MULTIBYTE_CHARS.
	Include <string.h>/<strings.h>.
	(cpp_lex): Remove unused variable `namelen'.
	(cpp_lex): Explicitly declare `num_chars' as an int.
	* cpplib.c: Avoid duplicate inclusion of <stdlib.h>, include
	<unistd.h> instead.  Explicitly declare is_system_include
	returning int.
	(make_assertion): Remove unused variable `kt'.
	(cpp_expand_to_buffer): Hide variable `obuf'.
	(output_line_command): Remove unused variables, `line_end',
	`line_cmd_buf' and `len'.
	(macarg): Remove unused variable `arg_start'.
	(special_symbol): Remove unused variable `i'.  Add parentheses
	around assignment used as truth value.
	(do_include):  Remove unused variables `pcfname' and `retried',
	hide `pcf' and `pcfbuflimit'.
	(do_line): Remove unused variable `i'.
	(finclude): Hide variable `missing_newline'.
	(cpp_handle_options): Remove unused variable `j'.
	(read_token_list): Remove unused variable `eofp'.
	(cpp_error_with_line): Remove unused variable `i'.
	(cpp_warning_with_line): Likewise.
	(cpp_pedwarn_with_line): Explicitly declare `column' as int.
	(cpp_error_from_errno): Remove unused variable `i'.
	* cse.c (invalidate): Add parentheses around assignment used as
	truth value.
	(find_best_addr): Move declaration of variable `our_cost' inside
	the conditional macro where its used.
	(fold_rtx): Avoid an empty body in an if-statement.
	(cse_insn): Wrap variables  `this_insn_cc0_mode' and
	`this_insn_cc0' in macro HAVE_cc0.
	* dwarf2out.c: Include <stdlib.h> and <string.h>/<string.h>.
	(ASM_OUTPUT_DWARF_DATA8):  Reconcile format vs. args in fprintf's.
	(output_uleb128): Likewise.
	(output_sleb128): Likewise.
	(output_cfi): Likewise.
	(output_call_frame_info): Remove unused variables `j', `fde_size'
	and `fde_pad'.
	(comp_unit_has_inlines): Hide declaration as per rest of file.
	(size_of_line_prolog): Correct typo in prototype.
	(add_arange): Likewise.
	(output_aranges): Likewise.
	(add_name_and_src_coords_attributes): Likewise.
	(gen_array_type_die): Likewise.
	(gen_inlined_subroutine_die): Likewise.
	(equate_decl_number_to_die): Remove unused variable `i'.
	(print_die): Reconcile format vs. args in fprintf's.
	(print_dwarf_line_table): Likewise.
	(output_die): Likewise.
	(output_line_info): Likewise.
	(add_subscript_info): Avoid an empty body in an else-statement.
	(gen_subprogram_die): Remove unused variable `fp_loc'.
	* dwarfout.c: Explicitly declare `next_pubname_number' as int.
	Protect `ordering_attribute' prototype with USE_ORDERING_ATTRIBUTE
	macro.  Protect `src_coords_attribute' prototype with
	DWARF_DECL_COORDINATES macro.  Hide `output_entry_point_die'
	prototype as in the rest of the file.  Likewise for
	`output_pointer_type_die' and `output_reference_type_die'.  Remove
	prototype for `type_of_for_scope'.
	(output_unsigned_leb128): Reconcile format vs. args in fprintf.
	(type_attribute): Add explicit braces to avoid ambiguous `else'.
	* final.c: Include <stdlib.h> and <string.h>/<strings.h>.
	(shorten_branches): Protect declaration of tmp_length with
	SHORTEN_WITH_ADJUST_INSN_LENGTH and ADJUST_INSN_LENGTH macros.
	(profile_function): Protect declaration of `sval' and `cxt'
	variables with appropriate macros.
	(final_scan_insn): Likewise for `note' variable.  Add explicit
	braces to avoid empty body in an if-statement.
	(output_asm_insn): Move variable `i' inside macro conditional
	where it is used.  Add parentheses around assignment used as truth
	value.
	(asm_fprintf) Likewise, likewise.
	* fix-header.c (main): Remove unused variable `done'.  Protect
	declaration of `i' with FIXPROTO_IGNORE_LIST.
	* pexecute.c: Include <unistd.h>.  Prototype `my_strerror'.
	* print-rtl.c (print_inline_rtx): Explicitly declare the parameter
	`ind'.
	* profile.c: Include <string.h>/<strings.h>.
	(instrument_arcs): Remove unused variables `note', `inverted',
	`zero' and `neg_one'.
	(branch_prob): Avoid empty body in an if-statement.
	* regclass.c: Include <stdlib.h>.
	(reg_alternate_class): Explicitly declare parameter `regno'.
	* regmove.c (regmove_optimize): Remove unused variable `p'.  Add
	parentheses around assignment used as truth value.
	(find_matches):  Remove unused variables `output_operand' and
	`matching_operand'.
	(fixup_match_1): Remove statement with no effect: "if (0) ;".
	* scan.c (sstring_append): Explicitly declare `count' as int.
	(scan_string): Explicitly declare parameter `init' as int.
	* sched.c: Include <stdlib.h>.
	(BLOCKAGE_RANGE): Add parentheses around arithmetic in operand of |.
	(rank_for_schedule): Add parentheses around assignment used as
	truth value.
	(schedule_block): Likewise.
	(regno_use_in): Likewise.
	(schedule_insns): Remove unused variable `i'.
	* toplev.c: Include <stdlib.h> and <string.h>/<strings.h>.
	(v_message_with_decl): Remove unused variable `n'.
	(botch): Explicitly declare parameter `s' as char *.
	(main): Add parentheses around assignment used as truth value.
	* tree.c (make_node): Protect the variable `kind' with the
	GATHER_STATISTICS macro.
	(real_value_from_int_cst): Move variable `e' inside conditional
	macro area where it is used.
	(tree_last): Add parentheses around assignment used as truth value.
	(build1): Protect the variable `kind' with the GATHER_STATISTICS
	macro.
	(print_obstack_statistics): Reconcile format vs. args in fprintf.
	Protect variables `i', `total_nodes', and `total_bytes' with the
	GATHER_STATISTICS macro.
Lots more -W -Wall warnings disappear.

From-SVN: r17515
This commit is contained in:
Jeff Law 1998-01-27 15:11:37 -07:00
parent 4b6bb562de
commit 2d8b0f3ada
3 changed files with 60 additions and 45 deletions

View file

@ -31,6 +31,9 @@ Boston, MA 02111-1307, USA. */
#include <ctype.h>
#include <string.h>
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <demangle.h>
#undef CURRENT_DEMANGLING_STYLE
@ -838,7 +841,7 @@ demangle_signature (work, mangled, declp)
}
else
/* fall through */
;
{;}
default:
if (AUTO_DEMANGLING || GNU_DEMANGLING)
@ -2322,7 +2325,6 @@ do_type (work, mangled, result)
/* A template parm. We substitute the corresponding argument. */
{
int idx;
int lvl;
(*mangled)++;
idx = consume_count_with_underscores (mangled);

View file

@ -1550,7 +1550,7 @@ invalidate (x, full_mode)
struct table_elt *elt;
while (elt = lookup_for_remove (x, hash, GET_MODE (x)))
while ((elt = lookup_for_remove (x, hash, GET_MODE (x))))
remove_from_table (elt, hash);
}
else
@ -2554,7 +2554,6 @@ find_best_addr (insn, loc)
{
struct table_elt *elt, *p;
rtx addr = *loc;
int our_cost;
int found_better = 1;
int save_do_not_record = do_not_record;
int save_hash_arg_in_memory = hash_arg_in_memory;
@ -2624,7 +2623,7 @@ find_best_addr (insn, loc)
#ifndef ADDRESS_COST
if (elt)
{
our_cost = elt->cost;
int our_cost = elt->cost;
/* Find the lowest cost below ours that works. */
for (elt = elt->first_same_value; elt; elt = elt->next_same_value)
@ -5266,10 +5265,13 @@ fold_rtx (x, insn)
}
}
else if (fmt[i] == 'E')
/* Don't try to fold inside of a vector of expressions.
Doing nothing is harmless. */
;
else
{
if (fmt[i] == 'E')
/* Don't try to fold inside of a vector of expressions.
Doing nothing is harmless. */
{;}
}
/* If a commutative operation, place a constant integer as the second
operand unless the first operand is also a constant integer. Otherwise,
@ -6111,9 +6113,11 @@ cse_insn (insn, in_libcall_block)
rtx tem;
register int n_sets = 0;
#ifdef HAVE_cc0
/* Records what this insn does to set CC0. */
rtx this_insn_cc0 = 0;
enum machine_mode this_insn_cc0_mode = VOIDmode;
#endif
rtx src_eqv = 0;
struct table_elt *src_eqv_elt = 0;

View file

@ -29,6 +29,16 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "config.h"
#include "defaults.h"
#include <stdio.h>
#if HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#else
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#endif
#include "tree.h"
#include "flags.h"
#include "rtl.h"
@ -385,13 +395,13 @@ static unsigned reg_number PROTO((rtx));
do { \
if (WORDS_BIG_ENDIAN) \
{ \
fprintf ((FILE), "\t%s\t0x%x\n", UNALIGNED_INT_ASM_OP, HIGH_VALUE); \
fprintf ((FILE), "\t%s\t0x%x", UNALIGNED_INT_ASM_OP, LOW_VALUE);\
fprintf ((FILE), "\t%s\t0x%lx\n", UNALIGNED_INT_ASM_OP, HIGH_VALUE); \
fprintf ((FILE), "\t%s\t0x%lx", UNALIGNED_INT_ASM_OP, LOW_VALUE);\
} \
else \
{ \
fprintf ((FILE), "\t%s\t0x%x\n", UNALIGNED_INT_ASM_OP, LOW_VALUE);\
fprintf ((FILE), "\t%s\t0x%x", UNALIGNED_INT_ASM_OP, HIGH_VALUE); \
fprintf ((FILE), "\t%s\t0x%lx\n", UNALIGNED_INT_ASM_OP, LOW_VALUE);\
fprintf ((FILE), "\t%s\t0x%lx", UNALIGNED_INT_ASM_OP, HIGH_VALUE); \
} \
} while (0)
#endif
@ -1411,7 +1421,7 @@ output_uleb128 (value)
while (value != 0);
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s ULEB128 0x%x", ASM_COMMENT_START, save_value);
fprintf (asm_out_file, "\t%s ULEB128 0x%lx", ASM_COMMENT_START, save_value);
}
/* Output an signed LEB128 quantity. */
@ -1442,7 +1452,7 @@ output_sleb128 (value)
while (more);
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s SLEB128 %d", ASM_COMMENT_START, save_value);
fprintf (asm_out_file, "\t%s SLEB128 %ld", ASM_COMMENT_START, save_value);
}
/* Output a Call Frame Information opcode and its operand(s). */
@ -1458,7 +1468,7 @@ output_cfi (cfi, fde)
cfi->dw_cfi_opc
| (cfi->dw_cfi_oprnd1.dw_cfi_offset & 0x3f));
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s DW_CFA_advance_loc 0x%x",
fprintf (asm_out_file, "\t%s DW_CFA_advance_loc 0x%lx",
ASM_COMMENT_START, cfi->dw_cfi_oprnd1.dw_cfi_offset);
fputc ('\n', asm_out_file);
}
@ -1469,7 +1479,7 @@ output_cfi (cfi, fde)
cfi->dw_cfi_opc
| (cfi->dw_cfi_oprnd1.dw_cfi_reg_num & 0x3f));
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s DW_CFA_offset, column 0x%x",
fprintf (asm_out_file, "\t%s DW_CFA_offset, column 0x%lx",
ASM_COMMENT_START, cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
fputc ('\n', asm_out_file);
@ -1482,7 +1492,7 @@ output_cfi (cfi, fde)
cfi->dw_cfi_opc
| (cfi->dw_cfi_oprnd1.dw_cfi_reg_num & 0x3f));
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s DW_CFA_restore, column 0x%x",
fprintf (asm_out_file, "\t%s DW_CFA_restore, column 0x%lx",
ASM_COMMENT_START, cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
fputc ('\n', asm_out_file);
@ -1588,11 +1598,9 @@ static void
output_call_frame_info (for_eh)
int for_eh;
{
register unsigned long i, j;
register unsigned long i;
register dw_fde_ref fde;
register unsigned long fde_size;
register dw_cfi_ref cfi;
unsigned long fde_pad;
char l1[20], l2[20];
#ifdef ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL
char ld[20];
@ -2304,7 +2312,9 @@ static unsigned pending_types;
/* Record whether the function being analyzed contains inlined functions. */
static int current_function_has_inlines;
#if 0 && defined (MIPS_DEBUGGING_INFO)
static int comp_unit_has_inlines;
#endif
/* A pointer to the ..._DECL node which we have most recently been working
on. We keep this around just in case something about it looks screwy and
@ -2396,7 +2406,7 @@ static unsigned long size_of_locs PROTO((dw_loc_descr_ref));
static int constant_size PROTO((long unsigned));
static unsigned long size_of_die PROTO((dw_die_ref));
static void calc_die_sizes PROTO((dw_die_ref));
static unsigned long size_of_prolog PROTO((void));
static unsigned long size_of_line_prolog PROTO((void));
static unsigned long size_of_line_info PROTO((void));
static unsigned long size_of_pubnames PROTO((void));
static unsigned long size_of_aranges PROTO((void));
@ -2410,8 +2420,8 @@ static void output_compilation_unit_header PROTO((void));
static char *dwarf2_name PROTO((tree, int));
static void add_pubname PROTO((tree, dw_die_ref));
static void output_pubnames PROTO((void));
static void add_arrange PROTO((tree, dw_die_ref));
static void output_arranges PROTO((void));
static void add_arange PROTO((tree, dw_die_ref));
static void output_aranges PROTO((void));
static void output_line_info PROTO((void));
static int is_body_block PROTO((tree));
static dw_die_ref base_type_die PROTO((tree));
@ -2446,7 +2456,7 @@ static void add_prototyped_attribute PROTO((dw_die_ref, tree));
static void add_abstract_origin_attribute PROTO((dw_die_ref, tree));
static void add_pure_or_virtual_attribute PROTO((dw_die_ref, tree));
static void add_src_coords_attributes PROTO((dw_die_ref, tree));
static void ad_name_and_src_coords_attributes PROTO((dw_die_ref, tree));
static void add_name_and_src_coords_attributes PROTO((dw_die_ref, tree));
static void push_decl_scope PROTO((tree));
static dw_die_ref scope_die_for PROTO((tree, dw_die_ref));
static void pop_decl_scope PROTO((void));
@ -2455,7 +2465,7 @@ static void add_type_attribute PROTO((dw_die_ref, tree, int, int,
static char *type_tag PROTO((tree));
static tree member_declared_type PROTO((tree));
static char *decl_start_label PROTO((tree));
static void gen_arrqay_type_die PROTO((tree, dw_die_ref));
static void gen_array_type_die PROTO((tree, dw_die_ref));
static void gen_set_type_die PROTO((tree, dw_die_ref));
static void gen_entry_point_die PROTO((tree, dw_die_ref));
static void pend_type PROTO((tree));
@ -2471,7 +2481,7 @@ static void gen_subprogram_die PROTO((tree, dw_die_ref));
static void gen_variable_die PROTO((tree, dw_die_ref));
static void gen_label_die PROTO((tree, dw_die_ref));
static void gen_lexical_block_die PROTO((tree, dw_die_ref, int));
static void gen_inlined_subprogram_die PROTO((tree, dw_die_ref, int));
static void gen_inlined_subroutine_die PROTO((tree, dw_die_ref, int));
static void gen_field_die PROTO((tree, dw_die_ref));
static void gen_ptr_to_mbr_type_die PROTO((tree, dw_die_ref));
static void gen_compile_unit_die PROTO((char *));
@ -4087,7 +4097,6 @@ equate_decl_number_to_die (decl, decl_die)
register dw_die_ref decl_die;
{
register unsigned decl_id = DECL_UID (decl);
register unsigned i;
register unsigned num_allocated;
if (decl_id >= decl_die_table_allocated)
@ -4177,11 +4186,11 @@ print_die (die, outfile)
register dw_die_ref c;
print_spaces (outfile);
fprintf (outfile, "DIE %4u: %s\n",
fprintf (outfile, "DIE %4lu: %s\n",
die->die_offset, dwarf_tag_name (die->die_tag));
print_spaces (outfile);
fprintf (outfile, " abbrev id: %u", die->die_abbrev);
fprintf (outfile, " offset: %u\n", die->die_offset);
fprintf (outfile, " abbrev id: %lu", die->die_abbrev);
fprintf (outfile, " offset: %lu\n", die->die_offset);
for (a = die->die_attr; a != NULL; a = a->dw_attr_next)
{
@ -4197,13 +4206,13 @@ print_die (die, outfile)
fprintf (outfile, "location descriptor");
break;
case dw_val_class_const:
fprintf (outfile, "%d", a->dw_attr_val.v.val_int);
fprintf (outfile, "%ld", a->dw_attr_val.v.val_int);
break;
case dw_val_class_unsigned_const:
fprintf (outfile, "%u", a->dw_attr_val.v.val_unsigned);
fprintf (outfile, "%lu", a->dw_attr_val.v.val_unsigned);
break;
case dw_val_class_long_long:
fprintf (outfile, "constant (%u,%u)",
fprintf (outfile, "constant (%lu,%lu)",
a->dw_attr_val.v.val_long_long.hi,
a->dw_attr_val.v.val_long_long.low);
break;
@ -4215,7 +4224,7 @@ print_die (die, outfile)
break;
case dw_val_class_die_ref:
if (a->dw_attr_val.v.val_die_ref != NULL)
fprintf (outfile, "die -> %u",
fprintf (outfile, "die -> %lu",
a->dw_attr_val.v.val_die_ref->die_offset);
else
fprintf (outfile, "die -> <null>");
@ -4265,7 +4274,7 @@ print_dwarf_line_table (outfile)
line_info = &line_info_table[i];
fprintf (outfile, "%5d: ", i);
fprintf (outfile, "%-20s", file_table[line_info->dw_file_num]);
fprintf (outfile, "%6d", line_info->dw_line_num);
fprintf (outfile, "%6ld", line_info->dw_line_num);
fprintf (outfile, "\n");
}
@ -5139,7 +5148,7 @@ output_die (die)
output_uleb128 (die->die_abbrev);
if (flag_debug_asm)
fprintf (asm_out_file, " (DIE (0x%x) %s)",
fprintf (asm_out_file, " (DIE (0x%lx) %s)",
die->die_offset, dwarf_tag_name (die->die_tag));
fputc ('\n', asm_out_file);
@ -5325,7 +5334,7 @@ output_die (die)
/* Add null byte to terminate sibling list. */
ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s end of children of DIE 0x%x",
fprintf (asm_out_file, "\t%s end of children of DIE 0x%lx",
ASM_COMMENT_START, die->die_offset);
fputc ('\n', asm_out_file);
@ -5679,7 +5688,7 @@ output_line_info ()
if (flag_debug_asm)
{
ASM_OUTPUT_DWARF_STRING (asm_out_file, file_table[ft_index]);
fprintf (asm_out_file, "%s File Entry: 0x%x",
fprintf (asm_out_file, "%s File Entry: 0x%lx",
ASM_COMMENT_START, ft_index);
}
else
@ -5802,7 +5811,7 @@ output_line_info ()
DWARF_LINE_OPCODE_BASE + line_delta);
if (flag_debug_asm)
fprintf (asm_out_file,
"\t%s line %d", ASM_COMMENT_START, current_line);
"\t%s line %ld", ASM_COMMENT_START, current_line);
fputc ('\n', asm_out_file);
}
@ -5812,7 +5821,7 @@ output_line_info ()
on the value being encoded. */
ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_advance_line);
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s advance to line %d",
fprintf (asm_out_file, "\t%s advance to line %ld",
ASM_COMMENT_START, current_line);
fputc ('\n', asm_out_file);
@ -5953,7 +5962,7 @@ output_line_info ()
DWARF_LINE_OPCODE_BASE + line_delta);
if (flag_debug_asm)
fprintf (asm_out_file,
"\t%s line %d", ASM_COMMENT_START, current_line);
"\t%s line %ld", ASM_COMMENT_START, current_line);
fputc ('\n', asm_out_file);
}
@ -5961,7 +5970,7 @@ output_line_info ()
{
ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_advance_line);
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s advance to line %d",
fprintf (asm_out_file, "\t%s advance to line %ld",
ASM_COMMENT_START, current_line);
fputc ('\n', asm_out_file);
@ -7223,7 +7232,8 @@ add_subscript_info (type_die, type)
/* We have an array type with an unspecified length. The DWARF-2
spec does not say how to handle this; let's just leave out the
bounds. */
;
{;}
#ifndef MIPS_DEBUGGING_INFO
}
@ -8005,7 +8015,6 @@ gen_subprogram_die (decl, context_die)
char label_id[MAX_ARTIFICIAL_LABEL_BYTES];
register tree origin = decl_ultimate_origin (decl);
register dw_die_ref subr_die;
register dw_loc_descr_ref fp_loc = NULL;
register rtx fp_reg;
register tree fn_arg_types;
register tree outer_scope;