add builtin_offsetof

This commit is contained in:
christos 2017-03-06 21:02:47 +00:00
parent 23620f03df
commit 47f9cf0422
2 changed files with 5 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.14 2017/03/06 12:00:27 christos Exp $
# $NetBSD: Makefile,v 1.15 2017/03/06 21:02:47 christos Exp $
NOMAN= # defined
@ -10,6 +10,7 @@ TESTS_SH= t_integration
FILESDIR= ${TESTSDIR}
FILES+= d_alignof.c
FILES+= d_bltinoffsetof.c
FILES+= d_c99_anon_struct.c
FILES+= d_c99_anon_union.c
FILES+= d_c99_complex_num.c

View File

@ -7,6 +7,8 @@ struct foo *hole;
char *
foo(void)
{
return ((char *)&((typeof(hole))0)->list);
return hole ?
((char *)&((typeof(hole))0)->list) :
((char *)&((typeof(*hole) *)0)->list);
}