From 7804b5af1f14c0f35977543a637cf5ff7c285fec Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 22 Sep 2015 06:48:22 -0700 Subject: C++ upkeep: cannot assign to volatile sigset_t. This is a hack for an ugly problem. A plain old struct is actually a class in C++, and assignment to a struct goes thorugh a generated assignment operator. Unfortunately, C++ doesn't generate an assignment operator for volatile destinations, so assignment to a volatile-qualified struct object is erroneous. * signal.h (copy_sigset): New inline function to copy a sigset_t, even if the left hand side is volatile. This works by stripping the qualifier. (sig_save_enable): Use the function. --- signal.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'signal.h') diff --git a/signal.h b/signal.h index 09caddbb..9dc076cd 100644 --- a/signal.h +++ b/signal.h @@ -42,6 +42,15 @@ extern int debug_depth; #if HAVE_POSIX_SIGS +INLINE void copy_sigset(volatile sigset_t *dest, const sigset_t *src) +{ +#ifdef __cplusplus + *strip_qual(sigset_t *, dest) = *src; +#else + *dest = *src; +#endif +} + #define sig_save_enable \ do { \ int sig_save = async_sig_enabled; \ @@ -104,7 +113,8 @@ typedef struct { (EJB).de = dyn_env, \ (EJB).gc = gc_enabled, \ (EJB).gc_pt = gc_prot_top, \ - (EJB).blocked = sig_blocked_cache, \ + copy_sigset(&(EJB).blocked, \ + &sig_blocked_cache), \ EJ_OPT_SAVE(EJB) \ 0)) -- cgit v1.2.3