This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug bootstrap/16645] [3.5 Regression] dbxout.c:1693: warning: format '%d' expects type 'int', but argument 3 has type 'size_t'
- From: "nathan at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Jul 2004 17:02:03 -0000
- Subject: [Bug bootstrap/16645] [3.5 Regression] dbxout.c:1693: warning: format '%d' expects type 'int', but argument 3 has type 'size_t'
- References: <20040720151844.16645.danglin@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From nathan at codesourcery dot com 2004-07-20 17:02 -------
Subject: Re: [3.5 Regression] dbxout.c:1693: warning:
format '%d' expects type 'int', but argument 3 has type 'size_t'
dave at hiauly1 dot hia dot nrc dot ca wrote:
> stage1/xgcc -Bstage1/ -B/opt/gnu/gcc/gcc-3.5.0/hppa2.0w-hp-hpux11.11/bin/ -c -
> g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototyp
> es -pedantic -Wno-long-long -Wno-variadic-macros -Wold-style-definition -Werror
> -fno-common -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../
> ../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libba
> nshee/libcompat -I../../gcc/gcc/../libbanshee -I../../gcc/gcc/../libbanshee/poin
> ts-to -I/opt/gnu/include ../../gcc/gcc/dbxout.c -o dbxout.o
> ../../gcc/gcc/dbxout.c: In function `dbxout_type':
> ../../gcc/gcc/dbxout.c:1693: warning: format '%u' expects type 'unsigned int', b
> ut argument 3 has type 'size_t'
> make[2]: *** [dbxout.o] Error 1
Can you try this patch, and let me know if it fixes these 64bit issues?
nathan
Index: vec.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/vec.h,v
retrieving revision 2.12
diff -c -3 -p -r2.12 vec.h
*** vec.h 19 Jul 2004 15:45:39 -0000 2.12
--- vec.h 20 Jul 2004 16:59:11 -0000
*************** Software Foundation, 59 Temple Place - S
*** 111,117 ****
(by taking its address), this is noted in the descriptions. */
/* Length of vector
! size_t VEC_T_length(const VEC(T) *v);
Return the number of active elements in V. V can be NULL, in which
case zero is returned. */
--- 111,117 ----
(by taking its address), this is noted in the descriptions. */
/* Length of vector
! unsigned VEC_T_length(const VEC(T) *v);
Return the number of active elements in V. V can be NULL, in which
case zero is returned. */
*************** Software Foundation, 59 Temple Place - S
*** 127,134 ****
#define VEC_last(TDEF,V) (VEC_OP(TDEF,last)(V VEC_CHECK_INFO))
/* Index into vector
! T VEC_T_index(VEC(T) *v, size_t ix); // Pointer
! T *VEC_T_index(VEC(T) *v, size_t ix); // Object
Return the IX'th element. If IX is outside the domain of V,
abort. */
--- 127,134 ----
#define VEC_last(TDEF,V) (VEC_OP(TDEF,last)(V VEC_CHECK_INFO))
/* Index into vector
! T VEC_T_index(VEC(T) *v, unsigned ix); // Pointer
! T *VEC_T_index(VEC(T) *v, unsigned ix); // Object
Return the IX'th element. If IX is outside the domain of V,
abort. */
*************** Software Foundation, 59 Temple Place - S
*** 136,143 ****
#define VEC_index(TDEF,V,I) (VEC_OP(TDEF,index)(V,I VEC_CHECK_INFO))
/* Iterate over vector
! int VEC_T_index(VEC(T) *v, size_t ix, T &ptr); // Pointer
! int VEC_T_index(VEC(T) *v, size_t ix, T *&ptr); // Object
Return iteration condition and update PTR to point to the IX'th
element. At the end of iteration, sets PTR to NULL. Use this to
--- 136,143 ----
#define VEC_index(TDEF,V,I) (VEC_OP(TDEF,index)(V,I VEC_CHECK_INFO))
/* Iterate over vector
! int VEC_T_index(VEC(T) *v, unsigned ix, T &ptr); // Pointer
! int VEC_T_index(VEC(T) *v, unsigned ix, T *&ptr); // Object
Return iteration condition and update PTR to point to the IX'th
element. At the end of iteration, sets PTR to NULL. Use this to
*************** Software Foundation, 59 Temple Place - S
*** 226,232 ****
#define VEC_pop(TDEF,V) (VEC_OP(TDEF,pop)(V VEC_CHECK_INFO))
/* Truncate to specific length
! void VEC_T_truncate (VEC(T) *v, size_t len);
Set the length as specified. This is an O(1) operation. */
--- 226,232 ----
#define VEC_pop(TDEF,V) (VEC_OP(TDEF,pop)(V VEC_CHECK_INFO))
/* Truncate to specific length
! void VEC_T_truncate (VEC(T) *v, unsigned len);
Set the length as specified. This is an O(1) operation. */
*************** Software Foundation, 59 Temple Place - S
*** 234,241 ****
(VEC_OP(TDEF,truncate)(V,I VEC_CHECK_INFO))
/* Replace element
! T VEC_T_replace (VEC(T) *v, size_t ix, T val); // Pointer
! T *VEC_T_replace (VEC(T) *v, size_t ix, T *val); // Object
Replace the IXth element of V with a new value, VAL. For pointer
vectors returns the original value. For object vectors returns a
--- 234,241 ----
(VEC_OP(TDEF,truncate)(V,I VEC_CHECK_INFO))
/* Replace element
! T VEC_T_replace (VEC(T) *v, unsigned ix, T val); // Pointer
! T *VEC_T_replace (VEC(T) *v, unsigned ix, T *val); // Object
Replace the IXth element of V with a new value, VAL. For pointer
vectors returns the original value. For object vectors returns a
*************** Software Foundation, 59 Temple Place - S
*** 247,254 ****
(VEC_OP(TDEF,replace)(V,I,O VEC_CHECK_INFO))
/* Insert object with no reallocation
! T *VEC_T_quick_insert (VEC(T) *v, size_t ix, T val); // Pointer
! T *VEC_T_quick_insert (VEC(T) *v, size_t ix, T *val); // Object
Insert an element, VAL, at the IXth position of V. Return a pointer
to the slot created. For vectors of object, the new value can be
--- 247,254 ----
(VEC_OP(TDEF,replace)(V,I,O VEC_CHECK_INFO))
/* Insert object with no reallocation
! T *VEC_T_quick_insert (VEC(T) *v, unsigned ix, T val); // Pointer
! T *VEC_T_quick_insert (VEC(T) *v, unsigned ix, T *val); // Object
Insert an element, VAL, at the IXth position of V. Return a pointer
to the slot created. For vectors of object, the new value can be
*************** Software Foundation, 59 Temple Place - S
*** 259,266 ****
(VEC_OP(TDEF,quick_insert)(V,I,O VEC_CHECK_INFO))
/* Insert object with reallocation
! T *VEC_T_safe_insert (VEC(T) *&v, size_t ix, T val); // Pointer
! T *VEC_T_safe_insert (VEC(T) *&v, size_t ix, T *val); // Object
Insert an element, VAL, at the IXth position of V. Return a pointer
to the slot created. For vectors of object, the new value can be
--- 259,266 ----
(VEC_OP(TDEF,quick_insert)(V,I,O VEC_CHECK_INFO))
/* Insert object with reallocation
! T *VEC_T_safe_insert (VEC(T) *&v, unsigned ix, T val); // Pointer
! T *VEC_T_safe_insert (VEC(T) *&v, unsigned ix, T *val); // Object
Insert an element, VAL, at the IXth position of V. Return a pointer
to the slot created. For vectors of object, the new value can be
*************** Software Foundation, 59 Temple Place - S
*** 271,278 ****
(VEC_OP(TDEF,safe_insert)(&(V),I,O VEC_CHECK_INFO MEM_STAT_INFO))
/* Remove element retaining order
! T VEC_T_ordered_remove (VEC(T) *v, size_t ix); // Pointer
! void VEC_T_ordered_remove (VEC(T) *v, size_t ix); // Object
Remove an element from the IXth position of V. Ordering of
remaining elements is preserverd. For pointer vectors returns the
--- 271,278 ----
(VEC_OP(TDEF,safe_insert)(&(V),I,O VEC_CHECK_INFO MEM_STAT_INFO))
/* Remove element retaining order
! T VEC_T_ordered_remove (VEC(T) *v, unsigned ix); // Pointer
! void VEC_T_ordered_remove (VEC(T) *v, unsigned ix); // Object
Remove an element from the IXth position of V. Ordering of
remaining elements is preserverd. For pointer vectors returns the
*************** Software Foundation, 59 Temple Place - S
*** 282,289 ****
(VEC_OP(TDEF,ordered_remove)(V,I VEC_CHECK_INFO))
/* Remove element destroying order
! T VEC_T_unordered_remove (VEC(T) *v, size_t ix); // Pointer
! void VEC_T_unordered_remove (VEC(T) *v, size_t ix); // Object
Remove an element from the IXth position of V. Ordering of
remaining elements is destroyed. For pointer vectors returns the
--- 282,289 ----
(VEC_OP(TDEF,ordered_remove)(V,I VEC_CHECK_INFO))
/* Remove element destroying order
! T VEC_T_unordered_remove (VEC(T) *v, unsigned ix); // Pointer
! void VEC_T_unordered_remove (VEC(T) *v, unsigned ix); // Object
Remove an element from the IXth position of V. Ordering of
remaining elements is destroyed. For pointer vectors returns the
*************** extern void vec_assert_fail (const char
*** 337,344 ****
#define VEC_TDEF(TDEF) \
typedef struct VEC (TDEF) GTY(()) \
{ \
! size_t num; \
! size_t alloc; \
TDEF GTY ((length ("%h.num"))) vec[1]; \
} VEC (TDEF)
--- 337,344 ----
#define VEC_TDEF(TDEF) \
typedef struct VEC (TDEF) GTY(()) \
{ \
! unsigned num; \
! unsigned alloc; \
TDEF GTY ((length ("%h.num"))) vec[1]; \
} VEC (TDEF)
*************** typedef struct VEC (TDEF) GTY(())
*** 350,356 ****
#define DEF_VEC_P(TDEF) \
VEC_TDEF (TDEF); \
\
! static inline size_t VEC_OP (TDEF,length) \
(const VEC (TDEF) *vec_) \
{ \
return vec_ ? vec_->num : 0; \
--- 350,356 ----
#define DEF_VEC_P(TDEF) \
VEC_TDEF (TDEF); \
\
! static inline unsigned VEC_OP (TDEF,length) \
(const VEC (TDEF) *vec_) \
{ \
return vec_ ? vec_->num : 0; \
*************** static inline TDEF VEC_OP (TDEF,last)
*** 365,371 ****
} \
\
static inline TDEF VEC_OP (TDEF,index) \
! (const VEC (TDEF) *vec_, size_t ix_ VEC_CHECK_DECL) \
{ \
VEC_ASSERT (vec_ && ix_ < vec_->num, "index", TDEF); \
\
--- 365,371 ----
} \
\
static inline TDEF VEC_OP (TDEF,index) \
! (const VEC (TDEF) *vec_, unsigned ix_ VEC_CHECK_DECL) \
{ \
VEC_ASSERT (vec_ && ix_ < vec_->num, "index", TDEF); \
\
*************** static inline TDEF VEC_OP (TDEF,index)
*** 373,379 ****
} \
\
static inline int VEC_OP (TDEF,iterate) \
! (const VEC (TDEF) *vec_, size_t ix_, TDEF *ptr) \
{ \
if (vec_ && ix_ < vec_->num) \
{ \
--- 373,379 ----
} \
\
static inline int VEC_OP (TDEF,iterate) \
! (const VEC (TDEF) *vec_, unsigned ix_, TDEF *ptr) \
{ \
if (vec_ && ix_ < vec_->num) \
{ \
*************** static inline int VEC_OP (TDEF,space)
*** 410,416 ****
(VEC (TDEF) *vec_, int alloc_) \
{ \
return vec_ ? ((vec_)->alloc - (vec_)->num \
! < (size_t)(alloc_ < 0 ? 1 : alloc_)) : alloc_ != 0; \
} \
\
static inline int VEC_OP (TDEF,reserve) \
--- 410,416 ----
(VEC (TDEF) *vec_, int alloc_) \
{ \
return vec_ ? ((vec_)->alloc - (vec_)->num \
! < (unsigned)(alloc_ < 0 ? 1 : alloc_)) : alloc_ != 0; \
} \
\
static inline int VEC_OP (TDEF,reserve) \
*************** static inline TDEF VEC_OP (TDEF,pop)
*** 456,462 ****
} \
\
static inline void VEC_OP (TDEF,truncate) \
! (VEC (TDEF) *vec_, size_t size_ VEC_CHECK_DECL) \
{ \
VEC_ASSERT (vec_ ? vec_->num >= size_ : !size_, "truncate", TDEF); \
if (vec_) \
--- 456,462 ----
} \
\
static inline void VEC_OP (TDEF,truncate) \
! (VEC (TDEF) *vec_, unsigned size_ VEC_CHECK_DECL) \
{ \
VEC_ASSERT (vec_ ? vec_->num >= size_ : !size_, "truncate", TDEF); \
if (vec_) \
*************** static inline void VEC_OP (TDEF,truncate
*** 464,470 ****
} \
\
static inline TDEF VEC_OP (TDEF,replace) \
! (VEC (TDEF) *vec_, size_t ix_, TDEF obj_ VEC_CHECK_DECL) \
{ \
TDEF old_obj_; \
\
--- 464,470 ----
} \
\
static inline TDEF VEC_OP (TDEF,replace) \
! (VEC (TDEF) *vec_, unsigned ix_, TDEF obj_ VEC_CHECK_DECL) \
{ \
TDEF old_obj_; \
\
*************** static inline TDEF VEC_OP (TDEF,replace)
*** 476,482 ****
} \
\
static inline TDEF *VEC_OP (TDEF,quick_insert) \
! (VEC (TDEF) *vec_, size_t ix_, TDEF obj_ VEC_CHECK_DECL) \
{ \
TDEF *slot_; \
\
--- 476,482 ----
} \
\
static inline TDEF *VEC_OP (TDEF,quick_insert) \
! (VEC (TDEF) *vec_, unsigned ix_, TDEF obj_ VEC_CHECK_DECL) \
{ \
TDEF *slot_; \
\
*************** static inline TDEF *VEC_OP (TDEF,quick_i
*** 490,496 ****
} \
\
static inline TDEF *VEC_OP (TDEF,safe_insert) \
! (VEC (TDEF) **vec_, size_t ix_, TDEF obj_ VEC_CHECK_DECL MEM_STAT_DECL) \
{ \
VEC_OP (TDEF,reserve) (vec_, -1 PASS_MEM_STAT); \
\
--- 490,497 ----
} \
\
static inline TDEF *VEC_OP (TDEF,safe_insert) \
! (VEC (TDEF) **vec_, unsigned ix_, TDEF obj_ \
! VEC_CHECK_DECL MEM_STAT_DECL) \
{ \
VEC_OP (TDEF,reserve) (vec_, -1 PASS_MEM_STAT); \
\
*************** static inline TDEF *VEC_OP (TDEF,safe_in
*** 498,504 ****
} \
\
static inline TDEF VEC_OP (TDEF,ordered_remove) \
! (VEC (TDEF) *vec_, size_t ix_ VEC_CHECK_DECL) \
{ \
TDEF *slot_; \
TDEF obj_; \
--- 499,505 ----
} \
\
static inline TDEF VEC_OP (TDEF,ordered_remove) \
! (VEC (TDEF) *vec_, unsigned ix_ VEC_CHECK_DECL) \
{ \
TDEF *slot_; \
TDEF obj_; \
*************** static inline TDEF VEC_OP (TDEF,ordered_
*** 512,518 ****
} \
\
static inline TDEF VEC_OP (TDEF,unordered_remove) \
! (VEC (TDEF) *vec_, size_t ix_ VEC_CHECK_DECL) \
{ \
TDEF *slot_; \
TDEF obj_; \
--- 513,519 ----
} \
\
static inline TDEF VEC_OP (TDEF,unordered_remove) \
! (VEC (TDEF) *vec_, unsigned ix_ VEC_CHECK_DECL) \
{ \
TDEF *slot_; \
TDEF obj_; \
*************** struct vec_swallow_trailing_semi
*** 542,548 ****
#define DEF_VEC_O(TDEF) \
VEC_TDEF (TDEF); \
\
! static inline size_t VEC_OP (TDEF,length) \
(const VEC (TDEF) *vec_) \
{ \
return vec_ ? vec_->num : 0; \
--- 543,549 ----
#define DEF_VEC_O(TDEF) \
VEC_TDEF (TDEF); \
\
! static inline unsigned VEC_OP (TDEF,length) \
(const VEC (TDEF) *vec_) \
{ \
return vec_ ? vec_->num : 0; \
*************** static inline TDEF *VEC_OP (TDEF,last)
*** 557,563 ****
} \
\
static inline TDEF *VEC_OP (TDEF,index) \
! (VEC (TDEF) *vec_, size_t ix_ VEC_CHECK_DECL) \
{ \
VEC_ASSERT (vec_ && ix_ < vec_->num, "index", TDEF); \
\
--- 558,564 ----
} \
\
static inline TDEF *VEC_OP (TDEF,index) \
! (VEC (TDEF) *vec_, unsigned ix_ VEC_CHECK_DECL) \
{ \
VEC_ASSERT (vec_ && ix_ < vec_->num, "index", TDEF); \
\
*************** static inline TDEF *VEC_OP (TDEF,index)
*** 565,571 ****
} \
\
static inline int VEC_OP (TDEF,iterate) \
! (VEC (TDEF) *vec_, size_t ix_, TDEF **ptr) \
{ \
if (vec_ && ix_ < vec_->num) \
{ \
--- 566,572 ----
} \
\
static inline int VEC_OP (TDEF,iterate) \
! (VEC (TDEF) *vec_, unsigned ix_, TDEF **ptr) \
{ \
if (vec_ && ix_ < vec_->num) \
{ \
*************** static inline int VEC_OP (TDEF,space)
*** 604,610 ****
(VEC (TDEF) *vec_, int alloc_) \
{ \
return vec_ ? ((vec_)->alloc - (vec_)->num \
! < (size_t)(alloc_ < 0 ? 1 : alloc_)) : alloc_ != 0; \
} \
\
static inline int VEC_OP (TDEF,reserve) \
--- 605,611 ----
(VEC (TDEF) *vec_, int alloc_) \
{ \
return vec_ ? ((vec_)->alloc - (vec_)->num \
! < (unsigned)(alloc_ < 0 ? 1 : alloc_)) : alloc_ != 0; \
} \
\
static inline int VEC_OP (TDEF,reserve) \
*************** static inline void VEC_OP (TDEF,pop)
*** 649,655 ****
} \
\
static inline void VEC_OP (TDEF,truncate) \
! (VEC (TDEF) *vec_, size_t size_ VEC_CHECK_DECL) \
{ \
VEC_ASSERT (vec_ ? vec_->num >= size_ : !size_, "truncate", TDEF); \
if (vec_) \
--- 650,656 ----
} \
\
static inline void VEC_OP (TDEF,truncate) \
! (VEC (TDEF) *vec_, unsigned size_ VEC_CHECK_DECL) \
{ \
VEC_ASSERT (vec_ ? vec_->num >= size_ : !size_, "truncate", TDEF); \
if (vec_) \
*************** static inline void VEC_OP (TDEF,truncate
*** 657,663 ****
} \
\
static inline TDEF *VEC_OP (TDEF,replace) \
! (VEC (TDEF) *vec_, size_t ix_, const TDEF *obj_ VEC_CHECK_DECL) \
{ \
TDEF *slot_; \
\
--- 658,664 ----
} \
\
static inline TDEF *VEC_OP (TDEF,replace) \
! (VEC (TDEF) *vec_, unsigned ix_, const TDEF *obj_ VEC_CHECK_DECL) \
{ \
TDEF *slot_; \
\
*************** static inline TDEF *VEC_OP (TDEF,replace
*** 670,676 ****
} \
\
static inline TDEF *VEC_OP (TDEF,quick_insert) \
! (VEC (TDEF) *vec_, size_t ix_, const TDEF *obj_ VEC_CHECK_DECL) \
{ \
TDEF *slot_; \
\
--- 671,677 ----
} \
\
static inline TDEF *VEC_OP (TDEF,quick_insert) \
! (VEC (TDEF) *vec_, unsigned ix_, const TDEF *obj_ VEC_CHECK_DECL) \
{ \
TDEF *slot_; \
\
*************** static inline TDEF *VEC_OP (TDEF,quick_i
*** 685,691 ****
} \
\
static inline TDEF *VEC_OP (TDEF,safe_insert) \
! (VEC (TDEF) **vec_, size_t ix_, const TDEF *obj_ VEC_CHECK_DECL MEM_STAT_DECL) \
{ \
VEC_OP (TDEF,reserve) (vec_, -1 PASS_MEM_STAT); \
\
--- 686,693 ----
} \
\
static inline TDEF *VEC_OP (TDEF,safe_insert) \
! (VEC (TDEF) **vec_, unsigned ix_, const TDEF *obj_ \
! VEC_CHECK_DECL MEM_STAT_DECL) \
{ \
VEC_OP (TDEF,reserve) (vec_, -1 PASS_MEM_STAT); \
\
*************** static inline TDEF *VEC_OP (TDEF,safe_in
*** 693,699 ****
} \
\
static inline void VEC_OP (TDEF,ordered_remove) \
! (VEC (TDEF) *vec_, size_t ix_ VEC_CHECK_DECL) \
{ \
TDEF *slot_; \
\
--- 695,701 ----
} \
\
static inline void VEC_OP (TDEF,ordered_remove) \
! (VEC (TDEF) *vec_, unsigned ix_ VEC_CHECK_DECL) \
{ \
TDEF *slot_; \
\
*************** static inline void VEC_OP (TDEF,ordered_
*** 703,709 ****
} \
\
static inline void VEC_OP (TDEF,unordered_remove) \
! (VEC (TDEF) *vec_, size_t ix_ VEC_CHECK_DECL) \
{ \
VEC_ASSERT (ix_ < vec_->num, "remove", TDEF); \
vec_->vec[ix_] = vec_->vec[--vec_->num]; \
--- 705,711 ----
} \
\
static inline void VEC_OP (TDEF,unordered_remove) \
! (VEC (TDEF) *vec_, unsigned ix_ VEC_CHECK_DECL) \
{ \
VEC_ASSERT (ix_ < vec_->num, "remove", TDEF); \
vec_->vec[ix_] = vec_->vec[--vec_->num]; \
Index: vec.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/vec.c,v
retrieving revision 2.5
diff -c -3 -p -r2.5 vec.c
*** vec.c 9 Jul 2004 20:58:00 -0000 2.5
--- vec.c 20 Jul 2004 16:59:11 -0000
*************** Software Foundation, 59 Temple Place - S
*** 29,36 ****
struct vec_prefix
{
! size_t num;
! size_t alloc;
void *vec[1];
};
--- 29,36 ----
struct vec_prefix
{
! unsigned num;
! unsigned alloc;
void *vec[1];
};
*************** vec_o_reserve (void *vec, int reserve, s
*** 57,63 ****
MEM_STAT_DECL)
{
struct vec_prefix *pfx = vec;
! size_t alloc = pfx ? pfx->num : 0;
if (reserve >= 0)
alloc += reserve;
--- 57,63 ----
MEM_STAT_DECL)
{
struct vec_prefix *pfx = vec;
! unsigned alloc = pfx ? pfx->num : 0;
if (reserve >= 0)
alloc += reserve;
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16645