[vlc-devel] [PATCH] Mark unreachable code on GCC even if NDEBUG
Rémi Denis-Courmont
remi at remlab.net
Tue Feb 17 22:19:00 CET 2015
This might suppress some warnings (and very slightly reduce code size)
when assertions are disabled. Not that I particularly like to create
VLC-specific macros.
---
include/vlc_common.h | 16 +++--
lib/event.c | 2 +-
modules/access/bluray.c | 2 +-
modules/access/dtv/en50221.c | 2 +-
modules/access/file.c | 2 +-
modules/access/http.c | 2 +-
modules/access/live555.cpp | 2 +-
modules/access/mms/mmstu.c | 2 +-
modules/access/v4l2/controls.c | 2 +-
modules/access/v4l2/demux.c | 4 +-
modules/audio_output/amem.c | 2 +-
modules/audio_output/pulse.c | 2 +-
modules/codec/cc.c | 2 +-
modules/codec/lpcm.c | 6 +-
modules/control/dbus/dbus.c | 4 +-
modules/control/motion.c | 2 +-
modules/control/motionlib.c | 2 +-
modules/control/rc.c | 2 +-
modules/gui/macosx/SPMediaKeyTap.m | 2 +-
.../gui/macosx_dialog_provider/dialogProvider.m | 4 +-
.../gui/qt4/components/playlist/playlist_item.cpp | 2 +-
.../gui/qt4/components/playlist/standardpanel.cpp | 2 +-
modules/gui/qt4/dialogs/sout.cpp | 2 +-
modules/gui/qt4/input_manager.cpp | 2 +-
modules/gui/qt4/qt4.cpp | 2 +-
modules/hw/vdpau/chroma.c | 4 +-
modules/services_discovery/podcast.c | 2 +-
modules/services_discovery/sap.c | 2 +-
modules/stream_out/rtp.c | 2 +-
modules/stream_out/rtpfmt.c | 6 +-
modules/video_filter/deinterlace/algo_phosphor.c | 2 +-
modules/video_output/caopengllayer.m | 2 +-
modules/video_output/gl.c | 2 +-
modules/video_output/ios2.m | 2 +-
modules/video_output/macosx.m | 2 +-
modules/video_output/msw/common.c | 2 +-
modules/video_output/msw/wingdi.c | 2 +-
modules/video_output/wayland/shell_surface.c | 2 +-
modules/video_output/xcb/glx.c | 2 +-
modules/video_output/xcb/xvideo.c | 2 +-
modules/video_splitter/wall.c | 2 +-
modules/visualization/glspectrum.c | 2 +-
modules/visualization/visual/visual.c | 2 +-
modules/visualization/visual/window.c | 2 +-
src/android/thread.c | 2 +-
src/audio_output/common.c | 4 +-
src/darwin/dirs.c | 2 +-
src/darwin/thread.c | 2 +-
src/input/es_out.c | 2 +-
src/input/es_out_timeshift.c | 12 ++--
src/input/stream.c | 2 +-
src/misc/events.c | 4 +-
src/misc/variables.c | 6 +-
src/missing.c | 76 +++++++++++-----------
src/network/httpd.c | 2 +-
src/posix/thread.c | 2 +-
src/posix/timer.c | 2 +-
src/stream_output/sap.c | 4 +-
src/text/strings.c | 2 +-
src/text/unicode.c | 2 +-
src/video_output/display.c | 2 +-
src/win32/dirs.c | 2 +-
62 files changed, 128 insertions(+), 120 deletions(-)
diff --git a/include/vlc_common.h b/include/vlc_common.h
index b82deda..168e154 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -112,11 +112,19 @@
/* Branch prediction */
#ifdef __GNUC__
-# define likely(p) __builtin_expect(!!(p), 1)
-# define unlikely(p) __builtin_expect(!!(p), 0)
+# define likely(p) __builtin_expect(!!(p), 1)
+# define unlikely(p) __builtin_expect(!!(p), 0)
+# define unreachable() __builtin_unreachable()
#else
-# define likely(p) (!!(p))
-# define unlikely(p) (!!(p))
+# define likely(p) (!!(p))
+# define unlikely(p) (!!(p))
+# define unreachable() ((void)0)
+#endif
+
+#ifndef NDEBUG
+# define vlc_assert_unreachable() assert(!"unreachable")
+#else
+# define vlc_assert_unreachable() unreachable()
#endif
/* Linkage */
diff --git a/lib/event.c b/lib/event.c
index 7cc17bf..2ed7c5b 100644
--- a/lib/event.c
+++ b/lib/event.c
@@ -373,7 +373,7 @@ int event_attach( libvlc_event_manager_t * p_event_manager,
free(listener);
fprintf( stderr, "This object event manager doesn't know about '%s' events",
libvlc_event_type_name(event_type) );
- assert(0);
+ vlc_assert_unreachable();
return -1;
}
diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 4a46407..0d2a5ed 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -773,7 +773,7 @@ static int onMouseEvent(vlc_object_t *p_vout, const char *psz_var, vlc_value_t o
bd_mouse_select(p_sys->bluray, now, val.coords.x, val.coords.y);
bd_user_input(p_sys->bluray, now, BD_VK_MOUSE_ACTIVATE);
} else {
- assert(0);
+ vlc_assert_unreachable();
}
return VLC_SUCCESS;
}
diff --git a/modules/access/dtv/en50221.c b/modules/access/dtv/en50221.c
index 81a3a75..2cf79df 100644
--- a/modules/access/dtv/en50221.c
+++ b/modules/access/dtv/en50221.c
@@ -2108,7 +2108,7 @@ void en50221_Poll( cam_t * p_cam )
case CA_CI:
return;
default:
- assert( 0 );
+ vlc_assert_unreachable();
}
for ( unsigned i_slot = 0; i_slot < p_cam->i_nb_slots; i_slot++ )
diff --git a/modules/access/file.c b/modules/access/file.c
index 1b5d435..fbe6fa6 100644
--- a/modules/access/file.c
+++ b/modules/access/file.c
@@ -366,7 +366,7 @@ static ssize_t StreamRead (access_t *p_access, uint8_t *p_buffer, size_t i_len)
static int NoSeek (access_t *p_access, uint64_t i_pos)
{
- /* assert(0); ?? */
+ /* vlc_assert_unreachable(); ?? */
(void) p_access; (void) i_pos;
return VLC_EGENERIC;
}
diff --git a/modules/access/http.c b/modules/access/http.c
index ee5a875..31328ab 100644
--- a/modules/access/http.c
+++ b/modules/access/http.c
@@ -429,7 +429,7 @@ connect:
break;
default:
- assert(0);
+ vlc_assert_unreachable();
}
if( p_sys->i_code == 401 )
diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
index a6f65c9..ececbaf 100644
--- a/modules/access/live555.cpp
+++ b/modules/access/live555.cpp
@@ -2107,7 +2107,7 @@ static void* TimeoutPrevention( void *p_data )
msleep (((int64_t)p_timeout->p_sys->i_timeout - 2) * CLOCK_FREQ);
}
- assert(0); /* dead code */
+ vlc_assert_unreachable(); /* dead code */
}
/*****************************************************************************
diff --git a/modules/access/mms/mmstu.c b/modules/access/mms/mmstu.c
index 6091fbd..4c0a8c2 100644
--- a/modules/access/mms/mmstu.c
+++ b/modules/access/mms/mmstu.c
@@ -1573,7 +1573,7 @@ static void *KeepAliveThread( void *p_data )
msleep( 10 * CLOCK_FREQ );
}
- assert(0);
+ vlc_assert_unreachable();
}
static void KeepAliveStart( access_t *p_access )
diff --git a/modules/access/v4l2/controls.c b/modules/access/v4l2/controls.c
index 1d2b104..def7403 100644
--- a/modules/access/v4l2/controls.c
+++ b/modules/access/v4l2/controls.c
@@ -172,7 +172,7 @@ static int ControlSetCallback (vlc_object_t *obj, const char *var,
ret = ControlSetStr (ctrl, cur.psz_string);
break;
default:
- assert (0);
+ vlc_assert_unreachable ();
}
if (ret)
diff --git a/modules/access/v4l2/demux.c b/modules/access/v4l2/demux.c
index db8bfec..833f6a6 100644
--- a/modules/access/v4l2/demux.c
+++ b/modules/access/v4l2/demux.c
@@ -631,7 +631,7 @@ static void *MmapThread (void *data)
#endif
}
- assert (0);
+ vlc_assert_unreachable ();
}
static void *ReadThread (void *data)
@@ -693,7 +693,7 @@ static void *ReadThread (void *data)
GrabVBI (demux, sys->vbi);
#endif
}
- assert (0);
+ vlc_assert_unreachable ();
}
static int DemuxControl( demux_t *demux, int query, va_list args )
diff --git a/modules/audio_output/amem.c b/modules/audio_output/amem.c
index 906954c..9e9ece6 100644
--- a/modules/audio_output/amem.c
+++ b/modules/audio_output/amem.c
@@ -224,7 +224,7 @@ static int Start (audio_output_t *aout, audio_sample_format_t *fmt)
fmt->i_physical_channels = AOUT_CHANS_7_1;
break;
default:
- assert(0);
+ vlc_assert_unreachable();
}
fmt->i_format = VLC_CODEC_S16N;
diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index 6ec2eec..5947ceb 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -430,7 +430,7 @@ static void context_cb(pa_context *ctx, pa_subscription_event_type_t type,
break;
default: /* unsubscribed facility?! */
- assert(0);
+ vlc_assert_unreachable();
}
}
diff --git a/modules/codec/cc.c b/modules/codec/cc.c
index 678f9b9..91e35ee 100644
--- a/modules/codec/cc.c
+++ b/modules/codec/cc.c
@@ -479,7 +479,7 @@ static int Eia608GetWritingScreenIndex( eia608_t *h )
return h->i_screen;
default:
/* It cannot happen, else it is a bug */
- assert( 0 );
+ vlc_assert_unreachable();
return 0;
}
}
diff --git a/modules/codec/lpcm.c b/modules/codec/lpcm.c
index a1f7825..c317e6f 100644
--- a/modules/codec/lpcm.c
+++ b/modules/codec/lpcm.c
@@ -273,7 +273,7 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
p_dec->fmt_out.i_codec = VLC_CODEC_WIDI_LPCM;
break;
default:
- assert(0);
+ vlc_assert_unreachable();
case LPCM_BD:
p_dec->fmt_out.i_codec = VLC_CODEC_BD_LPCM;
break;
@@ -451,7 +451,7 @@ static block_t *DecodeFrame( decoder_t *p_dec, block_t **pp_block )
AobExtract( p_aout_buffer, p_block, i_bits, p_aob_group );
break;
default:
- assert(0);
+ vlc_assert_unreachable();
case LPCM_BD:
BdExtract( p_aout_buffer, p_block, i_frame_length, i_channels, i_channels_padding, i_bits );
break;
@@ -575,7 +575,7 @@ static block_t *EncodeFrames( encoder_t *p_enc, block_t *p_aout_buf )
i_freq_code = 3;
break;
default:
- assert(0);
+ vlc_assert_unreachable();
}
int i_bytes_consumed = 0;
diff --git a/modules/control/dbus/dbus.c b/modules/control/dbus/dbus.c
index 43feeb5..2570ff1 100644
--- a/modules/control/dbus/dbus.c
+++ b/modules/control/dbus/dbus.c
@@ -630,7 +630,7 @@ static void ProcessEvents( intf_thread_t *p_intf,
break;
}
default:
- assert(0);
+ vlc_assert_unreachable();
}
free( p_events[i] );
}
@@ -1015,7 +1015,7 @@ static int AllCallback( vlc_object_t *p_this, const char *psz_var,
else if( !strcmp( "can-pause", psz_var ) )
info.signal = SIGNAL_CAN_PAUSE;
else
- assert(0);
+ vlc_assert_unreachable();
if( info.signal == SIGNAL_NONE )
return VLC_SUCCESS;
diff --git a/modules/control/motion.c b/modules/control/motion.c
index 80196ad..c277420 100644
--- a/modules/control/motion.c
+++ b/modules/control/motion.c
@@ -188,7 +188,7 @@ static void *RunIntf( void *data )
vlc_restorecancel( canc );
}
- assert(0);
+ vlc_assert_unreachable();
}
#undef LOW_THRESHOLD
#undef HIGH_THRESHOLD
diff --git a/modules/control/motionlib.c b/modules/control/motionlib.c
index fd13f6f..5638bb5 100644
--- a/modules/control/motionlib.c
+++ b/modules/control/motionlib.c
@@ -194,7 +194,7 @@ static int GetOrientation( motion_sensors_t *motion )
return 0;
#endif
default:
- assert( 0 );
+ vlc_assert_unreachable();
}
}
diff --git a/modules/control/rc.c b/modules/control/rc.c
index c3eb726..ca2b4a1 100644
--- a/modules/control/rc.c
+++ b/modules/control/rc.c
@@ -1540,7 +1540,7 @@ static int VideoConfig( vlc_object_t *p_this, char const *psz_cmd,
}
else
/* This case can't happen */
- assert( 0 );
+ vlc_assert_unreachable();
if( newval.psz_string && *newval.psz_string )
{
diff --git a/modules/gui/macosx/SPMediaKeyTap.m b/modules/gui/macosx/SPMediaKeyTap.m
index 3917731..9be81c7 100644
--- a/modules/gui/macosx/SPMediaKeyTap.m
+++ b/modules/gui/macosx/SPMediaKeyTap.m
@@ -220,7 +220,7 @@ static CGEventRef tapEventCallback2(CGEventTapProxy proxy, CGEventType type, CGE
}
@catch (NSException * e) {
NSLog(@"Strange CGEventType: %d: %@", type, e);
- assert(0);
+ vlc_assert_unreachable();
return event;
}
diff --git a/modules/gui/macosx_dialog_provider/dialogProvider.m b/modules/gui/macosx_dialog_provider/dialogProvider.m
index 2e78a72..db97a9b 100644
--- a/modules/gui/macosx_dialog_provider/dialogProvider.m
+++ b/modules/gui/macosx_dialog_provider/dialogProvider.m
@@ -389,7 +389,7 @@ bool checkProgressPanel (void *priv)
ret = 3;
break;
default:
- assert(0);
+ vlc_assert_unreachable();
ret = 0;
break;
}
@@ -666,7 +666,7 @@ static NSView *createControlFromWidget(extension_widget_t *widget, id self)
return spinner;
}
default:
- assert(0);
+ vlc_assert_unreachable();
return nil;
}
diff --git a/modules/gui/qt4/components/playlist/playlist_item.cpp b/modules/gui/qt4/components/playlist/playlist_item.cpp
index 1a130aa..b105810 100644
--- a/modules/gui/qt4/components/playlist/playlist_item.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_item.cpp
@@ -94,7 +94,7 @@ int PLItem::id( int type )
return i_playlist_id;
default:
case MLMEDIA_ID:
- assert( 0 );
+ vlc_assert_unreachable();
return -1;
}
}
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index eb99f1b..fa4a2ba 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -787,7 +787,7 @@ void StandardPLPanel::cycleViews()
#endif
showView( ICON_VIEW );
else
- assert( 0 );
+ vlc_assert_unreachable();
}
void StandardPLPanel::activate( const QModelIndex &index )
diff --git a/modules/gui/qt4/dialogs/sout.cpp b/modules/gui/qt4/dialogs/sout.cpp
index 596379c..8f58dc2 100644
--- a/modules/gui/qt4/dialogs/sout.cpp
+++ b/modules/gui/qt4/dialogs/sout.cpp
@@ -149,7 +149,7 @@ void SoutDialog::addDest( )
caption = "Icecast";
break;
default:
- assert(0);
+ vlc_assert_unreachable();
return;
}
diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index 62184e7..c7f4de7 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -301,7 +301,7 @@ void InputManager::customEvent( QEvent *event )
break;
default:
msg_Warn( p_intf, "This shouldn't happen: %i", i_type );
- assert(0);
+ vlc_assert_unreachable();
}
}
diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
index b6aef43..1122579 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -693,7 +693,7 @@ static int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t *cfg )
p_wnd->handle.nsobject = (void *)wid;
break;
default:
- assert(0);
+ vlc_assert_unreachable();
}
p_wnd->control = WindowControl;
diff --git a/modules/hw/vdpau/chroma.c b/modules/hw/vdpau/chroma.c
index a4df8e6..7a394f5 100644
--- a/modules/hw/vdpau/chroma.c
+++ b/modules/hw/vdpau/chroma.c
@@ -381,7 +381,7 @@ static picture_t *VideoImport(filter_t *filter, picture_t *src)
fmt.i_chroma = VLC_CODEC_VDPAU_VIDEO_444;
break;
default:
- assert(0);
+ vlc_assert_unreachable();
}
picture_t *dst = picture_NewFromFormat(&fmt);
@@ -433,7 +433,7 @@ static picture_t *VideoRender(filter_t *filter, picture_t *src)
case VDP_CHROMA_TYPE_420: fmt.i_chroma = VLC_CODEC_NV12; break;
case VDP_CHROMA_TYPE_422: fmt.i_chroma = VLC_CODEC_UYVY; break;
case VDP_CHROMA_TYPE_444: fmt.i_chroma = VLC_CODEC_NV24; break;
- default: assert(0);
+ default: vlc_assert_unreachable();
}
picture_t *pic = picture_NewFromFormat(&fmt);
diff --git a/modules/services_discovery/podcast.c b/modules/services_discovery/podcast.c
index 7e25ca0..58089ac 100644
--- a/modules/services_discovery/podcast.c
+++ b/modules/services_discovery/podcast.c
@@ -248,7 +248,7 @@ static void *Run( void *data )
vlc_restorecancel (canc);
}
vlc_cleanup_pop();
- assert(0); /* dead code */
+ vlc_assert_unreachable(); /* dead code */
}
static int UrlsChange( vlc_object_t *p_this, char const *psz_var,
diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c
index 8888215..abdf957 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -603,7 +603,7 @@ static void *Run( void *data )
else if( timeout < 200 )
timeout = 200; /* Don't wakeup too fast. */
}
- assert (0);
+ vlc_assert_unreachable ();
}
/**********************************************************************
diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c
index 24839a9..949a161 100644
--- a/modules/stream_out/rtp.c
+++ b/modules/stream_out/rtp.c
@@ -1499,7 +1499,7 @@ static void *rtp_listen_thread( void *data )
vlc_restorecancel( canc );
}
- assert( 0 );
+ vlc_assert_unreachable();
}
diff --git a/modules/stream_out/rtpfmt.c b/modules/stream_out/rtpfmt.c
index 1ac9e8d..6f0dbb5 100644
--- a/modules/stream_out/rtpfmt.c
+++ b/modules/stream_out/rtpfmt.c
@@ -486,7 +486,7 @@ int rtp_get_fmt( vlc_object_t *obj, es_format_t *p_fmt, const char *mux,
c1 = c2 = 4;
break;
default:
- assert(0);
+ vlc_assert_unreachable();
}
if( asprintf( &rtp_fmt->fmtp,
@@ -1550,7 +1550,7 @@ static int rtp_packetize_rawvideo( sout_stream_id_sys_t *id, block_t *in, vlc_fo
i_xdec = i_ydec = 2;
break;
default:
- assert(0);
+ vlc_assert_unreachable();
}
static const int RTP_HEADER_LEN = 12;
@@ -1653,7 +1653,7 @@ static int rtp_packetize_rawvideo( sout_stream_id_sys_t *id, block_t *in, vlc_fo
p_outdata += i_length;
p_data += i_length;
}
- else assert(0);
+ else vlc_assert_unreachable();
}
/* rtp common header */
diff --git a/modules/video_filter/deinterlace/algo_phosphor.c b/modules/video_filter/deinterlace/algo_phosphor.c
index 30f5e4b..2f4d091 100644
--- a/modules/video_filter/deinterlace/algo_phosphor.c
+++ b/modules/video_filter/deinterlace/algo_phosphor.c
@@ -336,7 +336,7 @@ int RenderPhosphor( filter_t *p_filter,
break;
default:
/* The above are the only possibilities, if there are no bugs. */
- assert(0);
+ vlc_assert_unreachable();
break;
}
}
diff --git a/modules/video_output/caopengllayer.m b/modules/video_output/caopengllayer.m
index 462bfd9..6e80ec9 100644
--- a/modules/video_output/caopengllayer.m
+++ b/modules/video_output/caopengllayer.m
@@ -330,7 +330,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
}
case VOUT_DISPLAY_RESET_PICTURES:
- assert (0);
+ vlc_assert_unreachable ();
default:
msg_Err (vd, "Unhandled request %d", query);
case VOUT_DISPLAY_CHANGE_FULLSCREEN:
diff --git a/modules/video_output/gl.c b/modules/video_output/gl.c
index 392ffa1..082aa78 100644
--- a/modules/video_output/gl.c
+++ b/modules/video_output/gl.c
@@ -217,7 +217,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
break;
#ifndef NDEBUG
case VOUT_DISPLAY_RESET_PICTURES: // not needed
- assert(0);
+ vlc_assert_unreachable();
#endif
case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
diff --git a/modules/video_output/ios2.m b/modules/video_output/ios2.m
index c7b9e5b..eca2e08 100644
--- a/modules/video_output/ios2.m
+++ b/modules/video_output/ios2.m
@@ -315,7 +315,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
}
case VOUT_DISPLAY_RESET_PICTURES:
- assert (0);
+ vlc_assert_unreachable ();
default:
msg_Err(vd, "Unknown request %d", query);
case VOUT_DISPLAY_CHANGE_FULLSCREEN:
diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index fe42ff9..09541f9 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -376,7 +376,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
}
case VOUT_DISPLAY_RESET_PICTURES:
- assert (0);
+ vlc_assert_unreachable ();
default:
msg_Err (vd, "Unknown request in Mac OS X vout display");
return VLC_EGENERIC;
diff --git a/modules/video_output/msw/common.c b/modules/video_output/msw/common.c
index 75c8a76..1ebe08c 100644
--- a/modules/video_output/msw/common.c
+++ b/modules/video_output/msw/common.c
@@ -619,7 +619,7 @@ int CommonControl(vout_display_t *vd, int query, va_list args)
EventThreadMouseHide(sys->event);
return VLC_SUCCESS;
case VOUT_DISPLAY_RESET_PICTURES:
- assert(0);
+ vlc_assert_unreachable();
default:
return VLC_EGENERIC;
}
diff --git a/modules/video_output/msw/wingdi.c b/modules/video_output/msw/wingdi.c
index 4f6c639..ea4b237 100644
--- a/modules/video_output/msw/wingdi.c
+++ b/modules/video_output/msw/wingdi.c
@@ -173,7 +173,7 @@ static int Control(vout_display_t *vd, int query, va_list args)
{
switch (query) {
case VOUT_DISPLAY_RESET_PICTURES:
- assert(0);
+ vlc_assert_unreachable();
return VLC_EGENERIC;
default:
return CommonControl(vd, query, args);
diff --git a/modules/video_output/wayland/shell_surface.c b/modules/video_output/wayland/shell_surface.c
index 013f1b8..4ebdcff 100644
--- a/modules/video_output/wayland/shell_surface.c
+++ b/modules/video_output/wayland/shell_surface.c
@@ -87,7 +87,7 @@ static void *Thread(void *data)
wl_display_read_events(display);
wl_display_dispatch_pending(display);
}
- assert(0);
+ vlc_assert_unreachable();
vlc_cleanup_pop();
//vlc_restorecancel(canc);
//return NULL;
diff --git a/modules/video_output/xcb/glx.c b/modules/video_output/xcb/glx.c
index bb5c789..0d3dbb6 100644
--- a/modules/video_output/xcb/glx.c
+++ b/modules/video_output/xcb/glx.c
@@ -248,7 +248,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
return VLC_SUCCESS;
case VOUT_DISPLAY_RESET_PICTURES:
- assert (0);
+ vlc_assert_unreachable ();
default:
msg_Err (vd, "Unknown request in XCB vout display");
return VLC_EGENERIC;
diff --git a/modules/video_output/xcb/xvideo.c b/modules/video_output/xcb/xvideo.c
index 1a05c08..e9100fb 100644
--- a/modules/video_output/xcb/xvideo.c
+++ b/modules/video_output/xcb/xvideo.c
@@ -769,7 +769,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
xcb_flush (p_sys->conn);
return VLC_SUCCESS;
case VOUT_DISPLAY_RESET_PICTURES:
- assert(0);
+ vlc_assert_unreachable();
default:
msg_Err (vd, "Unknown request in XCB vout display");
return VLC_EGENERIC;
diff --git a/modules/video_splitter/wall.c b/modules/video_splitter/wall.c
index 9a9829a..3810c17 100644
--- a/modules/video_splitter/wall.c
+++ b/modules/video_splitter/wall.c
@@ -446,7 +446,7 @@ static int Mouse( video_splitter_t *p_splitter, vlc_mouse_t *p_mouse,
}
}
}
- assert(0);
+ vlc_assert_unreachable();
return VLC_EGENERIC;
}
diff --git a/modules/visualization/glspectrum.c b/modules/visualization/glspectrum.c
index 6086353..8efdb8f 100644
--- a/modules/visualization/glspectrum.c
+++ b/modules/visualization/glspectrum.c
@@ -493,5 +493,5 @@ release:
vlc_restorecancel(canc);
}
- assert(0);
+ vlc_assert_unreachable();
}
diff --git a/modules/visualization/visual/visual.c b/modules/visualization/visual/visual.c
index 628fd70..5ce328d 100644
--- a/modules/visualization/visual/visual.c
+++ b/modules/visualization/visual/visual.c
@@ -381,7 +381,7 @@ static void *Thread( void *data )
block_Release( DoRealWork( p_filter, block ) );
vlc_restorecancel( canc );
}
- assert(0);
+ vlc_assert_unreachable();
}
static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
diff --git a/modules/visualization/visual/window.c b/modules/visualization/visual/window.c
index e08794d..4986123 100644
--- a/modules/visualization/visual/window.c
+++ b/modules/visualization/visual/window.c
@@ -184,7 +184,7 @@ bool window_init( int i_buffer_size, window_param * p_param,
}
default:
/* We should not reach here */
- assert(0);
+ vlc_assert_unreachable();
break;
}
diff --git a/src/android/thread.c b/src/android/thread.c
index dbf2ece..d365d10 100644
--- a/src/android/thread.c
+++ b/src/android/thread.c
@@ -303,7 +303,7 @@ int vlc_cond_timedwait (vlc_cond_t *condvar, vlc_mutex_t *p_mutex,
cb = pthread_cond_timedwait_monotonic_np;
break;
default:
- assert (0);
+ vlc_assert_unreachable ();
}
int val = cb (&condvar->cond, p_mutex, &ts);
diff --git a/src/audio_output/common.c b/src/audio_output/common.c
index c57d986..9c05ac5 100644
--- a/src/audio_output/common.c
+++ b/src/audio_output/common.c
@@ -373,7 +373,7 @@ do { \
case VLC_CODEC_FL32: INTERLEAVE_TYPE(float); break;
case VLC_CODEC_S32N: INTERLEAVE_TYPE(int32_t); break;
case VLC_CODEC_FL64: INTERLEAVE_TYPE(double); break;
- default: assert(0);
+ default: vlc_assert_unreachable();
}
#undef INTERLEAVE_TYPE
}
@@ -409,7 +409,7 @@ do { \
case VLC_CODEC_FL32: DEINTERLEAVE_TYPE(float); break;
case VLC_CODEC_S32N: DEINTERLEAVE_TYPE(int32_t); break;
case VLC_CODEC_FL64: DEINTERLEAVE_TYPE(double); break;
- default: assert(0);
+ default: vlc_assert_unreachable();
}
#undef DEINTERLEAVE_TYPE
}
diff --git a/src/darwin/dirs.c b/src/darwin/dirs.c
index 381729c..9c34cc5 100644
--- a/src/darwin/dirs.c
+++ b/src/darwin/dirs.c
@@ -132,7 +132,7 @@ static char *getAppDependentDir(vlc_userdir_t type)
psz_path = "%s/Library/Caches/%s";
break;
default:
- assert(0);
+ vlc_assert_unreachable();
break;
}
diff --git a/src/darwin/thread.c b/src/darwin/thread.c
index cd1d694..8b1c29d 100644
--- a/src/darwin/thread.c
+++ b/src/darwin/thread.c
@@ -730,7 +730,7 @@ void vlc_testcancel (void)
void vlc_control_cancel (int cmd, ...)
{
(void) cmd;
- assert (0);
+ vlc_assert_unreachable ();
}
/* Precision monotonic clock.
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 33e226a..3ea91f0 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -2490,7 +2490,7 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
case ES_OUT_RESTART_ES_BY_ID: i_new_query = ES_OUT_RESTART_ES; break;
case ES_OUT_SET_ES_DEFAULT_BY_ID: i_new_query = ES_OUT_SET_ES_DEFAULT; break;
default:
- assert(0);
+ vlc_assert_unreachable();
}
/* TODO if the lock is made non recursive it should be changed */
int i_ret = es_out_Control( out, i_new_query, p_es );
diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
index c12d73a..511ba73 100644
--- a/src/input/es_out_timeshift.c
+++ b/src/input/es_out_timeshift.c
@@ -583,7 +583,7 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
case ES_OUT_GET_ES_OBJECTS_BY_ID:
case ES_OUT_SET_DELAY:
case ES_OUT_SET_RECORD_STATE:
- assert(0);
+ vlc_assert_unreachable();
return VLC_EGENERIC;
/* Pass-through control */
@@ -700,7 +700,7 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
default:
msg_Err( p_sys->p_input, "Unknown es_out_Control query !" );
- assert(0);
+ vlc_assert_unreachable();
return VLC_EGENERIC;
}
}
@@ -1041,7 +1041,7 @@ static void *TsRun( void *p_data )
CmdExecuteDel( p_ts->p_out, &cmd );
break;
default:
- assert(0);
+ vlc_assert_unreachable();
break;
}
vlc_restorecancel( canc );
@@ -1222,7 +1222,7 @@ static void CmdClean( ts_cmd_t *p_cmd )
case C_DEL:
break;
default:
- assert(0);
+ vlc_assert_unreachable();
break;
}
}
@@ -1437,7 +1437,7 @@ static int CmdInitControl( ts_cmd_t *p_cmd, int i_query, va_list args, bool b_co
}
default:
- assert(0);
+ vlc_assert_unreachable();
return VLC_EGENERIC;
}
@@ -1506,7 +1506,7 @@ static int CmdExecuteControl( es_out_t *p_out, ts_cmd_t *p_cmd )
p_cmd->u.control.u.jitter.i_cr_average );
default:
- assert(0);
+ vlc_assert_unreachable();
return VLC_EGENERIC;
}
}
diff --git a/src/input/stream.c b/src/input/stream.c
index a5e3c22..55ec2c8 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -633,7 +633,7 @@ static int AStreamControl( stream_t *s, int i_query, va_list args )
case STREAM_METHOD_STREAM:
return AStreamSeekStream( s, offset );
default:
- assert(0);
+ vlc_assert_unreachable();
return VLC_EGENERIC;
}
}
diff --git a/src/misc/events.c b/src/misc/events.c
index fb2a04d..81f901e 100644
--- a/src/misc/events.c
+++ b/src/misc/events.c
@@ -270,7 +270,7 @@ int vlc_event_attach( vlc_event_manager_t * p_em,
}
FOREACH_END()
/* Unknown event = BUG */
- assert( 0 );
+ vlc_assert_unreachable();
}
/**
@@ -311,5 +311,5 @@ void vlc_event_detach( vlc_event_manager_t *p_em,
}
FOREACH_END()
- assert( 0 );
+ vlc_assert_unreachable();
}
diff --git a/src/misc/variables.c b/src/misc/variables.c
index 04b3750..3a89b41 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -255,7 +255,7 @@ int var_Create( vlc_object_t *p_this, const char *psz_name, int i_type )
p_var->ops = &void_ops;
break;
default:
- assert (0);
+ vlc_assert_unreachable ();
}
if( (i_type & VLC_VAR_DOINHERIT)
@@ -904,7 +904,7 @@ static int DelCallback( vlc_object_t *p_this, const char *psz_name,
if( b_found_similar )
fprintf( stderr, "Calling var_DelCallback for '%s' with the same "
"function but not the same data.", psz_name );
- assert( 0 );
+ vlc_assert_unreachable();
#endif
vlc_mutex_unlock( &p_priv->var_lock );
return VLC_EGENERIC;
@@ -1275,7 +1275,7 @@ int var_Inherit( vlc_object_t *p_this, const char *psz_name, int i_type,
p_val->b_bool = config_GetInt( p_this, psz_name );
break;
default:
- assert(0);
+ vlc_assert_unreachable();
case VLC_VAR_ADDRESS:
return VLC_ENOOBJ;
}
diff --git a/src/missing.c b/src/missing.c
index 1041ac0..f180752 100644
--- a/src/missing.c
+++ b/src/missing.c
@@ -44,13 +44,13 @@
char *httpd_ClientIP (const httpd_client_t *cl, char *psz_ip, int *port)
{
(void) cl; (void) psz_ip; (void) port;
- assert (0);
+ vlc_assert_unreachable ();
}
httpd_file_sys_t *httpd_FileDelete (httpd_file_t *file)
{
(void) file;
- assert (0);
+ vlc_assert_unreachable ();
}
httpd_file_t *httpd_FileNew (httpd_host_t *host,
@@ -62,13 +62,13 @@ httpd_file_t *httpd_FileNew (httpd_host_t *host,
(void) url; (void) content_type;
(void) login; (void) password;
(void) cb; (void) data;
- assert (0);
+ vlc_assert_unreachable ();
}
httpd_handler_sys_t *httpd_HandlerDelete (httpd_handler_t *handler)
{
(void) handler;
- assert (0);
+ vlc_assert_unreachable ();
}
httpd_handler_t *httpd_HandlerNew (httpd_host_t *host, const char *url,
@@ -79,13 +79,13 @@ httpd_handler_t *httpd_HandlerNew (httpd_host_t *host, const char *url,
(void) host; (void) url;
(void) login; (void) password;
(void) cb; (void) data;
- assert (0);
+ vlc_assert_unreachable ();
}
void httpd_HostDelete (httpd_host_t *h)
{
(void) h;
- assert (0);
+ vlc_assert_unreachable ();
}
httpd_host_t *vlc_http_HostNew (vlc_object_t *obj)
@@ -109,44 +109,44 @@ httpd_host_t *vlc_rtsp_HostNew (vlc_object_t *obj)
void httpd_MsgAdd (httpd_message_t *m, const char *name, const char *fmt, ...)
{
(void) m; (void) name; (void) fmt;
- assert (0);
+ vlc_assert_unreachable ();
}
const char *httpd_MsgGet (const httpd_message_t *m, const char *name)
{
(void) m; (void) name;
- assert (0);
+ vlc_assert_unreachable ();
}
void httpd_RedirectDelete (httpd_redirect_t *r)
{
(void) r;
- assert (0);
+ vlc_assert_unreachable ();
}
httpd_redirect_t *httpd_RedirectNew (httpd_host_t *host,
const char *dst, const char *src)
{
(void) host; (void) dst; (void) src;
- assert (0);
+ vlc_assert_unreachable ();
}
char *httpd_ServerIP (const httpd_client_t *client, char *ip, int *port)
{
(void) client; (void) ip; (void) port;
- assert (0);
+ vlc_assert_unreachable ();
}
void httpd_StreamDelete (httpd_stream_t *stream)
{
(void) stream;
- assert (0);
+ vlc_assert_unreachable ();
}
int httpd_StreamHeader (httpd_stream_t *stream, uint8_t *data, int count)
{
(void) stream; (void) data; (void) count;
- assert (0);
+ vlc_assert_unreachable ();
}
httpd_stream_t *httpd_StreamNew (httpd_host_t *host,
@@ -155,13 +155,13 @@ httpd_stream_t *httpd_StreamNew (httpd_host_t *host,
{
(void) host; (void) url; (void) content_type;
(void) login; (void) password;
- assert (0);
+ vlc_assert_unreachable ();
}
int httpd_StreamSend (httpd_stream_t *stream, const block_t *p_block)
{
(void) stream; (void) p_block;
- assert (0);
+ vlc_assert_unreachable ();
}
int httpd_StreamSetHTTPHeaders (httpd_stream_t * stream,
@@ -169,27 +169,27 @@ int httpd_StreamSetHTTPHeaders (httpd_stream_t * stream,
size_t i_headers)
{
(void) stream; (void) headers; (void) i_headers;
- assert (0);
+ vlc_assert_unreachable ();
}
int httpd_UrlCatch (httpd_url_t *url, int request, httpd_callback_t cb,
httpd_callback_sys_t *data)
{
(void) url; (void) request; (void) cb; (void) data;
- assert (0);
+ vlc_assert_unreachable ();
}
void httpd_UrlDelete (httpd_url_t *url)
{
(void) url;
- assert (0);
+ vlc_assert_unreachable ();
}
httpd_url_t *httpd_UrlNew (httpd_host_t *host, const char *url,
const char *login, const char *password)
{
(void) host; (void) url; (void) login; (void) password;
- assert (0);
+ vlc_assert_unreachable ();
}
#endif /* !ENABLE_HTTPD */
@@ -217,13 +217,13 @@ char *sdp_AddAttribute (char **sdp, const char *name, const char *fmt, ...)
int sout_AccessOutControl (sout_access_out_t *out, int query, ...)
{
VLC_UNUSED (out); VLC_UNUSED (query);
- assert (0);
+ vlc_assert_unreachable ();
}
void sout_AccessOutDelete (sout_access_out_t *out)
{
VLC_UNUSED (out);
- assert (0);
+ vlc_assert_unreachable ();
}
#undef sout_AccessOutNew
@@ -238,19 +238,19 @@ sout_access_out_t *sout_AccessOutNew (vlc_object_t *obj,
ssize_t sout_AccessOutRead (sout_access_out_t *out, block_t *block)
{
VLC_UNUSED (out); VLC_UNUSED (block);
- assert (0);
+ vlc_assert_unreachable ();
}
int sout_AccessOutSeek (sout_access_out_t *out, off_t offset)
{
VLC_UNUSED (out); VLC_UNUSED (offset);
- assert (0);
+ vlc_assert_unreachable ();
}
ssize_t sout_AccessOutWrite (sout_access_out_t *out, block_t *block)
{
VLC_UNUSED (out); VLC_UNUSED (block);
- assert (0);
+ vlc_assert_unreachable ();
}
#undef sout_AnnounceRegisterSDP
@@ -267,7 +267,7 @@ session_descriptor_t *sout_AnnounceRegisterSDP (vlc_object_t *obj,
void sout_AnnounceUnRegister (vlc_object_t *obj, session_descriptor_t *d)
{
VLC_UNUSED (obj); VLC_UNUSED (d);
- assert (0);
+ vlc_assert_unreachable ();
}
#undef sout_EncoderCreate
@@ -280,44 +280,44 @@ encoder_t *sout_EncoderCreate( vlc_object_t *p_this )
sout_input_t *sout_MuxAddStream (sout_mux_t *mux, es_format_t *fmt)
{
VLC_UNUSED (mux); VLC_UNUSED (fmt);
- assert (0);
+ vlc_assert_unreachable ();
}
void sout_MuxDelete (sout_mux_t *mux)
{
VLC_UNUSED (mux);
- assert (0);
+ vlc_assert_unreachable ();
}
void sout_MuxDeleteStream (sout_mux_t *mux, sout_input_t *input)
{
VLC_UNUSED (mux); VLC_UNUSED (input);
- assert (0);
+ vlc_assert_unreachable ();
}
int sout_MuxGetStream (sout_mux_t *p_mux, unsigned int i_blocks, mtime_t *pi_dts)
{
VLC_UNUSED (p_mux); VLC_UNUSED (i_blocks); VLC_UNUSED (pi_dts);
- assert (0);
+ vlc_assert_unreachable ();
}
sout_mux_t *sout_MuxNew (sout_instance_t *instance, const char *mux,
sout_access_out_t *out)
{
VLC_UNUSED (instance); VLC_UNUSED (mux); VLC_UNUSED (out);
- assert (0);
+ vlc_assert_unreachable ();
}
int sout_MuxSendBuffer (sout_mux_t *mux, sout_input_t *input, block_t *block)
{
VLC_UNUSED (mux); VLC_UNUSED (input); VLC_UNUSED (block);
- assert (0);
+ vlc_assert_unreachable ();
}
void sout_StreamChainDelete (sout_stream_t *p_first, sout_stream_t *p_last)
{
VLC_UNUSED (p_first); VLC_UNUSED (p_last);
- assert (0);
+ vlc_assert_unreachable ();
}
sout_stream_t *sout_StreamChainNew (sout_instance_t *p_sout, char *psz_chain,
@@ -326,7 +326,7 @@ sout_stream_t *sout_StreamChainNew (sout_instance_t *p_sout, char *psz_chain,
{
VLC_UNUSED (p_sout); VLC_UNUSED (psz_chain); VLC_UNUSED (p_next);
VLC_UNUSED (pp_last);
- assert (0);
+ vlc_assert_unreachable ();
}
char *vlc_sdp_Start (vlc_object_t *obj, const char *cfg,
@@ -346,13 +346,13 @@ int vlm_Control (vlm_t *vlm, int query, ...)
{
VLC_UNUSED (query);
VLC_UNUSED (vlm);
- assert (0);
+ vlc_assert_unreachable ();
}
void vlm_Delete (vlm_t *vlm)
{
VLC_UNUSED (vlm);
- assert (0);
+ vlc_assert_unreachable ();
}
int vlm_ExecuteCommand (vlm_t *vlm, const char *cmd, vlm_message_t **pm)
@@ -360,20 +360,20 @@ int vlm_ExecuteCommand (vlm_t *vlm, const char *cmd, vlm_message_t **pm)
VLC_UNUSED (vlm);
VLC_UNUSED (cmd);
VLC_UNUSED (pm);
- assert (0);
+ vlc_assert_unreachable ();
}
vlm_message_t *vlm_MessageAdd (vlm_message_t *a, vlm_message_t *b)
{
VLC_UNUSED (a);
VLC_UNUSED (b);
- assert (0);
+ vlc_assert_unreachable ();
}
void vlm_MessageDelete (vlm_message_t *m)
{
VLC_UNUSED (m);
- assert (0);
+ vlc_assert_unreachable ();
}
vlm_message_t *vlm_MessageSimpleNew (const char *a)
diff --git a/src/network/httpd.c b/src/network/httpd.c
index a643c70..94dec90 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -1560,7 +1560,7 @@ static void httpd_ClientRecv(httpd_client_t *cl)
break;
}
default:
- assert(0);
+ vlc_assert_unreachable();
}
i_len = 0; /* drop */
}
diff --git a/src/posix/thread.c b/src/posix/thread.c
index 07fa71e..06728ce 100644
--- a/src/posix/thread.c
+++ b/src/posix/thread.c
@@ -829,7 +829,7 @@ void vlc_testcancel (void)
void vlc_control_cancel (int cmd, ...)
{
(void) cmd;
- assert (0);
+ vlc_assert_unreachable ();
}
/**
diff --git a/src/posix/timer.c b/src/posix/timer.c
index 71ca080..a237679 100644
--- a/src/posix/timer.c
+++ b/src/posix/timer.c
@@ -95,7 +95,7 @@ static void *vlc_timer_thread (void *data)
}
vlc_cleanup_pop ();
- assert (0);
+ vlc_assert_unreachable ();
}
/**
diff --git a/src/stream_output/sap.c b/src/stream_output/sap.c
index 0a78748..23d0528 100644
--- a/src/stream_output/sap.c
+++ b/src/stream_output/sap.c
@@ -160,7 +160,7 @@ static void *RunThread (void *self)
}
vlc_cleanup_pop ();
- assert (0);
+ vlc_assert_unreachable ();
}
#undef sout_AnnounceRegisterSDP
@@ -310,7 +310,7 @@ sout_AnnounceRegisterSDP (vlc_object_t *obj, const char *sdp,
length += 4;
break;
default:
- assert (0);
+ vlc_assert_unreachable ();
}
/* XXX: Check for dupes */
diff --git a/src/text/strings.c b/src/text/strings.c
index 5063e78..33f30d4 100644
--- a/src/text/strings.c
+++ b/src/text/strings.c
@@ -499,7 +499,7 @@ char *str_format_time( const char *tformat )
}
free (str);
}
- assert (0);
+ vlc_assert_unreachable ();
}
static void write_duration(FILE *stream, int64_t duration)
diff --git a/src/text/unicode.c b/src/text/unicode.c
index 25215d7..feac999 100644
--- a/src/text/unicode.c
+++ b/src/text/unicode.c
@@ -155,7 +155,7 @@ size_t vlc_towc (const char *str, uint32_t *restrict pwc)
break;
default:
- assert (0);
+ vlc_assert_unreachable ();
}
/* Unrolled continuation bytes decoding */
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 4c1b133..3e3a3d5 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -544,7 +544,7 @@ static void VoutDisplayEventMouse(vout_display_t *vd, int event, va_list args)
m.b_double_click = true;
break;
default:
- assert(0);
+ vlc_assert_unreachable();
}
if (is_ignored) {
diff --git a/src/win32/dirs.c b/src/win32/dirs.c
index 0ec1087..fbb48b6 100644
--- a/src/win32/dirs.c
+++ b/src/win32/dirs.c
@@ -122,5 +122,5 @@ char *config_GetUserDir (vlc_userdir_t type)
case VLC_VIDEOS_DIR:
return config_GetShellDir (CSIDL_MYVIDEO);
}
- assert (0);
+ vlc_assert_unreachable ();
}
--
2.1.4
More information about the vlc-devel
mailing list