gcc lint.

* as.c (main): Move a inside the #if 0 block which uses it.
	* ecoff.c (current_stabs_filename): Make const.
	* frags.h (frag_align_pattern): Declare.
	* gasp.c (new_file): Cast isp to long, and use %ld to print it.
	* config/tc-alpha.h (md_operand): Add cast to void.
	(alpha_do_align): Declare argument types.
	(tc_get_register): Declare.
	(alpha_frob_ecoff_data): Declare.
	* config/tc-alpha.c: Include <ctype.h>.
	(s_mask): Don't declare; does not exist.
	(line_comment_chars): Remove /* from descriptive comment.
	(tc_get_register): Remove unused local reg.
	(tc_gen_reloc): Don't bother to compare unsigned to zero.
	(s_base): Correct warning to actually print register number.
	(md_begin): Remove unused locals retval, lose, and i.
	(alpha_fix_adjustable): Move default case inside switch to avoid
	warning.
	(load_symbol_address): Remove unused locals reloc_addr, p, sym,
	and addend.
	(emit_byte_manip_r): Declare types for all arguments.
	(emit_extract_r, emit_insert_r, emit_mask_r): Likewise.
	(emit_sign_extend, emit_bis_r, s_proc): Likewise.
	(alpha_ip): Use sprint_value to print offsetT value.  Remove
	unused local size.  Remove unused label get_macro.
	(alpha_do_align): Make fill const.
	(md_apply_fix): Remove unused label check_zov.
This commit is contained in:
Ian Lance Taylor 1994-08-24 21:48:18 +00:00
parent 5a53b1c178
commit a2a1a548c7
6 changed files with 154 additions and 102 deletions

View File

@ -1,5 +1,32 @@
Wed Aug 24 12:46:08 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
* as.c (main): Move a inside the #if 0 block which uses it.
* ecoff.c (current_stabs_filename): Make const.
* frags.h (frag_align_pattern): Declare.
* gasp.c (new_file): Cast isp to long, and use %ld to print it.
* config/tc-alpha.h (md_operand): Add cast to void.
(alpha_do_align): Declare argument types.
(tc_get_register): Declare.
(alpha_frob_ecoff_data): Declare.
* config/tc-alpha.c: Include <ctype.h>.
(s_mask): Don't declare; does not exist.
(line_comment_chars): Remove /* from descriptive comment.
(tc_get_register): Remove unused local reg.
(tc_gen_reloc): Don't bother to compare unsigned to zero.
(s_base): Correct warning to actually print register number.
(md_begin): Remove unused locals retval, lose, and i.
(alpha_fix_adjustable): Move default case inside switch to avoid
warning.
(load_symbol_address): Remove unused locals reloc_addr, p, sym,
and addend.
(emit_byte_manip_r): Declare types for all arguments.
(emit_extract_r, emit_insert_r, emit_mask_r): Likewise.
(emit_sign_extend, emit_bis_r, s_proc): Likewise.
(alpha_ip): Use sprint_value to print offsetT value. Remove
unused local size. Remove unused label get_macro.
(alpha_do_align): Make fill const.
(md_apply_fix): Remove unused label check_zov.
* configure.in: Recognize i586 as a synonym for i[34]86.
Tue Aug 23 12:32:14 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)

View File

@ -110,7 +110,8 @@ Options:\n\
h include high-level source\n\
l include assembly\n\
n omit forms processing\n\
s include symbols\n\
s include symbols\n");
fprintf (stream, "\
-D produce assembler debugging messages\n\
-f skip whitespace and comment preprocessing\n\
--help show this message and exit\n\
@ -158,9 +159,14 @@ parse_args (pargc, pargv)
char *shortopts;
extern CONST char *md_shortopts;
/* -v takes an argument on VMS, so we don't make it a generic option.
It gets recognized as an abbreviation of -version, anyway. */
/* -v takes an argument on VMS, so we don't make it a generic option
in that case. */
#ifdef OBJ_VMS
CONST char *std_shortopts = "-JKLRWZfa::DI:o:wX";
#else
/* Normal set of short options. */
CONST char *std_shortopts = "-JKLRWZfa::DI:o:vwX";
#endif
struct option *longopts;
extern struct option md_longopts[];
@ -179,7 +185,7 @@ parse_args (pargc, pargv)
/* Construct the option lists from the standard list and the
target dependent list. */
shortopts = concat (std_shortopts, md_shortopts, (char *) NULL);
longopts = xmalloc (sizeof (std_longopts) + md_longopts_size);
longopts = (struct option *) xmalloc (sizeof (std_longopts) + md_longopts_size);
memcpy (longopts, std_longopts, sizeof (std_longopts));
memcpy ((char *) longopts + sizeof (std_longopts),
md_longopts, md_longopts_size);
@ -239,6 +245,9 @@ parse_args (pargc, pargv)
print_version_id ();
exit (0);
case 'v':
print_version_id ();
case 'J':
flag_signed_overflow_ok = 1;
break;
@ -343,13 +352,17 @@ main (argc, argv)
int argc;
char **argv;
{
char a;
int keep_it;
long start_time = get_run_time ();
#ifdef HOST_SPECIAL_INIT
HOST_SPECIAL_INIT (argc, argv);
#endif
#if 0 /* do we need any of this?? */
{
static const int sig[] = {SIGHUP, SIGINT, SIGPIPE, SIGTERM, 0};
int a;
for (a = 0; sig[a] != 0; a++)
if (signal (sig[a], SIG_IGN) != SIG_IGN)

View File

@ -54,6 +54,8 @@
* Date: Jan 1993
*/
#include <ctype.h>
#include "as.h"
#include "alpha-opcode.h"
#include "subsegs.h"
@ -87,7 +89,7 @@ static symbolS *gp;
/* We'll probably be using this relocation frequently, and we
will want to compare for it. */
static reloc_howto_type *gpdisp_hi16_howto;
static const reloc_howto_type *gpdisp_hi16_howto;
/* These are exported to ECOFF code. */
unsigned long alpha_gprmask, alpha_fprmask;
@ -108,7 +110,7 @@ extern void s_globl (), s_long (), s_short (), s_space (), cons (), s_text (),
s_data (), float_cons ();
/* Static functions, needing forward declarations. */
static void s_mask (), s_base (), s_proc (), s_alpha_set ();
static void s_base (), s_proc (), s_alpha_set ();
static void s_gprel32 (), s_rdata (), s_sdata (), s_alpha_comm ();
static int alpha_ip ();
@ -183,7 +185,7 @@ const char comment_chars[] = "#";
/* Note that input_file.c hand checks for '#' at the beginning of the
first line of the input file. This is because the compiler outputs
#NO_APP at the beginning of its output. */
/* Also note that '/*' will always start a comment */
/* Also note that C style comments are always recognized. */
const char line_comment_chars[] = "#!";
/* Chars that can be used to separate mant from exp in floating point nums */
@ -226,7 +228,6 @@ int
tc_get_register (frame)
int frame;
{
int reg;
int framereg = SP;
SKIP_WHITESPACE ();
@ -350,7 +351,7 @@ tc_gen_reloc (sec, fixp)
reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
if (fixp->fx_r_type > BFD_RELOC_UNUSED || fixp->fx_r_type < 0)
if (fixp->fx_r_type > BFD_RELOC_UNUSED)
abort ();
if (fixp->fx_r_type == BFD_RELOC_ALPHA_GPDISP_HI16)
@ -406,7 +407,7 @@ s_base ()
if (base_register < 0 || base_register > 31)
{
base_register = GP;
as_warn ("Bad base register, using $r.", base_register);
as_warn ("Bad base register, using $%d.", base_register);
}
demand_empty_rest_of_line ();
}
@ -526,7 +527,8 @@ load_insn_table (ops, size)
if (strchr (name, '/'))
{
const char *name2, *p, *q;
char *name2, *p;
const char *q;
name2 = xmalloc (strlen (name));
p = name2;
@ -559,10 +561,6 @@ load_insn_table (ops, size)
void
md_begin ()
{
const char *retval;
int lose = 0;
unsigned int i = 0;
op_hash = hash_new ();
load_insn_table (alpha_opcodes, NUMOPCODES);
@ -732,8 +730,10 @@ alpha_fix_adjustable (f)
return 0;
case BFD_RELOC_GPREL32:
return 1;
default:
return !alpha_force_relocation (f);
}
return !alpha_force_relocation (f);
/*NOTREACHED*/
}
valueT
@ -766,11 +766,7 @@ load_symbol_address (reg, insn)
static symbolS *lita_sym;
int x;
addressT reloc_addr;
valueT retval;
char *p;
symbolS *sym;
valueT addend;
if (!lita_sym)
{
@ -823,7 +819,7 @@ load_expression (reg, insn)
int reg;
struct alpha_it *insn;
{
valueT addend;
valueT addend, addendhi, addendlo;
int num_insns = 1;
if (insn->reloc[0].exp.X_add_symbol->bsym->flags & BSF_SECTION_SYM)
@ -838,22 +834,39 @@ load_expression (reg, insn)
load_symbol_address (reg, insn);
if (addend)
{
num_insns++;
{
valueT x = addend;
if ((x & ~0x7fff) != 0
&& (x & ~0x7fff) + 0x8000 != 0)
{
as_bad ("assembler not prepared to handle constants >16 bits yet");
addend = 0;
}
}
insn[1].opcode = (0x20000000 /* lda */
| (reg << SA)
| (reg << SB)
| (addend & 0xffff));
insn[1].reloc[0].code = BFD_RELOC_ALPHA_LITUSE;
insn[1].reloc[0].exp = lituse_basereg;
if ((addend & ~0x7fffffff) != 0
&& (addend & ~0x7fffffff) + 0x80000000 != 0)
{
as_bad ("assembler not prepared to handle constants >32 bits yet");
addend = 0;
}
addendlo = addend & 0xffff;
addend -= addendlo;
addendhi = addend >> 16;
if (addendlo & 0x8000)
addendhi++;
/* It appears that the BASEREG LITUSE reloc should not be used on
an LDAH instruction. */
if (addendlo)
{
insn[1].opcode = (0x20000000 /* lda */
| (reg << SA)
| (reg << SB)
| (addendlo & 0xffff));
insn[1].reloc[0].code = BFD_RELOC_ALPHA_LITUSE;
insn[1].reloc[0].exp = lituse_basereg;
num_insns++;
}
if (addendhi)
{
insn[num_insns].opcode = (0x24000000
| (reg << SA)
| (reg << SB)
| (addendhi & 0xffff));
num_insns++;
}
if (num_insns == 1)
abort ();
lituse_pending = 0;
}
return num_insns;
@ -950,6 +963,7 @@ emit_store_unal (addr_reg, addr_offset, reg)
static void
emit_byte_manip_r (op, in, mask, out, mode, which)
char *op;
int in, mask, out, mode, which;
{
char buf[90];
sprintf (buf, "%s%c%c $%d,$%d,$%d", op, mode, which, in, mask, out);
@ -958,24 +972,28 @@ emit_byte_manip_r (op, in, mask, out, mode, which)
static void
emit_extract_r (in, mask, out, mode, which)
int in, mask, out, mode, which;
{
emit_byte_manip_r ("ext", in, mask, out, mode, which);
}
static void
emit_insert_r (in, mask, out, mode, which)
int in, mask, out, mode, which;
{
emit_byte_manip_r ("ins", in, mask, out, mode, which);
}
static void
emit_mask_r (in, mask, out, mode, which)
int in, mask, out, mode, which;
{
emit_byte_manip_r ("msk", in, mask, out, mode, which);
}
static void
emit_sign_extend (reg, size)
int reg, size;
{
char buf[90];
sprintf (buf, "sll $%d,0x%x,$%d", reg, 64 - size, reg);
@ -986,6 +1004,7 @@ emit_sign_extend (reg, size)
static void
emit_bis_r (in1, in2, out)
int in1, in2, out;
{
char buf[90];
sprintf (buf, "bis $%d,$%d,$%d", in1, in2, out);
@ -1317,9 +1336,10 @@ alpha_ip (str, insns)
else if (at_ok && macro_ok)
{
/* Constant value supplied, but it's too large. */
char buf[50];
char expansion[64];
sprintf (expansion, "lda $%d,%d($%d)", AT,
insns[0].reloc[0].exp.X_add_number, ZERO);
sprint_value (buf, insns[0].reloc[0].exp.X_add_number);
sprintf (expansion, "lda $%d,%s($%d)", AT, buf, ZERO);
md_assemble (expansion);
opcode |= 0x1000 /* use reg */ | (AT << SB);
insns[0].reloc[0].code = BFD_RELOC_NONE;
@ -1331,7 +1351,7 @@ alpha_ip (str, insns)
case 'F':
{
int format, length, mode, i, size;
int format, length, mode, i;
char temp[20 /*MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT*/];
char *err;
static const char formats[4] = "FGfd";
@ -1402,7 +1422,6 @@ alpha_ip (str, insns)
/* fall through */
case 'G': /* Addressing macros: GET */
get_macro:
/* All it is missing is the expression, which is what we
will get now */
@ -1634,7 +1653,7 @@ alpha_ip (str, insns)
{
/* Pick apart name and set flags. */
char *s = pattern->name;
const char *s = pattern->name;
if (*s == 'u')
{
@ -2066,12 +2085,12 @@ Alpha options:\n\
-32addr treat addresses as 32-bit values\n\
-F lack floating point instructions support\n\
-m21064 | -m21066 | -m21164\n\
specify variant of Alpha architecture\n\
-nocpp ignored\n");
specify variant of Alpha architecture\n");
}
static void
s_proc (is_static)
int is_static;
{
/* XXXX Align to cache linesize XXXXX */
char *name;
@ -2154,7 +2173,7 @@ md_pcrel_from (fixP)
int
alpha_do_align (n, fill)
int n;
char *fill;
const char *fill;
{
if (!fill
&& (now_seg == text_section
@ -2230,7 +2249,6 @@ md_apply_fix (fixP, valueP)
*p |= value;
value >>= 5;
fixP->fx_done = 1;
check_zov:
if (value != 0)
as_bad_where (fixP->fx_file, fixP->fx_line,
"overflow in type-%d reloc", (int) fixP->fx_r_type);

View File

@ -1402,6 +1402,7 @@ static int debug = 0; /* trace functions */
static int stabs_seen = 0; /* != 0 if stabs have been seen */
static int current_file_idx;
static const char *current_stabs_filename;
/* Pseudo symbol to use when putting stabs into the symbol table. */
#ifndef STABS_SYMBOL
@ -2200,6 +2201,8 @@ add_file (file_name, indx)
listing_source_file (file_name);
#endif
current_stabs_filename = file_name;
/* If we're creating stabs, then we don't actually make a new FDR.
Instead, we just create a stabs symbol. */
if (stabs_seen)
@ -2275,7 +2278,7 @@ add_file (file_name, indx)
&cur_file_ptr->thash_head[0]);
if (generate_asm_line_stab)
{
static char itstr[] = "int:t1=r1;-2147483648;2147483647;";
static char itstr[] = "void:t1=1";
mark_stabs (0);
(void) add_ecoff_symbol (file_name, st_Nil, sc_Nil,
symbol_new ("L0\001", now_seg,
@ -4097,13 +4100,11 @@ ecoff_build_procs (backend, buf, bufend, offset)
void (* const swap_pdr_out) PARAMS ((bfd *, const PDR *, PTR))
= backend->swap_pdr_out;
char *pdr_out;
int first_fil;
long iproc;
vlinks_t *file_link;
pdr_out = *buf + offset;
first_fil = 1;
iproc = 0;
/* The procedures are stored by file. */
@ -4153,10 +4154,11 @@ ecoff_build_procs (backend, buf, bufend, offset)
S_GET_SEGMENT (adr_sym)));
if (first)
{
if (first_fil)
first_fil = 0;
else
fil_ptr->fdr.adr = adr;
/* This code used to force the adr of the very
first fdr to be 0. However, the native tools
don't do that, and I can't remember why it
used to work that way, so I took it out. */
fil_ptr->fdr.adr = adr;
first = 0;
}
proc_ptr->pdr.adr = adr - fil_ptr->fdr.adr;
@ -5116,11 +5118,18 @@ generate_ecoff_stab (what, string, type, other, desc)
static int line_label_cnt = 0;
void
ecoff_generate_asm_line_stab (lineno)
ecoff_generate_asm_line_stab (filename, lineno)
char *filename;
int lineno;
{
char *ll;
if (strcmp (current_stabs_filename, filename))
{
add_file (filename, 0);
generate_asm_line_stab = 1;
}
line_label_cnt++;
/* generate local label $LMnn */
ll = xmalloc(10);

View File

@ -31,55 +31,40 @@ extern struct obstack frags;
/* JF changed < 1 to <= 1 to avoid a race conditon */
#define FRAG_APPEND_1_CHAR(datum) \
{ \
if (obstack_room( &frags ) <= 1) {\
frag_wane (frag_now); \
frag_new (0); \
} \
obstack_1grow( &frags, datum ); \
}
if (obstack_room( &frags ) <= 1) {\
frag_wane (frag_now); \
frag_new (0); \
} \
obstack_1grow( &frags, datum ); \
}
#if __STDC__ == 1
void frag_init PARAMS ((void));
void frag_grow PARAMS ((unsigned int nchars));
char *frag_more PARAMS ((int nchars));
void frag_align PARAMS ((int alignment, int fill_character));
void frag_align_pattern PARAMS ((int alignment,
const char *fill_pattern,
int n_fill));
void frag_new PARAMS ((int old_frags_var_max_size));
void frag_wane PARAMS ((fragS * fragP));
char *frag_more (int nchars);
void frag_align (int alignment, int fill_character);
void frag_new (int old_frags_var_max_size);
void frag_wane (fragS * fragP);
char *frag_variant PARAMS ((relax_stateT type,
int max_chars,
int var,
relax_substateT subtype,
symbolS * symbol,
long offset,
char *opcode,
int pcrel_adjust,
int bsr));
char *frag_variant (relax_stateT type,
int max_chars,
int var,
relax_substateT subtype,
symbolS * symbol,
long offset,
char *opcode,
int pcrel_adjust,
int bsr);
char *frag_var (relax_stateT type,
int max_chars,
int var,
relax_substateT subtype,
symbolS * symbol,
long offset,
char *opcode);
#else /* not __STDC__ */
char *frag_more ();
char *frag_var ();
char *frag_variant ();
void frag_align ();
void frag_new ();
void frag_wane ();
#endif /* not __STDC__ */
/*
* Local Variables:
* comment-column: 0
* fill-column: 131
* End:
*/
char *frag_var PARAMS ((relax_stateT type,
int max_chars,
int var,
relax_substateT subtype,
symbolS * symbol,
long offset,
char *opcode));
/* end of frags.h */

View File

@ -3261,7 +3261,7 @@ new_file (name)
return 0;
if (isp == MAX_INCLUDES)
FATAL ((stderr, "Unreasonable include depth (%d).\n", isp));
FATAL ((stderr, "Unreasonable include depth (%ld).\n", (long) isp));
sp++;
sp->handle = newone;