[vlc-commits] threads: forbid the use of vlc_cleanup_push/pop in portable C++ code
Steve Lhomme
git at videolan.org
Tue Feb 11 11:08:49 CET 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Feb 11 08:44:44 2020 +0100| [65457e5ed8a42ffe707414274efd1501629bbe66] | committer: Steve Lhomme
threads: forbid the use of vlc_cleanup_push/pop in portable C++ code
It may work for some C++ code only used on Linux. But if the module is compiled
on other platforms it will assert.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=65457e5ed8a42ffe707414274efd1501629bbe66
---
include/vlc_threads.h | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/include/vlc_threads.h b/include/vlc_threads.h
index 0e27ea803f..1b3cb278e4 100644
--- a/include/vlc_threads.h
+++ b/include/vlc_threads.h
@@ -1084,12 +1084,10 @@ struct vlc_cleanup_t
vlc_control_cancel (NULL); \
} while (0)
# else
-/* Those macros do not work in C++. However common C/C++ helpers may call them
- * anyway - this is fine if the code is never cancelled in C++ case.
- * So define the macros to do nothing.
- */
-# define vlc_cleanup_push(routine, arg) do { (routine, arg)
-# define vlc_cleanup_pop() } while (0)
+# define vlc_cleanup_push(routine, arg) \
+ static_assert(false, "don't use vlc_cleanup_push in portable C++ code")
+# define vlc_cleanup_pop() \
+ static_assert(false, "don't use vlc_cleanup_pop in portable C++ code")
# endif
#endif /* !LIBVLC_USE_PTHREAD_CLEANUP */
More information about the vlc-commits
mailing list