1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Modify SCM_UNPACK type check to avoid warnings in clang.

* libguile/tags.h (SCM_UNPACK): Change (*(SCM*)0=(x)) to
  (*(volatile SCM *)0=(x)), to avoid null-dereference warnings
  from clang.  Reported by Shane Celis <shane.celis@gmail.com>.
This commit is contained in:
Mark H Weaver 2013-07-18 14:10:43 -04:00
parent fe51c7b3e0
commit 824b9ad8b7

View file

@ -87,14 +87,15 @@ typedef union SCM { struct { scm_t_bits n; } n; } SCM;
The 0?: constructions makes sure that the code is never executed,
and that there is no performance hit. However, the alternative is
compiled, and does generate a warning when used with the wrong
pointer type.
pointer type. We use a volatile pointer type to avoid warnings
from clang.
The Tru64 and ia64-hp-hpux11.23 compilers fail on `case (0?0=0:x)'
statements, so for them type-checking is disabled. */
#if defined __DECC || defined __HP_cc
# define SCM_UNPACK(x) ((scm_t_bits) (x))
#else
# define SCM_UNPACK(x) ((scm_t_bits) (0? (*(SCM*)0=(x)): x))
# define SCM_UNPACK(x) ((scm_t_bits) (0? (*(volatile SCM *)0=(x)): x))
#endif
/*