Commit 47e6be47 by Kaveh R. Ghazi Committed by Kaveh Ghazi

Warning fixes:

        * mips-tdump.c (st_to_string, sc_to_string, glevel_to_string,
        lang_to_string, type_to_string): Make return type const char*.
        (print_symbol): Apply `const' keyword to a char*.
        (print_file_desc): Cast structure member `crfd' to ulong when
        comparing against one.
        * mips-tfile.c (pfatal_with_name): Apply `const' keyword to char*.
        (fatal, error): Add ATTRIBUTE_PRINTF_1 to prototypes.
        (progname, input_name): Apply `const' keyword to a char*.
        Don't redundantly include sys/stat.h.
        (alloc_info): Apply `const' keyword to a char*.
        (st_to_string, sc_to_string): Likewise.
        (hash_string): Cast variable `hash_string' to a symint_t when
        comparing against one.
        (add_string): Cast PAGE_USIZE to Ptrdiff_t when comparing against one.
        Likewise cast it to long when comparing against one.
        (add_local_symbol): Apply `const' keyword to a char*.
        (add_ext_symbol): Likewise.
        (add_unknown_tag): Likewise.
        (add_procedure): Cast a printf-style field width to an int.
        (add_file): Cast PAGE_USIZE to long when comparing against one
        (parse_begin): Cast a printf-style field width to an int.
        (parse_bend): Likewise.
        (parse_def): Likewise.
        (parse_end): Likewise.
        (mark_stabs): Mark parameter `start' with ATTRIBUTE_UNUSED.
        (parse_stabs_common): Fix format specifier.
        (parse_input): Change type of variable `i' to Size_t.
        (write_object): Fix arguments to match format specifiers.
        Cast variable `num_write' to long when comparing against one.
        (read_seek): Cast variable `sys_read' to symint_t when comparing
        against one.  Fix arguments to match format specifiers.  Cast
        variable `size' to long when comparing against one.
        (copy_object): Cast result of `sizeof' to int when comparing
        against one.  Fix arguments to match format specifiers.  Cast
        variable `ifd' to long when comparing against a signed value.
        Likewise, likewise.

