mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-03 13:20:26 +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:
parent
fe51c7b3e0
commit
824b9ad8b7
1 changed files with 3 additions and 2 deletions
|
@ -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,
|
The 0?: constructions makes sure that the code is never executed,
|
||||||
and that there is no performance hit. However, the alternative is
|
and that there is no performance hit. However, the alternative is
|
||||||
compiled, and does generate a warning when used with the wrong
|
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)'
|
The Tru64 and ia64-hp-hpux11.23 compilers fail on `case (0?0=0:x)'
|
||||||
statements, so for them type-checking is disabled. */
|
statements, so for them type-checking is disabled. */
|
||||||
#if defined __DECC || defined __HP_cc
|
#if defined __DECC || defined __HP_cc
|
||||||
# define SCM_UNPACK(x) ((scm_t_bits) (x))
|
# define SCM_UNPACK(x) ((scm_t_bits) (x))
|
||||||
#else
|
#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
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue