[vlc-devel] commit: Warn about ticks at compile-time ( Rémi Denis-Courmont )
git version control
git at videolan.org
Thu Sep 4 22:58:45 CEST 2008
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Fri Sep 5 00:01:39 2008 +0300| [218bc1f9815d90acfd1dc3ac5f2aafd7ac217838] | committer: Rémi Denis-Courmont
Warn about ticks at compile-time
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=218bc1f9815d90acfd1dc3ac5f2aafd7ac217838
---
include/vlc_mtime.h | 13 +++++++++++++
src/misc/mtime.c | 1 +
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/include/vlc_mtime.h b/include/vlc_mtime.h
index 079f791..c2ad1be 100644
--- a/include/vlc_mtime.h
+++ b/include/vlc_mtime.h
@@ -68,6 +68,19 @@ VLC_EXPORT( void, mwait, ( mtime_t date ) );
VLC_EXPORT( void, msleep, ( mtime_t delay ) );
VLC_EXPORT( char *, secstotimestr, ( char *psz_buffer, int secs ) );
+#ifdef __GNUC__
+static
+__attribute__((unused))
+__attribute__((noinline))
+__attribute__((warning("use proper event handling instead")))
+void bad_msleep( mtime_t delay )
+{
+ msleep( delay );
+}
+# define msleep( d ) \
+ ((__builtin_constant_p(d) && (d < 29000000)) ? bad_msleep(d) : msleep(d))
+#endif
+
/*****************************************************************************
* date_t: date incrementation without long-term rounding errors
*****************************************************************************/
diff --git a/src/misc/mtime.c b/src/misc/mtime.c
index 2eb81f6..5ad852a 100644
--- a/src/misc/mtime.c
+++ b/src/misc/mtime.c
@@ -363,6 +363,7 @@ void mwait( mtime_t date )
#include "libvlc.h" /* vlc_backtrace() */
+#undef msleep
/**
* Portable usleep(). Cancellation point.
More information about the vlc-devel
mailing list