Commit 218bc1f9 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Warn about ticks at compile-time

parent 9a5e5236
...@@ -68,6 +68,19 @@ VLC_EXPORT( void, mwait, ( mtime_t date ) ); ...@@ -68,6 +68,19 @@ VLC_EXPORT( void, mwait, ( mtime_t date ) );
VLC_EXPORT( void, msleep, ( mtime_t delay ) ); VLC_EXPORT( void, msleep, ( mtime_t delay ) );
VLC_EXPORT( char *, secstotimestr, ( char *psz_buffer, int secs ) ); 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 * date_t: date incrementation without long-term rounding errors
*****************************************************************************/ *****************************************************************************/
......
...@@ -363,6 +363,7 @@ void mwait( mtime_t date ) ...@@ -363,6 +363,7 @@ void mwait( mtime_t date )
#include "libvlc.h" /* vlc_backtrace() */ #include "libvlc.h" /* vlc_backtrace() */
#undef msleep
/** /**
* Portable usleep(). Cancellation point. * Portable usleep(). Cancellation point.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment