diff --git a/libiberty/configure.ac b/libiberty/configure.ac index 3380819..716664a 100644 --- a/libiberty/configure.ac +++ b/libiberty/configure.ac @@ -272,8 +272,10 @@ AC_HEADER_TIME libiberty_AC_DECLARE_ERRNO -# Determine the size of an int for struct fibnode. +# Determine the size of an int for struct fibnode and both int and size_t +# for obstack.h. AC_CHECK_SIZEOF([int]) +AC_CHECK_SIZEOF([size_t]) # Look for a 64-bit type. AC_MSG_CHECKING([for a 64-bit type]) diff --git a/libiberty/obstacks.texi b/libiberty/obstacks.texi index adcd810..5cab523 100644 --- a/libiberty/obstacks.texi +++ b/libiberty/obstacks.texi @@ -168,7 +168,7 @@ The most direct way to allocate an object in an obstack is with @comment obstack.h @comment GNU -@deftypefun {void *} obstack_alloc (struct obstack *@var{obstack-ptr}, int @var{size}) +@deftypefun {void *} obstack_alloc (struct obstack *@var{obstack-ptr}, size_t @var{size}) This allocates an uninitialized block of @var{size} bytes in an obstack and returns its address. Here @var{obstack-ptr} specifies which obstack to allocate the block in; it is the address of the @code{struct obstack} @@ -202,7 +202,7 @@ To allocate a block with specified contents, use the function @comment obstack.h @comment GNU -@deftypefun {void *} obstack_copy (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size}) +@deftypefun {void *} obstack_copy (struct obstack *@var{obstack-ptr}, void *@var{address}, size_t @var{size}) This allocates a block and initializes it by copying @var{size} bytes of data starting at @var{address}. It calls @code{obstack_alloc_failed_handler} if allocation of memory by @@ -211,7 +211,7 @@ bytes of data starting at @var{address}. It calls @comment obstack.h @comment GNU -@deftypefun {void *} obstack_copy0 (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size}) +@deftypefun {void *} obstack_copy0 (struct obstack *@var{obstack-ptr}, void *@var{address}, size_t @var{size}) Like @code{obstack_copy}, but appends an extra byte containing a null character. This extra byte is not counted in the argument @var{size}. @end deftypefun @@ -222,7 +222,7 @@ example of its use: @smallexample char * -obstack_savestring (char *addr, int size) +obstack_savestring (char *addr, size_t size) @{ return obstack_copy0 (&myobstack, addr, size); @} @@ -347,14 +347,14 @@ already added to the growing object will become part of the other object. @comment obstack.h @comment GNU -@deftypefun void obstack_blank (struct obstack *@var{obstack-ptr}, int @var{size}) +@deftypefun void obstack_blank (struct obstack *@var{obstack-ptr}, size_t @var{size}) The most basic function for adding to a growing object is @code{obstack_blank}, which adds space without initializing it. @end deftypefun @comment obstack.h @comment GNU -@deftypefun void obstack_grow (struct obstack *@var{obstack-ptr}, void *@var{data}, int @var{size}) +@deftypefun void obstack_grow (struct obstack *@var{obstack-ptr}, void *@var{data}, size_t @var{size}) To add a block of initialized space, use @code{obstack_grow}, which is the growing-object analogue of @code{obstack_copy}. It adds @var{size} bytes of data to the growing object, copying the contents from @@ -363,7 +363,7 @@ bytes of data to the growing object, copying the contents from @comment obstack.h @comment GNU -@deftypefun void obstack_grow0 (struct obstack *@var{obstack-ptr}, void *@var{data}, int @var{size}) +@deftypefun void obstack_grow0 (struct obstack *@var{obstack-ptr}, void *@var{data}, size_t @var{size}) This is the growing-object analogue of @code{obstack_copy0}. It adds @var{size} bytes copied from @var{data}, followed by an additional null character. @@ -413,7 +413,7 @@ declared as follows: @comment obstack.h @comment GNU -@deftypefun int obstack_object_size (struct obstack *@var{obstack-ptr}) +@deftypefun size_t obstack_object_size (struct obstack *@var{obstack-ptr}) This function returns the current size of the growing object, in bytes. Remember to call this function @emph{before} finishing the object. After it is finished, @code{obstack_object_size} will return zero. @@ -456,7 +456,7 @@ in the current chunk. It is declared as follows: @comment obstack.h @comment GNU -@deftypefun int obstack_room (struct obstack *@var{obstack-ptr}) +@deftypefun size_t obstack_room (struct obstack *@var{obstack-ptr}) This returns the number of bytes that can be added safely to the current growing object (or to an object about to be started) in obstack @var{obstack} using the fast growth functions. @@ -490,7 +490,7 @@ containing the value of @var{data} to the growing object in obstack @comment obstack.h @comment GNU -@deftypefun void obstack_blank_fast (struct obstack *@var{obstack-ptr}, int @var{size}) +@deftypefun void obstack_blank_fast (struct obstack *@var{obstack-ptr}, size_t @var{size}) The function @code{obstack_blank_fast} adds @var{size} bytes to the growing object in obstack @var{obstack-ptr} without initializing them. @end deftypefun @@ -511,11 +511,11 @@ Here is an example: @smallexample @group void -add_string (struct obstack *obstack, const char *ptr, int len) +add_string (struct obstack *obstack, const char *ptr, size_t len) @{ while (len > 0) @{ - int room = obstack_room (obstack); + size_t room = obstack_room (obstack); if (room == 0) @{ /* @r{Not enough room. Add one character slowly,} @@ -570,7 +570,7 @@ returns the same value as @code{obstack_base}. @comment obstack.h @comment GNU -@deftypefun int obstack_object_size (struct obstack *@var{obstack-ptr}) +@deftypefun size_t obstack_object_size (struct obstack *@var{obstack-ptr}) This function returns the size in bytes of the currently growing object. This is equivalent to @@ -661,7 +661,7 @@ not to waste too much memory in the portion of the last chunk not yet used. @comment obstack.h @comment GNU -@deftypefn Macro int obstack_chunk_size (struct obstack *@var{obstack-ptr}) +@deftypefn Macro size_t obstack_chunk_size (struct obstack *@var{obstack-ptr}) This returns the chunk size of the given obstack. @end deftypefn @@ -689,15 +689,15 @@ argument. @item void obstack_init (struct obstack *@var{obstack-ptr}) Initialize use of an obstack. @xref{Creating Obstacks}. -@item void *obstack_alloc (struct obstack *@var{obstack-ptr}, int @var{size}) +@item void *obstack_alloc (struct obstack *@var{obstack-ptr}, size_t @var{size}) Allocate an object of @var{size} uninitialized bytes. @xref{Allocation in an Obstack}. -@item void *obstack_copy (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size}) +@item void *obstack_copy (struct obstack *@var{obstack-ptr}, void *@var{address}, size_t @var{size}) Allocate an object of @var{size} bytes, with contents copied from @var{address}. @xref{Allocation in an Obstack}. -@item void *obstack_copy0 (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size}) +@item void *obstack_copy0 (struct obstack *@var{obstack-ptr}, void *@var{address}, size_t @var{size}) Allocate an object of @var{size}+1 bytes, with @var{size} of them copied from @var{address}, followed by a null character at the end. @xref{Allocation in an Obstack}. @@ -706,15 +706,15 @@ from @var{address}, followed by a null character at the end. Free @var{object} (and everything allocated in the specified obstack more recently than @var{object}). @xref{Freeing Obstack Objects}. -@item void obstack_blank (struct obstack *@var{obstack-ptr}, int @var{size}) +@item void obstack_blank (struct obstack *@var{obstack-ptr}, size_t @var{size}) Add @var{size} uninitialized bytes to a growing object. @xref{Growing Objects}. -@item void obstack_grow (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size}) +@item void obstack_grow (struct obstack *@var{obstack-ptr}, void *@var{address}, size_t @var{size}) Add @var{size} bytes, copied from @var{address}, to a growing object. @xref{Growing Objects}. -@item void obstack_grow0 (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size}) +@item void obstack_grow0 (struct obstack *@var{obstack-ptr}, void *@var{address}, size_t @var{size}) Add @var{size} bytes, copied from @var{address}, to a growing object, and then add another byte containing a null character. @xref{Growing Objects}. @@ -727,11 +727,11 @@ Add one byte containing @var{data-char} to a growing object. Finalize the object that is growing and return its permanent address. @xref{Growing Objects}. -@item int obstack_object_size (struct obstack *@var{obstack-ptr}) +@item size_t obstack_object_size (struct obstack *@var{obstack-ptr}) Get the current size of the currently growing object. @xref{Growing Objects}. -@item void obstack_blank_fast (struct obstack *@var{obstack-ptr}, int @var{size}) +@item void obstack_blank_fast (struct obstack *@var{obstack-ptr}, size_t @var{size}) Add @var{size} uninitialized bytes to a growing object without checking that there is enough room. @xref{Extra Fast Growing}. @@ -739,7 +739,7 @@ that there is enough room. @xref{Extra Fast Growing}. Add one byte containing @var{data-char} to a growing object without checking that there is enough room. @xref{Extra Fast Growing}. -@item int obstack_room (struct obstack *@var{obstack-ptr}) +@item size_t obstack_room (struct obstack *@var{obstack-ptr}) Get the amount of room now available for growing the current object. @xref{Extra Fast Growing}. @@ -747,7 +747,7 @@ Get the amount of room now available for growing the current object. The mask used for aligning the beginning of an object. This is an lvalue. @xref{Obstacks Data Alignment}. -@item int obstack_chunk_size (struct obstack *@var{obstack-ptr}) +@item size_t obstack_chunk_size (struct obstack *@var{obstack-ptr}) The size for allocating chunks. This is an lvalue. @xref{Obstack Chunks}. @item void *obstack_base (struct obstack *@var{obstack-ptr}) diff --git a/binutils/configure.ac b/binutils/configure.ac index ff0d4dc..8a2b04c 100644 --- a/binutils/configure.ac +++ b/binutils/configure.ac @@ -186,6 +186,10 @@ fi AC_CHECK_DECLS([environ, fprintf, getc_unlocked, getenv, sbrk, snprintf, stpcpy, strnlen, strstr, vsnprintf]) +# Determine the size of int and size_t for obstack.h. +AC_CHECK_SIZEOF([int]) +AC_CHECK_SIZEOF([size_t]) + # Link in zlib if we can. This allows us to read compressed debug # sections. This is used only by readelf.c (objdump uses bfd for # reading compressed sections). diff --git a/gas/config/bfin-parse.y b/gas/config/bfin-parse.y index fe742ad..435beea 100644 --- a/gas/config/bfin-parse.y +++ b/gas/config/bfin-parse.y @@ -20,7 +20,6 @@ %{ #include "as.h" -#include #include "bfin-aux.h" /* Opcode generating auxiliaries. */ #include "libbfd.h" diff --git a/gas/config/obj-aout.c b/gas/config/obj-aout.c index 28369c0..93ea904 100644 --- a/gas/config/obj-aout.c +++ b/gas/config/obj-aout.c @@ -23,7 +23,6 @@ #include "as.h" #undef NO_RELOC #include "aout/aout64.h" -#include "obstack.h" void obj_aout_frob_symbol (symbolS *sym, int *punt ATTRIBUTE_UNUSED) diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c index 79c8f88..4e7b9b7 100644 --- a/gas/config/obj-coff.c +++ b/gas/config/obj-coff.c @@ -22,7 +22,6 @@ #include "as.h" #include "safe-ctype.h" -#include "obstack.h" #include "subsegs.h" #include "struc-symbol.h" diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index e59f27b..e2ef99e 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -266,7 +266,7 @@ elf_file_symbol (const char *s, int appfile) || (symbol_rootP->bsym->flags & BSF_FILE) == 0) { symbolS *sym; - unsigned int name_length; + size_t name_length; sym = symbol_new (s, absolute_section, 0, NULL); symbol_set_frag (sym, &zero_address_frag); diff --git a/gas/config/obj-som.c b/gas/config/obj-som.c index 47acab8..55a9b6a 100644 --- a/gas/config/obj-som.c +++ b/gas/config/obj-som.c @@ -24,7 +24,6 @@ #include "as.h" #include "subsegs.h" #include "aout/stab_gnu.h" -#include "obstack.h" static int version_seen = 0; static int copyright_seen = 0; diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index c7ace79..0a65b9d 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -1681,7 +1681,7 @@ symbol_locate (symbolS * symbolP, valueT valu, /* Symbol value. */ fragS * frag) /* Associated fragment. */ { - unsigned int name_length; + size_t name_length; char *preserved_copy_of_name; name_length = strlen (name) + 1; /* +1 for \0. */ diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 2f13238..fd3910b 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -3379,7 +3379,7 @@ symbol_locate (symbolS * symbolP, valueT valu, /* Symbol value. */ fragS * frag) /* Associated fragment. */ { - unsigned int name_length; + size_t name_length; char * preserved_copy_of_name; name_length = strlen (name) + 1; /* +1 for \0. */ diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c index 8366cbf..447a477 100644 --- a/gas/config/tc-bfin.c +++ b/gas/config/tc-bfin.c @@ -948,7 +948,7 @@ int ninsns; int count_insns; static void * -allocate (int n) +allocate (size_t n) { return obstack_alloc (&mempool, n); } diff --git a/gas/config/tc-i960.c b/gas/config/tc-i960.c index 7595e1d..91469eb 100644 --- a/gas/config/tc-i960.c +++ b/gas/config/tc-i960.c @@ -64,7 +64,6 @@ #include "as.h" #include "safe-ctype.h" -#include "obstack.h" #include "opcode/i960.h" diff --git a/gas/config/tc-mmix.c b/gas/config/tc-mmix.c index 7740ee2..82f48ae 100644 --- a/gas/config/tc-mmix.c +++ b/gas/config/tc-mmix.c @@ -3007,7 +3007,7 @@ mmix_handle_mmixal (void) it the same alignment and address as the associated instruction. */ /* Make room for the label including the ending nul. */ - int len_0 = s - label + 1; + size_t len_0 = s - label + 1; /* Save this label on the MMIX symbol obstack. Saving it on an obstack is needless for "IS"-pseudos, but it's harmless and we diff --git a/gas/config/tc-rl78.c b/gas/config/tc-rl78.c index 0cd7e5b..f2382b7 100644 --- a/gas/config/tc-rl78.c +++ b/gas/config/tc-rl78.c @@ -20,7 +20,6 @@ #include "as.h" #include "struc-symbol.h" -#include "obstack.h" #include "safe-ctype.h" #include "dwarf2dbg.h" #include "libbfd.h" diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c index c4842f9..0d7e1d5 100644 --- a/gas/config/tc-rx.c +++ b/gas/config/tc-rx.c @@ -20,7 +20,6 @@ #include "as.h" #include "struc-symbol.h" -#include "obstack.h" #include "safe-ctype.h" #include "dwarf2dbg.h" #include "libbfd.h" diff --git a/gas/config/tc-score.c b/gas/config/tc-score.c index e8c8b6d..72597a0 100644 --- a/gas/config/tc-score.c +++ b/gas/config/tc-score.c @@ -6315,7 +6315,7 @@ s3_build_score_ops_hsh (void) for (i = 0; i < sizeof (s3_score_insns) / sizeof (struct s3_asm_opcode); i++) { const struct s3_asm_opcode *insn = s3_score_insns + i; - unsigned len = strlen (insn->template_name); + size_t len = strlen (insn->template_name); struct s3_asm_opcode *new_opcode; char *template_name; new_opcode = (struct s3_asm_opcode *) @@ -6344,7 +6344,7 @@ s3_build_dependency_insn_hsh (void) for (i = 0; i < sizeof (s3_insn_to_dependency_table) / sizeof (s3_insn_to_dependency_table[0]); i++) { const struct s3_insn_to_dependency *tmp = s3_insn_to_dependency_table + i; - unsigned len = strlen (tmp->insn_name); + size_t len = strlen (tmp->insn_name); struct s3_insn_to_dependency *new_i2n; new_i2n = (struct s3_insn_to_dependency *) diff --git a/gas/config/tc-score7.c b/gas/config/tc-score7.c index 7bf0ad6..ae15a04 100644 --- a/gas/config/tc-score7.c +++ b/gas/config/tc-score7.c @@ -5090,7 +5090,7 @@ s7_build_score_ops_hsh (void) for (i = 0; i < sizeof (s7_score_insns) / sizeof (struct s7_asm_opcode); i++) { const struct s7_asm_opcode *insn = s7_score_insns + i; - unsigned len = strlen (insn->template_name); + size_t len = strlen (insn->template_name); struct s7_asm_opcode *new_opcode; char *template_name; new_opcode = (struct s7_asm_opcode *) @@ -5119,7 +5119,7 @@ s7_build_dependency_insn_hsh (void) for (i = 0; i < ARRAY_SIZE (s7_insn_to_dependency_table); i++) { const struct s7_insn_to_dependency *tmp = s7_insn_to_dependency_table + i; - unsigned len = strlen (tmp->insn_name); + size_t len = strlen (tmp->insn_name); struct s7_insn_to_dependency *new_i2d; new_i2d = (struct s7_insn_to_dependency *) diff --git a/gas/config/tc-tic4x.c b/gas/config/tc-tic4x.c index 7559ad5..904a68c 100644 --- a/gas/config/tc-tic4x.c +++ b/gas/config/tc-tic4x.c @@ -43,7 +43,6 @@ #include "safe-ctype.h" #include "opcode/tic4x.h" #include "subsegs.h" -#include "obstack.h" /* OK, we accept a syntax similar to the other well known C30 assembly tools. With TIC4X_ALT_SYNTAX defined we are more diff --git a/gas/configure.ac b/gas/configure.ac index cc4fc54..5a93d82 100644 --- a/gas/configure.ac +++ b/gas/configure.ac @@ -735,6 +735,10 @@ dnl AC_C_CONST AC_FUNC_ALLOCA AC_C_INLINE +# Determine the size of int and size_t for obstack.h. +AC_CHECK_SIZEOF([int]) +AC_CHECK_SIZEOF([size_t]) + # VMS doesn't have unlink. AC_CHECK_FUNCS(unlink remove, break) AC_CHECK_FUNCS(sbrk setlocale) diff --git a/gas/expr.c b/gas/expr.c index b39c70d..eb7255f 100644 --- a/gas/expr.c +++ b/gas/expr.c @@ -27,7 +27,6 @@ #include "as.h" #include "safe-ctype.h" -#include "obstack.h" #ifdef HAVE_LIMITS_H #include diff --git a/gas/frags.c b/gas/frags.c index e14099d..defa853 100644 --- a/gas/frags.c +++ b/gas/frags.c @@ -94,12 +94,12 @@ frag_alloc (struct obstack *ob) do not return. Do not set up any fields of *now_frag. */ void -frag_grow (unsigned int nchars) +frag_grow (size_t nchars) { if (obstack_room (&frchain_now->frch_obstack) < nchars) { - long oldc; - long newc; + size_t oldc; + size_t newc; /* Try to allocate a bit more than needed right now. But don't do this if we would waste too much memory. Especially necessary @@ -111,8 +111,8 @@ frag_grow (unsigned int nchars) newc += SIZEOF_STRUCT_FRAG; /* Check for possible overflow. */ - if (newc < 0) - as_fatal (_("can't extend frag %u chars"), nchars); + if (newc < nchars) + as_fatal (_("can't extend frag %lu chars"), (unsigned long) nchars); /* Force to allocate at least NEWC bytes, but not less than the default. */ @@ -152,7 +152,7 @@ frag_grow (unsigned int nchars) of frchain_now. */ void -frag_new (int old_frags_var_max_size +frag_new (size_t old_frags_var_max_size /* Number of chars (already allocated on obstack frags) in variable_length part of frag. */) { @@ -204,7 +204,7 @@ frag_new (int old_frags_var_max_size frag_now_growth past the new chars. */ char * -frag_more (int nchars) +frag_more (size_t nchars) { register char *retval; @@ -219,8 +219,8 @@ frag_more (int nchars) new frag. */ static void -frag_var_init (relax_stateT type, int max_chars, int var, - relax_substateT subtype, symbolS *symbol, offsetT offset, +frag_var_init (relax_stateT type, size_t max_chars, size_t var, + relax_substateT subtype, symbolS *symbol, offsetT offset, char *opcode) { frag_now->fr_var = var; @@ -250,8 +250,9 @@ frag_var_init (relax_stateT type, int max_chars, int var, to write into. */ char * -frag_var (relax_stateT type, int max_chars, int var, relax_substateT subtype, - symbolS *symbol, offsetT offset, char *opcode) +frag_var (relax_stateT type, size_t max_chars, size_t var, + relax_substateT subtype, symbolS *symbol, offsetT offset, + char *opcode) { register char *retval; @@ -267,7 +268,7 @@ frag_var (relax_stateT type, int max_chars, int var, relax_substateT subtype, No call to frag_grow is done. */ char * -frag_variant (relax_stateT type, int max_chars, int var, +frag_variant (relax_stateT type, size_t max_chars, size_t var, relax_substateT subtype, symbolS *symbol, offsetT offset, char *opcode) { @@ -291,7 +292,7 @@ frag_wane (register fragS *fragP) /* Return the number of bytes by which the current frag can be grown. */ -int +size_t frag_room (void) { return obstack_room (&frchain_now->frch_obstack); @@ -336,7 +337,7 @@ frag_align (int alignment, int fill_character, int max) void frag_align_pattern (int alignment, const char *fill_pattern, - int n_fill, int max) + size_t n_fill, int max) { char *p; diff --git a/gas/frags.h b/gas/frags.h index 2f9e1b5..bdc3c9d 100644 --- a/gas/frags.h +++ b/gas/frags.h @@ -127,27 +127,27 @@ extern void frag_append_1_char (int); void frag_init (void); fragS *frag_alloc (struct obstack *); -void frag_grow (unsigned int nchars); -char *frag_more (int nchars); +void frag_grow (size_t nchars); +char *frag_more (size_t nchars); void frag_align (int alignment, int fill_character, int max); void frag_align_pattern (int alignment, const char *fill_pattern, - int n_fill, int max); + size_t n_fill, int max); void frag_align_code (int alignment, int max); -void frag_new (int old_frags_var_max_size); +void frag_new (size_t old_frags_var_max_size); void frag_wane (fragS * fragP); -int frag_room (void); +size_t frag_room (void); char *frag_variant (relax_stateT type, - int max_chars, - int var, + size_t max_chars, + size_t var, relax_substateT subtype, symbolS * symbol, offsetT offset, char *opcode); char *frag_var (relax_stateT type, - int max_chars, - int var, + size_t max_chars, + size_t var, relax_substateT subtype, symbolS * symbol, offsetT offset, diff --git a/gas/listing.c b/gas/listing.c index 0192dd0..57425fe 100644 --- a/gas/listing.c +++ b/gas/listing.c @@ -89,7 +89,6 @@ #include "as.h" #include "filenames.h" -#include "obstack.h" #include "safe-ctype.h" #include "input-file.h" #include "subsegs.h" diff --git a/gas/symbols.c b/gas/symbols.c index 9da0468..6af8604 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -104,7 +104,7 @@ symbol_new (const char *name, segT segment, valueT valu, fragS *frag) static char * save_symbol_name (const char *name) { - unsigned int name_length; + size_t name_length; char *ret; name_length = strlen (name) + 1; /* +1 for \0. */ diff --git a/gdb/charset.c b/gdb/charset.c index 6f413a2..05d8fee 100644 --- a/gdb/charset.c +++ b/gdb/charset.c @@ -503,7 +503,7 @@ convert_between_encodings (const char *from, const char *to, old_size = obstack_object_size (output); obstack_blank (output, space_request); - outp = obstack_base (output) + old_size; + outp = (char *) obstack_base (output) + old_size; outleft = space_request; r = iconv (desc, &inp, &inleft, &outp, &outleft); diff --git a/gdb/configure.ac b/gdb/configure.ac index a2ac15f..d53506b 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -664,6 +664,10 @@ AC_SUBST(READLINE_TEXI_INCFLAG) # This is typedeffed to GDB_CORE_ADDR in jit-reader.h TARGET_PTR= +# Determine the size of int and size_t for obstack.h. +AC_CHECK_SIZEOF([int]) +AC_CHECK_SIZEOF([size_t]) + AC_CHECK_SIZEOF(unsigned long long) AC_CHECK_SIZEOF(unsigned long) AC_CHECK_SIZEOF(unsigned __int128) diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 3e1d6ed..93b95b3 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -208,8 +208,8 @@ cp_print_value_fields (struct type *type, struct type *real_type, fprintf_filtered (stream, ""); else { - int statmem_obstack_initial_size = 0; - int stat_array_obstack_initial_size = 0; + size_t statmem_obstack_initial_size = 0; + size_t stat_array_obstack_initial_size = 0; struct type *vptr_basetype = NULL; int vptr_fieldno; @@ -370,7 +370,7 @@ cp_print_value_fields (struct type *type, struct type *real_type, if (dont_print_statmem == 0) { - int obstack_final_size = + size_t obstack_final_size = obstack_object_size (&dont_print_statmem_obstack); if (obstack_final_size > statmem_obstack_initial_size) @@ -387,7 +387,7 @@ cp_print_value_fields (struct type *type, struct type *real_type, if (last_set_recurse != recurse) { - int obstack_final_size = + size_t obstack_final_size = obstack_object_size (&dont_print_stat_array_obstack); if (obstack_final_size > stat_array_obstack_initial_size) diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index e302ebb..a66cbef 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -221,7 +221,7 @@ record_text_segment_lowaddr (bfd *abfd, asection *section, void *data) static void internalize_unwinds (struct objfile *objfile, struct unwind_table_entry *table, asection *section, unsigned int entries, - unsigned int size, CORE_ADDR text_offset) + size_t size, CORE_ADDR text_offset) { /* We will read the unwind entries into temporary memory, then fill in the actual unwind table. */ @@ -320,7 +320,7 @@ static void read_unwind_info (struct objfile *objfile) { asection *unwind_sec, *stub_unwind_sec; - unsigned unwind_size, stub_unwind_size, total_size; + size_t unwind_size, stub_unwind_size, total_size; unsigned index, unwind_entries; unsigned stub_entries, total_entries; CORE_ADDR text_offset; diff --git a/gdb/jit.c b/gdb/jit.c index a1983c9..bc31c7a 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -637,7 +637,8 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) struct symtab *symtab; struct gdb_block *gdb_block_iter, *gdb_block_iter_tmp; struct block *block_iter; - int actual_nblocks, i, blockvector_size; + int actual_nblocks, i; + size_t blockvector_size; CORE_ADDR begin, end; struct blockvector *bv; @@ -650,9 +651,9 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) /* Copy over the linetable entry if one was provided. */ if (stab->linetable) { - int size = ((stab->linetable->nitems - 1) - * sizeof (struct linetable_entry) - + sizeof (struct linetable)); + size_t size = ((stab->linetable->nitems - 1) + * sizeof (struct linetable_entry) + + sizeof (struct linetable)); LINETABLE (symtab) = obstack_alloc (&objfile->objfile_obstack, size); memcpy (LINETABLE (symtab), stab->linetable, size); } diff --git a/gdb/symmisc.c b/gdb/symmisc.c index de2e166..eb606fa 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -143,9 +143,11 @@ print_objfile_statistics (void) if (OBJSTAT (objfile, sz_strtab) > 0) printf_filtered (_(" Space used by a.out string tables: %d\n"), OBJSTAT (objfile, sz_strtab)); - printf_filtered (_(" Total memory used for objfile obstack: %d\n"), + printf_filtered (_(" Total memory used for objfile obstack: %lu\n"), + (unsigned long) obstack_memory_used (&objfile->objfile_obstack)); - printf_filtered (_(" Total memory used for BFD obstack: %d\n"), + printf_filtered (_(" Total memory used for BFD obstack: %lu\n"), + (unsigned long) obstack_memory_used (&objfile->per_bfd->storage_obstack)); printf_filtered (_(" Total memory used for psymbol cache: %d\n"), bcache_memory_used (psymbol_bcache_get_bcache diff --git a/gdb/utils.c b/gdb/utils.c index 6f47cb0..f4cb9bc 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -3096,7 +3096,7 @@ gdb_sign_extend (LONGEST value, int bit) void * hashtab_obstack_allocate (void *data, size_t size, size_t count) { - unsigned int total = size * count; + size_t total = size * count; void *ptr = obstack_alloc ((struct obstack *) data, total); memset (ptr, 0, total); diff --git a/ld/configure.ac b/ld/configure.ac index c81ccfe..19ab480 100644 --- a/ld/configure.ac +++ b/ld/configure.ac @@ -267,6 +267,10 @@ else fi AC_SUBST(STRINGIFY) +# Determine the size of int and size_t for obstack.h. +AC_CHECK_SIZEOF([int]) +AC_CHECK_SIZEOF([size_t]) + # target-specific stuff: all_targets=