summaryrefslogtreecommitdiff
path: root/libguile/tags.h
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2013-07-18 14:10:43 -0400
committerMark H Weaver <mhw@netris.org>2013-07-18 14:23:32 -0400
commit824b9ad8b792ab42c5cc614d66462dfaab489075 (patch)
treec0868cc8a2c1ce39c6923a5937bcac8a00b8d75f /libguile/tags.h
parentfe51c7b3e0a1e93be3bb81dd2d4b18936fe2df3a (diff)
downloadguile-824b9ad8b792ab42c5cc614d66462dfaab489075.tar.gz
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>.
Diffstat (limited to 'libguile/tags.h')
-rw-r--r--libguile/tags.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/libguile/tags.h b/libguile/tags.h
index a3032bfa9..c41543ffd 100644
--- a/libguile/tags.h
+++ b/libguile/tags.h
@@ -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
/*