From-SVN: r24479
parent 736b02fd
Mon Jan 4 11:01:48 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* mips-tdump.c (st_to_string, sc_to_string, glevel_to_string,
lang_to_string, type_to_string): Make return type const char*.
(print_symbol): Apply `const' keyword to a char*.
(print_file_desc): Cast structure member `crfd' to ulong when
comparing against one.
* mips-tfile.c (pfatal_with_name): Apply `const' keyword to char*.
(fatal, error): Add ATTRIBUTE_PRINTF_1 to prototypes.
(progname, input_name): Apply `const' keyword to a char*.
Don't redundantly include sys/stat.h.
(alloc_info): Apply `const' keyword to a char*.
(st_to_string, sc_to_string): Likewise.
(hash_string): Cast variable `hash_string' to a symint_t when
comparing against one.
(add_string): Cast PAGE_USIZE to Ptrdiff_t when comparing against one.
Likewise cast it to long when comparing against one.
(add_local_symbol): Apply `const' keyword to a char*.
(add_ext_symbol): Likewise.
(add_unknown_tag): Likewise.
(add_procedure): Cast a printf-style field width to an int.
(add_file): Cast PAGE_USIZE to long when comparing against one
(parse_begin): Cast a printf-style field width to an int.
(parse_bend): Likewise.
(parse_def): Likewise.
(parse_end): Likewise.
(mark_stabs): Mark parameter `start' with ATTRIBUTE_UNUSED.
(parse_stabs_common): Fix format specifier.
(parse_input): Change type of variable `i' to Size_t.
(write_object): Fix arguments to match format specifiers.
Cast variable `num_write' to long when comparing against one.
(read_seek): Cast variable `sys_read' to symint_t when comparing
against one. Fix arguments to match format specifiers. Cast
variable `size' to long when comparing against one.
(copy_object): Cast result of `sizeof' to int when comparing
against one. Fix arguments to match format specifiers. Cast
variable `ifd' to long when comparing against a signed value.
Likewise, likewise.
Mon Jan 4 10:30:33 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> Mon Jan 4 10:30:33 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* c-common.c (decl_attributes): Allow applying attribute `unused' * c-common.c (decl_attributes): Allow applying attribute `unused'
......
...@@ -78,7 +78,7 @@ xmalloc (size) ...@@ -78,7 +78,7 @@ xmalloc (size)
return value; return value;
} }
/* Do to size_t being defined in sys/types.h and different /* Due to size_t being defined in sys/types.h and different
in stddef.h, we have to do this by hand..... Note, these in stddef.h, we have to do this by hand..... Note, these
types are correct for MIPS based systems, and may not be types are correct for MIPS based systems, and may not be
correct for other systems. */ correct for other systems. */
...@@ -269,11 +269,11 @@ void print_file_desc __proto((FDR *, int)); ...@@ -269,11 +269,11 @@ void print_file_desc __proto((FDR *, int));
void print_symbol __proto((SYMR *, int, char *, AUXU *, int, FDR *)); void print_symbol __proto((SYMR *, int, char *, AUXU *, int, FDR *));
void print_aux __proto((AUXU, int, int)); void print_aux __proto((AUXU, int, int));
void emit_aggregate __proto((char *, AUXU, AUXU, const char *, FDR *)); void emit_aggregate __proto((char *, AUXU, AUXU, const char *, FDR *));
char *st_to_string __proto((st_t)); const char *st_to_string __proto((st_t));
char *sc_to_string __proto((sc_t)); const char *sc_to_string __proto((sc_t));
char *glevel_to_string __proto((glevel_t)); const char *glevel_to_string __proto((glevel_t));
char *lang_to_string __proto((lang_t)); const char *lang_to_string __proto((lang_t));
char *type_to_string __proto((AUXU *, int, FDR *)); const char *type_to_string __proto((AUXU *, int, FDR *));
#ifndef __alpha #ifndef __alpha
# ifdef NEED_DECLARATION_MALLOC # ifdef NEED_DECLARATION_MALLOC
...@@ -336,7 +336,7 @@ read_seek (ptr, size, offset, context) ...@@ -336,7 +336,7 @@ read_seek (ptr, size, offset, context)
/* Convert language code to string format. */ /* Convert language code to string format. */
char * const char *
lang_to_string (lang) lang_to_string (lang)
lang_t lang; lang_t lang;
{ {
...@@ -359,7 +359,7 @@ lang_to_string (lang) ...@@ -359,7 +359,7 @@ lang_to_string (lang)
/* Convert storage class to string. */ /* Convert storage class to string. */
char * const char *
sc_to_string(storage_class) sc_to_string(storage_class)
sc_t storage_class; sc_t storage_class;
{ {
...@@ -397,7 +397,7 @@ sc_to_string(storage_class) ...@@ -397,7 +397,7 @@ sc_to_string(storage_class)
/* Convert symbol type to string. */ /* Convert symbol type to string. */
char * const char *
st_to_string(symbol_type) st_to_string(symbol_type)
st_t symbol_type; st_t symbol_type;
{ {
...@@ -438,7 +438,7 @@ st_to_string(symbol_type) ...@@ -438,7 +438,7 @@ st_to_string(symbol_type)
/* Convert debug level to string. */ /* Convert debug level to string. */
char * const char *
glevel_to_string (g_level) glevel_to_string (g_level)
glevel_t g_level; glevel_t g_level;
{ {
...@@ -456,7 +456,7 @@ glevel_to_string (g_level) ...@@ -456,7 +456,7 @@ glevel_to_string (g_level)
/* Convert the type information to string format. */ /* Convert the type information to string format. */
char * const char *
type_to_string (aux_ptr, index, fdp) type_to_string (aux_ptr, index, fdp)
AUXU *aux_ptr; AUXU *aux_ptr;
int index; int index;
...@@ -1025,7 +1025,7 @@ print_symbol (sym_ptr, number, strbase, aux_base, ifd, fdp) ...@@ -1025,7 +1025,7 @@ print_symbol (sym_ptr, number, strbase, aux_base, ifd, fdp)
scope_ptr != (scope_t *) 0; scope_ptr != (scope_t *) 0;
scope_ptr = scope_ptr->prev) scope_ptr = scope_ptr->prev)
{ {
char *class; const char *class;
if (scope_ptr->st == st_Proc || scope_ptr->st == st_StaticProc) if (scope_ptr->st == st_Proc || scope_ptr->st == st_StaticProc)
class = "func."; class = "func.";
else if (scope_ptr->st == st_File) else if (scope_ptr->st == st_File)
...@@ -1057,7 +1057,7 @@ print_symbol (sym_ptr, number, strbase, aux_base, ifd, fdp) ...@@ -1057,7 +1057,7 @@ print_symbol (sym_ptr, number, strbase, aux_base, ifd, fdp)
if (MIPS_IS_STAB(sym_ptr)) if (MIPS_IS_STAB(sym_ptr))
{ {
register int i = sizeof(stab_names) / sizeof(stab_names[0]); register int i = sizeof(stab_names) / sizeof(stab_names[0]);
char *stab_name = "stab"; const char *stab_name = "stab";
short code = MIPS_UNMARK_STAB(sym_ptr->index); short code = MIPS_UNMARK_STAB(sym_ptr->index);
while (--i >= 0) while (--i >= 0)
if (stab_names[i].code == code) if (stab_names[i].code == code)
...@@ -1275,7 +1275,7 @@ print_file_desc (fdp, number) ...@@ -1275,7 +1275,7 @@ print_file_desc (fdp, number)
(ulong) fdp->rfdBase); (ulong) fdp->rfdBase);
rfd_ptr = rfile_desc + fdp->rfdBase; rfd_ptr = rfile_desc + fdp->rfdBase;
for (i = 0; i < fdp->crfd; i++) for (i = 0; i < (ulong) fdp->crfd; i++)
{ {
printf ("\t#%-5ld %11ld, 0x%08lx\n", i, *rfd_ptr, *rfd_ptr); printf ("\t#%-5ld %11ld, 0x%08lx\n", i, *rfd_ptr, *rfd_ptr);
rfd_ptr++; rfd_ptr++;
......
...@@ -633,13 +633,13 @@ typedef const PTR_T CPTR_T; ...@@ -633,13 +633,13 @@ typedef const PTR_T CPTR_T;
so they can't be static. */ so they can't be static. */
extern void pfatal_with_name extern void pfatal_with_name
__proto((char *)); __proto((const char *));
extern void fancy_abort __proto((void)); extern void fancy_abort __proto((void));
void botch __proto((const char *)); void botch __proto((const char *));
extern void xfree __proto((PTR)); extern void xfree __proto((PTR));
extern void fatal PVPROTO((const char *format, ...)); extern void fatal PVPROTO((const char *format, ...)) ATTRIBUTE_PRINTF_1;
extern void error PVPROTO((const char *format, ...)); extern void error PVPROTO((const char *format, ...)) ATTRIBUTE_PRINTF_1;
#ifndef MIPS_DEBUGGING_INFO #ifndef MIPS_DEBUGGING_INFO
...@@ -647,8 +647,8 @@ static int line_number; ...@@ -647,8 +647,8 @@ static int line_number;
static int cur_line_start; static int cur_line_start;
static int debug; static int debug;
static int had_errors; static int had_errors;
static char *progname; static const char *progname;
static char *input_name; static const char *input_name;
int int
main () main ()
...@@ -666,7 +666,6 @@ main () ...@@ -666,7 +666,6 @@ main ()
#undef index #undef index
#include <signal.h> #include <signal.h>
#include <sys/stat.h>
#ifndef CROSS_COMPILE #ifndef CROSS_COMPILE
#include <a.out.h> #include <a.out.h>
...@@ -1158,7 +1157,7 @@ typedef union page { ...@@ -1158,7 +1157,7 @@ typedef union page {
/* Structure holding allocation information for small sized structures. */ /* Structure holding allocation information for small sized structures. */
typedef struct alloc_info { typedef struct alloc_info {
char *alloc_name; /* name of this allocation type (must be first) */ const char *alloc_name; /* name of this allocation type (must be first) */
page_t *cur_page; /* current page being allocated from */ page_t *cur_page; /* current page being allocated from */
small_free_t free_list; /* current free list if any */ small_free_t free_list; /* current free list if any */
int unallocated; /* number of elements unallocated on page */ int unallocated; /* number of elements unallocated on page */
...@@ -1555,7 +1554,7 @@ static long max_file_offset = 0; /* maximum file offset */ ...@@ -1555,7 +1554,7 @@ static long max_file_offset = 0; /* maximum file offset */
static FILE *object_stream = (FILE *) 0; /* file desc. to output .o */ static FILE *object_stream = (FILE *) 0; /* file desc. to output .o */
static FILE *obj_in_stream = (FILE *) 0; /* file desc. to input .o */ static FILE *obj_in_stream = (FILE *) 0; /* file desc. to input .o */
static char *progname = (char *) 0; /* program name for errors */ static char *progname = (char *) 0; /* program name for errors */
static char *input_name = "stdin"; /* name of input file */ static const char *input_name = "stdin"; /* name of input file */
static char *object_name = (char *) 0; /* tmp. name of object file */ static char *object_name = (char *) 0; /* tmp. name of object file */
static char *obj_in_name = (char *) 0; /* name of input object file */ static char *obj_in_name = (char *) 0; /* name of input object file */
static char *cur_line_start = (char *) 0; /* current line read in */ static char *cur_line_start = (char *) 0; /* current line read in */
...@@ -1647,8 +1646,8 @@ STATIC void update_headers __proto((void)); ...@@ -1647,8 +1646,8 @@ STATIC void update_headers __proto((void));
STATIC void write_varray __proto((varray_t *, off_t, const char *)); STATIC void write_varray __proto((varray_t *, off_t, const char *));
STATIC void write_object __proto((void)); STATIC void write_object __proto((void));
STATIC char *st_to_string __proto((st_t)); STATIC const char *st_to_string __proto((st_t));
STATIC char *sc_to_string __proto((sc_t)); STATIC const char *sc_to_string __proto((sc_t));
STATIC char *read_line __proto((void)); STATIC char *read_line __proto((void));
STATIC void parse_input __proto((void)); STATIC void parse_input __proto((void));
STATIC void mark_stabs __proto((const char *)); STATIC void mark_stabs __proto((const char *));
...@@ -1789,7 +1788,7 @@ hash_string (text, hash_len, hash_tbl, ret_hash_index) ...@@ -1789,7 +1788,7 @@ hash_string (text, hash_len, hash_tbl, ret_hash_index)
*ret_hash_index = hi; *ret_hash_index = hi;
for (ptr = hash_tbl[hi]; ptr != (shash_t *) 0; ptr = ptr->next) for (ptr = hash_tbl[hi]; ptr != (shash_t *) 0; ptr = ptr->next)
if (hash_len == ptr->len if ((symint_t) hash_len == ptr->len
&& first_ch == ptr->string[0] && first_ch == ptr->string[0]
&& memcmp ((CPTR_T) text, (CPTR_T) ptr->string, hash_len) == 0) && memcmp ((CPTR_T) text, (CPTR_T) ptr->string, hash_len) == 0)
break; break;
...@@ -1814,7 +1813,7 @@ add_string (vp, hash_tbl, start, end_p1, ret_hash) ...@@ -1814,7 +1813,7 @@ add_string (vp, hash_tbl, start, end_p1, ret_hash)
register shash_t *hash_ptr; register shash_t *hash_ptr;
symint_t hi; symint_t hi;
if (len >= PAGE_USIZE) if (len >= (Ptrdiff_t) PAGE_USIZE)
fatal ("String too big (%ld bytes)", (long) len); fatal ("String too big (%ld bytes)", (long) len);
hash_ptr = hash_string (start, len, hash_tbl, &hi); hash_ptr = hash_string (start, len, hash_tbl, &hi);
...@@ -1822,7 +1821,7 @@ add_string (vp, hash_tbl, start, end_p1, ret_hash) ...@@ -1822,7 +1821,7 @@ add_string (vp, hash_tbl, start, end_p1, ret_hash)
{ {
register char *p; register char *p;
if (vp->objects_last_page + len >= PAGE_USIZE) if (vp->objects_last_page + len >= (long) PAGE_USIZE)
{ {
vp->num_allocated vp->num_allocated
= ((vp->num_allocated + PAGE_USIZE - 1) / PAGE_USIZE) * PAGE_USIZE; = ((vp->num_allocated + PAGE_USIZE - 1) / PAGE_USIZE) * PAGE_USIZE;
...@@ -2009,8 +2008,8 @@ add_local_symbol (str_start, str_end_p1, type, storage, value, indx) ...@@ -2009,8 +2008,8 @@ add_local_symbol (str_start, str_end_p1, type, storage, value, indx)
&& (debug > 2 || type == st_Block || type == st_End && (debug > 2 || type == st_Block || type == st_End
|| type == st_Proc || type == st_StaticProc)) || type == st_Proc || type == st_StaticProc))
{ {
char *sc_str = sc_to_string (storage); const char *sc_str = sc_to_string (storage);
char *st_str = st_to_string (type); const char *st_str = st_to_string (type);
int depth = cur_file_ptr->nested_scopes + (scope_delta < 0); int depth = cur_file_ptr->nested_scopes + (scope_delta < 0);
fprintf (stderr, fprintf (stderr,
...@@ -2049,8 +2048,8 @@ add_ext_symbol (str_start, str_end_p1, type, storage, value, indx, ifd) ...@@ -2049,8 +2048,8 @@ add_ext_symbol (str_start, str_end_p1, type, storage, value, indx, ifd)
if (debug > 1) if (debug > 1)
{ {
char *sc_str = sc_to_string (storage); const char *sc_str = sc_to_string (storage);
char *st_str = st_to_string (type); const char *st_str = st_to_string (type);
fprintf (stderr, fprintf (stderr,
"\tesym\tv= %10ld, ifd= %2d, sc= %-12s", "\tesym\tv= %10ld, ifd= %2d, sc= %-12s",
...@@ -2358,7 +2357,7 @@ add_unknown_tag (ptag) ...@@ -2358,7 +2357,7 @@ add_unknown_tag (ptag)
if (debug > 1) if (debug > 1)
{ {
char *agg_type = "{unknown aggregate type}"; const char *agg_type = "{unknown aggregate type}";
switch (ptag->basic_type) switch (ptag->basic_type)
{ {
case bt_Struct: agg_type = "struct"; break; case bt_Struct: agg_type = "struct"; break;
...@@ -2452,7 +2451,8 @@ add_procedure (func_start, func_end_p1) ...@@ -2452,7 +2451,8 @@ add_procedure (func_start, func_end_p1)
} }
if (cur_oproc_ptr == (PDR *) 0) if (cur_oproc_ptr == (PDR *) 0)
error ("Did not find a PDR block for %.*s", func_end_p1 - func_start, func_start); error ("Did not find a PDR block for %.*s",
(int) (func_end_p1 - func_start), func_start);
/* Determine the start of symbols. */ /* Determine the start of symbols. */
new_proc_ptr->isym = file_ptr->symbols.num_allocated; new_proc_ptr->isym = file_ptr->symbols.num_allocated;
...@@ -2519,7 +2519,7 @@ add_file (file_start, file_end_p1) ...@@ -2519,7 +2519,7 @@ add_file (file_start, file_end_p1)
&zero_bytes[0], &zero_bytes[0],
(shash_t **) 0); (shash_t **) 0);
if (file_end_p1 - file_start > PAGE_USIZE-2) if (file_end_p1 - file_start > (long) PAGE_USIZE-2)
fatal ("Filename goes over one page boundary."); fatal ("Filename goes over one page boundary.");
/* Push the start of the filename. We assume that the filename /* Push the start of the filename. We assume that the filename
...@@ -2588,7 +2588,7 @@ add_bytes (vp, input_ptr, nitems) ...@@ -2588,7 +2588,7 @@ add_bytes (vp, input_ptr, nitems)
/* Convert storage class to string. */ /* Convert storage class to string. */
STATIC char * STATIC const char *
sc_to_string(storage_class) sc_to_string(storage_class)
sc_t storage_class; sc_t storage_class;
{ {
...@@ -2626,7 +2626,7 @@ sc_to_string(storage_class) ...@@ -2626,7 +2626,7 @@ sc_to_string(storage_class)
/* Convert symbol type to string. */ /* Convert symbol type to string. */
STATIC char * STATIC const char *
st_to_string(symbol_type) st_to_string(symbol_type)
st_t symbol_type; st_t symbol_type;
{ {
...@@ -2769,13 +2769,15 @@ parse_begin (start) ...@@ -2769,13 +2769,15 @@ parse_begin (start)
if (hash_ptr == (shash_t *) 0) if (hash_ptr == (shash_t *) 0)
{ {
error ("Label %.*s not found for #.begin", end_p1 - start, start); error ("Label %.*s not found for #.begin",
(int) (end_p1 - start), start);
return; return;
} }
if (cur_oproc_begin == (SYMR *) 0) if (cur_oproc_begin == (SYMR *) 0)
{ {
error ("Procedure table %.*s not found for #.begin", end_p1 - start, start); error ("Procedure table %.*s not found for #.begin",
(int) (end_p1 - start), start);
return; return;
} }
...@@ -2819,13 +2821,14 @@ parse_bend (start) ...@@ -2819,13 +2821,14 @@ parse_bend (start)
if (hash_ptr == (shash_t *) 0) if (hash_ptr == (shash_t *) 0)
{ {
error ("Label %.*s not found for #.bend", end_p1 - start, start); error ("Label %.*s not found for #.bend", (int) (end_p1 - start), start);
return; return;
} }
if (cur_oproc_begin == (SYMR *) 0) if (cur_oproc_begin == (SYMR *) 0)
{ {
error ("Procedure table %.*s not found for #.bend", end_p1 - start, start); error ("Procedure table %.*s not found for #.bend",
(int) (end_p1 - start), start);
return; return;
} }
...@@ -3281,7 +3284,7 @@ parse_def (name_start) ...@@ -3281,7 +3284,7 @@ parse_def (name_start)
if (tag_start == (char *) 0) if (tag_start == (char *) 0)
{ {
error ("No tag specified for %.*s", error ("No tag specified for %.*s",
name_end_p1 - name_start, (int) (name_end_p1 - name_start),
name_start); name_start);
return; return;
} }
...@@ -3471,7 +3474,8 @@ parse_end (start) ...@@ -3471,7 +3474,8 @@ parse_end (start)
value = cur_oproc_end->value; value = cur_oproc_end->value;
else else
error ("Cannot find .end block for %.*s", end_func_p1 - start_func, start_func); error ("Cannot find .end block for %.*s",
(int) (end_func_p1 - start_func), start_func);
(void) add_local_symbol (start_func, end_func_p1, (void) add_local_symbol (start_func, end_func_p1,
st_End, sc_Text, st_End, sc_Text,
...@@ -3552,7 +3556,7 @@ parse_file (start) ...@@ -3552,7 +3556,7 @@ parse_file (start)
static void static void
mark_stabs (start) mark_stabs (start)
const char *start; /* Start of directive (ignored) */ const char *start ATTRIBUTE_UNUSED; /* Start of directive (ignored) */
{ {
if (!stabs_seen) if (!stabs_seen)
{ {
...@@ -3650,7 +3654,7 @@ parse_stabs_common (string_start, string_end, rest) ...@@ -3650,7 +3654,7 @@ parse_stabs_common (string_start, string_end, rest)
dummy_symr.index = code; dummy_symr.index = code;
if (dummy_symr.index != code) if (dummy_symr.index != code)
{ {
error ("Line number (%d) for .stabs/.stabn directive cannot fit in index field (20 bits)", error ("Line number (%lu) for .stabs/.stabn directive cannot fit in index field (20 bits)",
code); code);
return; return;
...@@ -3825,7 +3829,7 @@ STATIC void ...@@ -3825,7 +3829,7 @@ STATIC void
parse_input __proto((void)) parse_input __proto((void))
{ {
register char *p; register char *p;
register int i; register Size_t i;
register thead_t *ptag_head; register thead_t *ptag_head;
register tag_t *ptag; register tag_t *ptag;
register tag_t *ptag_next; register tag_t *ptag_next;
...@@ -4142,7 +4146,7 @@ write_object __proto((void)) ...@@ -4142,7 +4146,7 @@ write_object __proto((void))
else if (sys_write != sizeof (symbolic_header)) else if (sys_write != sizeof (symbolic_header))
fatal ("Wrote %d bytes to %s, system returned %d", fatal ("Wrote %d bytes to %s, system returned %d",
sizeof (symbolic_header), (int) sizeof (symbolic_header),
object_name, object_name,
sys_write); sys_write);
...@@ -4175,8 +4179,8 @@ write_object __proto((void)) ...@@ -4175,8 +4179,8 @@ write_object __proto((void))
pfatal_with_name (object_name); pfatal_with_name (object_name);
else if (sys_write != symbolic_header.cbLine) else if (sys_write != symbolic_header.cbLine)
fatal ("Wrote %d bytes to %s, system returned %d", fatal ("Wrote %ld bytes to %s, system returned %ld",
symbolic_header.cbLine, (long) symbolic_header.cbLine,
object_name, object_name,
sys_write); sys_write);
...@@ -4210,7 +4214,7 @@ write_object __proto((void)) ...@@ -4210,7 +4214,7 @@ write_object __proto((void))
pfatal_with_name (object_name); pfatal_with_name (object_name);
else if (sys_write != num_write) else if (sys_write != num_write)
fatal ("Wrote %d bytes to %s, system returned %d", fatal ("Wrote %ld bytes to %s, system returned %ld",
num_write, num_write,
object_name, object_name,
sys_write); sys_write);
...@@ -4303,7 +4307,7 @@ write_object __proto((void)) ...@@ -4303,7 +4307,7 @@ write_object __proto((void))
else if (sys_write != sizeof (FDR)) else if (sys_write != sizeof (FDR))
fatal ("Wrote %d bytes to %s, system returned %d", fatal ("Wrote %d bytes to %s, system returned %d",
sizeof (FDR), (int) sizeof (FDR),
object_name, object_name,
sys_write); sys_write);
...@@ -4337,8 +4341,8 @@ write_object __proto((void)) ...@@ -4337,8 +4341,8 @@ write_object __proto((void))
if (sys_write <= 0) if (sys_write <= 0)
pfatal_with_name (object_name); pfatal_with_name (object_name);
else if (sys_write != num_write) else if (sys_write != (long)num_write)
fatal ("Wrote %d bytes to %s, system returned %d", fatal ("Wrote %lu bytes to %s, system returned %ld",
num_write, num_write,
object_name, object_name,
sys_write); sys_write);
...@@ -4393,9 +4397,9 @@ read_seek (size, offset, str) ...@@ -4393,9 +4397,9 @@ read_seek (size, offset, str)
if (sys_read <= 0) if (sys_read <= 0)
pfatal_with_name (obj_in_name); pfatal_with_name (obj_in_name);
if (sys_read != difference) if ((symint_t)sys_read != difference)
fatal ("Wanted to read %d bytes from %s, system returned %d", fatal ("Wanted to read %lu bytes from %s, system returned %ld",
size, (unsigned long) size,
obj_in_name, obj_in_name,
sys_read); sys_read);
} }
...@@ -4407,9 +4411,9 @@ read_seek (size, offset, str) ...@@ -4407,9 +4411,9 @@ read_seek (size, offset, str)
if (sys_read <= 0) if (sys_read <= 0)
pfatal_with_name (obj_in_name); pfatal_with_name (obj_in_name);
if (sys_read != size) if (sys_read != (long) size)
fatal ("Wanted to read %d bytes from %s, system returned %d", fatal ("Wanted to read %lu bytes from %s, system returned %ld",
size, (unsigned long) size,
obj_in_name, obj_in_name,
sys_read); sys_read);
...@@ -4457,16 +4461,16 @@ copy_object __proto((void)) ...@@ -4457,16 +4461,16 @@ copy_object __proto((void))
else if (sys_read == 0 && feof (obj_in_stream)) else if (sys_read == 0 && feof (obj_in_stream))
return; /* create a .T file sans file header */ return; /* create a .T file sans file header */
else if (sys_read < sizeof (struct filehdr)) else if (sys_read < (int) sizeof (struct filehdr))
fatal ("Wanted to read %d bytes from %s, system returned %d", fatal ("Wanted to read %d bytes from %s, system returned %d",
sizeof (struct filehdr), (int) sizeof (struct filehdr),
obj_in_name, obj_in_name,
sys_read); sys_read);
if (orig_file_header.f_nsyms != sizeof (HDRR)) if (orig_file_header.f_nsyms != sizeof (HDRR))
fatal ("%s symbolic header wrong size (%d bytes, should be %d)", fatal ("%s symbolic header wrong size (%d bytes, should be %d)",
input_name, orig_file_header.f_nsyms, sizeof (HDRR)); input_name, orig_file_header.f_nsyms, (int) sizeof (HDRR));
/* Read in the current symbolic header. */ /* Read in the current symbolic header. */
...@@ -4481,9 +4485,9 @@ copy_object __proto((void)) ...@@ -4481,9 +4485,9 @@ copy_object __proto((void))
if (sys_read < 0) if (sys_read < 0)
pfatal_with_name (object_name); pfatal_with_name (object_name);
else if (sys_read < sizeof (struct filehdr)) else if (sys_read < (int) sizeof (struct filehdr))
fatal ("Wanted to read %d bytes from %s, system returned %d", fatal ("Wanted to read %d bytes from %s, system returned %d",
sizeof (struct filehdr), (int) sizeof (struct filehdr),
obj_in_name, obj_in_name,
sys_read); sys_read);
...@@ -4622,7 +4626,7 @@ copy_object __proto((void)) ...@@ -4622,7 +4626,7 @@ copy_object __proto((void))
(sc_t) eptr->asym.sc, (sc_t) eptr->asym.sc,
eptr->asym.value, eptr->asym.value,
(symint_t) ((eptr->asym.index == indexNil) ? indexNil : 0), (symint_t) ((eptr->asym.index == indexNil) ? indexNil : 0),
(ifd < orig_sym_hdr.ifdMax) ? remap_file_number[ ifd ] : ifd); ((long) ifd < orig_sym_hdr.ifdMax) ? remap_file_number[ ifd ] : ifd);
} }
...@@ -4774,7 +4778,8 @@ copy_object __proto((void)) ...@@ -4774,7 +4778,8 @@ copy_object __proto((void))
remaining > 0; remaining > 0;
remaining -= num_write) remaining -= num_write)
{ {
num_write = (remaining <= sizeof (buffer)) ? remaining : sizeof (buffer); num_write =
(remaining <= (int) sizeof (buffer)) ? remaining : sizeof (buffer);
sys_read = fread ((PTR_T) buffer, 1, num_write, obj_in_stream); sys_read = fread ((PTR_T) buffer, 1, num_write, obj_in_stream);
if (sys_read <= 0) if (sys_read <= 0)
pfatal_with_name (obj_in_name); pfatal_with_name (obj_in_name);
...@@ -4820,13 +4825,13 @@ main (argc, argv) ...@@ -4820,13 +4825,13 @@ main (argc, argv)
#if !defined(__SABER__) && !defined(lint) #if !defined(__SABER__) && !defined(lint)
if (sizeof (efdr_t) > PAGE_USIZE) if (sizeof (efdr_t) > PAGE_USIZE)
fatal ("Efdr_t has a sizeof %d bytes, when it should be less than %d", fatal ("Efdr_t has a sizeof %d bytes, when it should be less than %d",
sizeof (efdr_t), (int) sizeof (efdr_t),
PAGE_USIZE); (int) PAGE_USIZE);
if (sizeof (page_t) != PAGE_USIZE) if (sizeof (page_t) != PAGE_USIZE)
fatal ("Page_t has a sizeof %d bytes, when it should be %d", fatal ("Page_t has a sizeof %d bytes, when it should be %d",
sizeof (page_t), (int) sizeof (page_t),
PAGE_USIZE); (int) PAGE_USIZE);
#endif #endif
...@@ -5055,7 +5060,7 @@ catch_signal (signum) ...@@ -5055,7 +5060,7 @@ catch_signal (signum)
void void
pfatal_with_name (msg) pfatal_with_name (msg)
char *msg; const char *msg;
{ {
int save_errno = errno; /* just in case.... */ int save_errno = errno; /* just in case.... */
if (line_number > 0) if (line_number > 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment