public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] nptl: __libc_cleanup_push/__libc_cleanup_pop require -fexceptions
@ 2021-03-02 10:58 Florian Weimer
0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2021-03-02 10:58 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e81402f246f53072aa799bfee101bf02d561a8c1
commit e81402f246f53072aa799bfee101bf02d561a8c1
Author: Florian Weimer <fweimer@redhat.com>
Date: Tue Mar 2 10:49:03 2021 +0100
nptl: __libc_cleanup_push/__libc_cleanup_pop require -fexceptions
Do not define these macros if they do nothing in a particular
compilation, otherwise they can easily be used accidentally, while
not actually achieving anything.
Diff:
---
sysdeps/nptl/libc-lockP.h | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/sysdeps/nptl/libc-lockP.h b/sysdeps/nptl/libc-lockP.h
index 0f74d783fe..4a0b96e6d9 100644
--- a/sysdeps/nptl/libc-lockP.h
+++ b/sysdeps/nptl/libc-lockP.h
@@ -271,6 +271,9 @@ extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer
} else if (DOIT) \
_buffer.__routine (_buffer.__arg)
+/* __libc_cleanup_push and __libc_cleanup_pop depend on exception
+ handling and stack unwinding. */
+#ifdef __EXCEPTIONS
/* Normal cleanup handling, based on C cleanup attribute. */
__extern_inline void
@@ -280,17 +283,17 @@ __libc_cleanup_routine (struct __pthread_cleanup_frame *f)
f->__cancel_routine (f->__cancel_arg);
}
-#define __libc_cleanup_push(fct, arg) \
+# define __libc_cleanup_push(fct, arg) \
do { \
struct __pthread_cleanup_frame __clframe \
__attribute__ ((__cleanup__ (__libc_cleanup_routine))) \
= { .__cancel_routine = (fct), .__cancel_arg = (arg), \
.__do_it = 1 };
-#define __libc_cleanup_pop(execute) \
+# define __libc_cleanup_pop(execute) \
__clframe.__do_it = (execute); \
} while (0)
-
+#endif /* __EXCEPTIONS */
/* Create thread-specific key. */
#define __libc_key_create(KEY, DESTRUCTOR) \
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-03-02 10:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-02 10:58 [glibc] nptl: __libc_cleanup_push/__libc_cleanup_pop require -fexceptions Florian Weimer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).