[vlc-devel] [PATCH] Add dummy return values to silence the compiler warnings NO RETURN IN NON-VOID function. The compiler can't know that this function can't reach the end (typically due to for ( ; ; ). Arguably the compiler should see an assert(), but it keeps on warning (openSUSE'sBuild System, and possibly others, raise this to an error due to potentual undefined behaviour due to undefined random data being returned.

Rémi Denis-Courmont remi at remlab.net
Tue May 4 09:16:32 CEST 2010


Nack. Fix your compiler.

On Tue,  4 May 2010 01:24:38 +0200, Dominique Leuenberger
<dominique at leuenberger.net> wrote:
> ---
>  modules/access/mms/mmstu.c |    1 +
>  modules/control/netsync.c  |    1 +
>  modules/control/signals.c  |    1 +
>  modules/demux/live555.cpp  |    1 +
>  modules/stream_out/rtp.c   |    1 +
>  src/modules/cache.c        |    1 +
>  6 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/modules/access/mms/mmstu.c b/modules/access/mms/mmstu.c
> index 45e363d..8da2bc2 100644
> --- a/modules/access/mms/mmstu.c
> +++ b/modules/access/mms/mmstu.c
> @@ -1570,6 +1570,7 @@ static void *KeepAliveThread( void *p_data )
>          msleep( 10 * CLOCK_FREQ );
>      }
>      assert(0);
> +    return NULL; /* dead code, but the compiler can't know */
>  }
> 
>  static void KeepAliveStart( access_t *p_access )
> diff --git a/modules/control/netsync.c b/modules/control/netsync.c
> index 455be18..01d30cd 100644
> --- a/modules/control/netsync.c
> +++ b/modules/control/netsync.c
> @@ -268,6 +268,7 @@ static void *Slave(void *handle)
>      wait:
>          msleep(INTF_IDLE_SLEEP);
>      }
> +    return NULL; /* dead code, but the compiler can't know */
>  }
> 
>  static int InputEvent(vlc_object_t *object, char const *cmd,
> diff --git a/modules/control/signals.c b/modules/control/signals.c
> index 5cb6f36..96a5389 100644
> --- a/modules/control/signals.c
> +++ b/modules/control/signals.c
> @@ -129,4 +129,5 @@ static void *SigThread (void *data)
>      pthread_sigmask (SIG_UNBLOCK, &set, NULL);
>      for (;;)
>          pause ();
> +    return NULL; /* dead code, but the compiler can't know */
>  }
> diff --git a/modules/demux/live555.cpp b/modules/demux/live555.cpp
> index e6fab0a..8e0cac8 100644
> --- a/modules/demux/live555.cpp
> +++ b/modules/demux/live555.cpp
> @@ -1900,6 +1900,7 @@ static void* TimeoutPrevention( void *p_data )
>          msleep (((int64_t)p_timeout->p_sys->i_timeout - 2) *
CLOCK_FREQ);
>      }
>      assert(0); /* dead code */
> +    return NULL; /* dead code, but the compiler can't know */
>  }
> 
> 
>
/*****************************************************************************
> diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c
> index ab3907b..a5ff658 100644
> --- a/modules/stream_out/rtp.c
> +++ b/modules/stream_out/rtp.c
> @@ -1672,6 +1672,7 @@ static void *rtp_listen_thread( void *data )
>      }
> 
>      assert( 0 );
> +    return NULL; /* dead code, but the compiler can't know */
>  }
> 
> 
> diff --git a/src/modules/cache.c b/src/modules/cache.c
> index 3f09ad8..045525a 100644
> --- a/src/modules/cache.c
> +++ b/src/modules/cache.c
> @@ -333,6 +333,7 @@ static int dummy_callback (vlc_object_t *obj, const
> char *name,
>  {
>      (void) obj; (void)name; (void)oldval; (void)newval; (void)data;
>      assert (0);
> +    return 0; /* dead code, but the compiler can't know */
>  }
> 
> 
> --
> 1.6.0.2
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
-- 
Rémi Denis-Courmont
http://www.remlab.net
http://fi.linkedin.com/in/remidenis




More information about the vlc-devel mailing list