silence cast-align warnings from clang on powerpc64

silence the following warning when compiling libthr with clang 8
for powerpc64 architecture:

usr/src/lib/libthr/arch/powerpc/include/pthread_md.h:82:10: error:
cast from 'uint8_t *' (aka 'unsigned char *') to 'struct tcb *'
increases required alignment from 1 to 8 [-Werror,-Wcast-align]
82:  return ((struct tcb *)(_tp - TP_OFFSET));

Submitted by:	alfredo.junior_eldorado.org.br
Reviewed by:	git_bdragon.rtk0.net, emaste, kib, jhibbits, luporl
Differential Revision:	https://reviews.freebsd.org/D18807
This commit is contained in:
luporl 2019-02-13 18:28:53 +00:00
parent ad0bb33a89
commit 58767665dc

View File

@ -72,14 +72,15 @@ _tcb_set(struct tcb *tcb)
static __inline struct tcb *
_tcb_get(void)
{
register uint8_t *_tp;
register struct tcb *tcb;
#ifdef __powerpc64__
__asm __volatile("mr %0,13" : "=r"(_tp));
__asm __volatile("addi %0,13,%1" : "=r"(tcb) : "i"(-TP_OFFSET));
#else
__asm __volatile("mr %0,2" : "=r"(_tp));
__asm __volatile("addi %0,2,%1" : "=r"(tcb) : "i"(-TP_OFFSET));
#endif
return ((struct tcb *)(_tp - TP_OFFSET));
return (tcb);
}
static __inline struct pthread *