Fix various compilation warnings for gcc-4.2.

Approved by:	re (bruce)
This commit is contained in:
Matt Jacob 2007-06-23 00:02:20 +00:00
parent e67b204a4a
commit 2a9a64c6a2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=170996
10 changed files with 17 additions and 28 deletions

View File

@ -202,7 +202,7 @@ static __inline void sym_que_splice(struct sym_quehead *list,
}
#define sym_que_entry(ptr, type, member) \
((type *)((char *)(ptr)-(unsigned int)(&((type *)0)->member)))
((type *)((char *)(ptr)-(size_t)(&((type *)0)->member)))
#define sym_insque(new, pos) __sym_que_add(new, pos, (pos)->flink)

View File

@ -2612,7 +2612,7 @@ atm_cm_timeout(tip)
* Back-off to cvc control block
*/
cvp = (Atm_connvc *)
((caddr_t)tip - (int)(&((Atm_connvc *)0)->cvc_time));
((caddr_t)tip - offsetof(Atm_connvc, cvc_time));
/*
* Process timeout based on protocol state

View File

@ -82,7 +82,7 @@ ipatm_timeout(tip)
* Back-off to ipvcc control block
*/
ivp = (struct ipvcc *)
((caddr_t)tip - (int)(&((struct ipvcc *)0)->iv_time));
((caddr_t)tip - offsetof(struct ipvcc, iv_time));
/*
* Process timeout based on protocol state

View File

@ -214,7 +214,7 @@ spans_timer(tip)
* Back-off to SPANS control block
*/
spp = (struct spans *)
((caddr_t)tip - (int)(&((struct spans *)0)->sp_time));
((caddr_t)tip - offsetof(struct spans, sp_time));
ATM_DEBUG2("spans_timer: spp=%p,state=%d\n",
spp, spp->sp_state);
@ -363,8 +363,8 @@ spans_vctimer(tip)
/*
* Get VCCB and SPANS control block addresses
*/
svp = (struct spans_vccb *) ((caddr_t)tip -
(int)(&((struct vccb *)0)->vc_time));
svp = (struct spans_vccb *)
((caddr_t)tip - offsetof(struct vccb, vc_time));
spp = (struct spans *)svp->sv_pif->pif_siginst;
ATM_DEBUG3("spans_vctimer: svp=%p, sstate=%d, ustate=%d\n",

View File

@ -142,7 +142,7 @@ sscf_uni_lower(cmd, tok, arg1, arg2)
uvp->uv_lstate = UVL_IDLE;
STACK_CALL(SSCOP_INIT, uvp->uv_lower, uvp->uv_tokl, cvp,
(int)vers, (int)&sscf_uni_sscop_parms, err);
(int)vers, (size_t)&sscf_uni_sscop_parms, err);
if (err) {
/*
* Should never happen

View File

@ -776,7 +776,7 @@ uniarp_iftimeout(tip)
* Back-off to uniip control block
*/
uip = (struct uniip *)
((caddr_t)tip - (int)(&((struct uniip *)0)->uip_arptime));
((caddr_t)tip - offsetof(struct uniip, uip_arptime));
ATM_DEBUG2("uniarp_iftimeout: uip=%p, state=%d\n", uip,
uip->uip_arpstate);

View File

@ -90,7 +90,7 @@ uniarp_timeout(tip)
* Back-off to uniarp control block
*/
uap = (struct uniarp *)
((caddr_t)tip - (int)(&((struct uniarp *)0)->ua_time));
((caddr_t)tip - offsetof(struct uniarp, ua_time));
uip = uap->ua_intf;

View File

@ -58,19 +58,8 @@ struct ie_ent {
(struct usfmt *, struct ie_generic *);
};
/*
* Macro to give the offset of a field in a generic IE structure
*/
#define IE_OFFSET(f) \
((int)&((struct ie_generic *) 0)->f)
/*
* Macro to give the size of a field in a generic IE structure
*/
#define IE_FSIZE(f) \
(sizeof(((struct ie_generic *) 0)->f))
#define IE_OFF_SIZE(f) IE_OFFSET(f),IE_FSIZE(f)
#define IE_OFF_SIZE(f) \
offsetof(struct ie_generic, f), (sizeof(((struct ie_generic *) 0)->f))
/*

View File

@ -88,7 +88,7 @@ unisig_timer(tip)
* Back-off to UNISIG control block
*/
usp = (struct unisig *)
((caddr_t)tip - (int)(&((struct unisig *)0)->us_time));
((caddr_t)tip - offsetof(struct unisig, us_time));
ATM_DEBUG2("unisig_timer: usp=%p,state=%d\n",
usp, usp->us_state);
@ -127,8 +127,8 @@ unisig_vctimer(tip)
/*
* Get VCCB and UNISIG control block addresses
*/
uvp = (struct unisig_vccb *) ((caddr_t)tip -
(int)(&((struct vccb *)0)->vc_time));
uvp = (struct unisig_vccb *)
((caddr_t)tip - offsetof(struct vccb, vc_time));
usp = (struct unisig *)uvp->uv_pif->pif_siginst;
ATM_DEBUG3("unisig_vctimer: uvp=%p, sstate=%d, ustate=%d\n",

View File

@ -84,9 +84,9 @@ struct int64_temp {
};
#define INT8_ALIGNMENT 1
#define INT16_ALIGNMENT ((int)&((struct int16_temp *)0)->y)
#define INT32_ALIGNMENT ((int)&((struct int32_temp *)0)->y)
#define INT64_ALIGNMENT ((int)&((struct int64_temp *)0)->y)
#define INT16_ALIGNMENT ((size_t)&((struct int16_temp *)0)->y)
#define INT32_ALIGNMENT ((size_t)&((struct int32_temp *)0)->y)
#define INT64_ALIGNMENT ((size_t)&((struct int64_temp *)0)->y)
/* Output format for integral types */
#define INT_UNSIGNED 0