From bec630c34753f7fbbac8712661b596ff5a76b7c1 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 12 Nov 2012 23:24:01 +0100 Subject: clang: fix all warnings except deprecations --- configure | 2 +- core/mplayer.c | 4 +++- core/timeline/tl_edl.c | 3 ++- sub/spudec.c | 2 +- talloc.h | 5 ++++- video/out/gl_header_fixes.h | 3 +++ video/out/vo_corevideo.m | 3 ++- video/out/vo_opengl.c | 2 +- 8 files changed, 17 insertions(+), 7 deletions(-) diff --git a/configure b/configure index 7ebadc28b6..91a16bfcbe 100755 --- a/configure +++ b/configure @@ -1162,7 +1162,7 @@ if test -z "$CFLAGS" ; then WARNFLAGS="-wd167 -wd556 -wd144" elif test "$cc_vendor" = "clang"; then CFLAGS="$_opt $_debug $_profile $_march $_pipe" - WARNFLAGS="-Wall -Wno-switch-enum -Wno-logical-op-parentheses -Wpointer-arith -Wundef -Wno-pointer-sign -Wmissing-prototypes" + WARNFLAGS="-Wall -Wno-switch -Wno-logical-op-parentheses -Wpointer-arith -Wundef -Wno-pointer-sign -Wmissing-prototypes" ERRORFLAGS="-Werror=implicit-function-declaration" elif test "$cc_vendor" != "gnu" ; then CFLAGS="$_opt $_debug $_profile $_march $_mcpu $_pipe" diff --git a/core/mplayer.c b/core/mplayer.c index 1a9fe04f4c..fd260c3a2a 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -1079,7 +1079,7 @@ static void print_status(struct MPContext *mpctx, double a_pos, bool at_frame) mpctx->last_av_difference = MP_NOPTS_VALUE; if (mpctx->last_av_difference > 0.5 && drop_frame_cnt > 50 && !mpctx->drop_message_shown) { - mp_tmsg(MSGT_AVSYNC, MSGL_WARN, mp_gtext(av_desync_help_text)); + mp_tmsg(MSGT_AVSYNC, MSGL_WARN, "%s", mp_gtext(av_desync_help_text)); mpctx->drop_message_shown = true; } } @@ -3771,7 +3771,9 @@ static void play_current_file(struct MPContext *mpctx) mpctx->stream->start_pos += seek_to_byte; // CACHE2: initial prefill: 20% later: 5% (should be set by -cacheopts) +#ifdef CONFIG_DVBIN goto_enable_cache: +#endif if (opts->stream_cache_size > 0) { int res = stream_enable_cache_percent(mpctx->stream, opts->stream_cache_size, diff --git a/core/timeline/tl_edl.c b/core/timeline/tl_edl.c index 1af36a54f8..fb8441d322 100644 --- a/core/timeline/tl_edl.c +++ b/core/timeline/tl_edl.c @@ -322,11 +322,12 @@ void build_edl_timeline(struct MPContext *mpctx) else if (!parts[i].duration) anything_done = true; parts[i].duration = duration; - if (duration && parts[i].src.start < 0) + if (duration && parts[i].src.start < 0) { if (parts[i].src.end < 0) missing_srcstart = i; else parts[i].src.start = parts[i].src.end - duration; + } } if (!anything_done) { if (missing_duration >= 0) { diff --git a/sub/spudec.c b/sub/spudec.c index 2a2bc2dde3..8f05724fab 100644 --- a/sub/spudec.c +++ b/sub/spudec.c @@ -188,7 +188,7 @@ static int spudec_alloc_image(spudec_handle_t *this, int stride, int height) static void setup_palette(spudec_handle_t *spu, uint32_t palette[256]) { - memset(palette, 0, sizeof(palette)); + memset(palette, 0, sizeof(*palette) * 256); struct mp_csp_params csp = MP_CSP_PARAMS_DEFAULTS; csp.int_bits_in = 8; csp.int_bits_out = 8; diff --git a/talloc.h b/talloc.h index 0581bd09c5..909ce80ecf 100644 --- a/talloc.h +++ b/talloc.h @@ -58,7 +58,10 @@ typedef void TALLOC_CTX; /* try to make talloc_set_destructor() and talloc_steal() type safe, if we have a recent gcc */ -#if (__GNUC__ >= 3) +#if defined(__clang__) && defined(__llvm__) +#define _TALLOC_TYPEOF(ptr) void * +#define talloc_steal(ctx, ptr) _talloc_steal((ctx),(ptr)) +#elif (__GNUC__ >= 3) #define _TALLOC_TYPEOF(ptr) __typeof__(ptr) /* this extremely strange macro is to avoid some braindamaged warning stupidity in gcc 4.1.x */ diff --git a/video/out/gl_header_fixes.h b/video/out/gl_header_fixes.h index d149a9970a..41a3aabcd3 100644 --- a/video/out/gl_header_fixes.h +++ b/video/out/gl_header_fixes.h @@ -250,8 +250,11 @@ #define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 #define GLX_CONTEXT_FLAGS_ARB 0x2094 #define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 +#ifndef __APPLE__ +// These are respectively 0x00000001 and 0x00000002 on OSX #define GLX_CONTEXT_DEBUG_BIT_ARB 0x0001 #define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 +#endif #define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 #define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 #endif diff --git a/video/out/vo_corevideo.m b/video/out/vo_corevideo.m index 627281b4e0..04ab7019d1 100644 --- a/video/out/vo_corevideo.m +++ b/video/out/vo_corevideo.m @@ -330,8 +330,9 @@ static CFStringRef get_cv_csp_matrix(struct vo *vo) return kCVImageBufferYCbCrMatrix_ITU_R_709_2; case MP_CSP_SMPTE_240M: return kCVImageBufferYCbCrMatrix_SMPTE_240M_1995; + default: + return kCVImageBufferYCbCrMatrix_ITU_R_601_4; } - return kCVImageBufferYCbCrMatrix_ITU_R_601_4; } static void set_yuv_colorspace(struct vo *vo) diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c index 1900fd84a1..0662c7474b 100644 --- a/video/out/vo_opengl.c +++ b/video/out/vo_opengl.c @@ -2208,7 +2208,7 @@ static int preinit(struct vo *vo, const char *arg) }; if (subopt_parse(arg, subopts) != 0) { - mp_msg(MSGT_VO, MSGL_FATAL, help_text); + mp_msg(MSGT_VO, MSGL_FATAL, "%s", help_text); goto err_out; } -- cgit v1.2.3