From 3e2f9fb57f48c591c2c1969a15cc9826241cfc55 Mon Sep 17 00:00:00 2001 From: John Stebbins Date: Wed, 19 Jun 2019 14:13:14 -0700 Subject: [PATCH] Fix gcc 9 compiler warnings gcc 9 is quite a lot chattier and clutters the build log with useless information :\ --- ...mem-Fix-invalid-use-of-av_alloc_size.patch | 33 +++++++++++++++++++ gtk/module.rules | 2 +- libhb/decavcodec.c | 5 +-- libhb/dvd.c | 18 +++++----- libhb/dvdnav.c | 18 +++++----- make/include/gcc.defs | 2 +- 6 files changed, 56 insertions(+), 22 deletions(-) create mode 100644 contrib/ffmpeg/A01-avutil-mem-Fix-invalid-use-of-av_alloc_size.patch diff --git a/contrib/ffmpeg/A01-avutil-mem-Fix-invalid-use-of-av_alloc_size.patch b/contrib/ffmpeg/A01-avutil-mem-Fix-invalid-use-of-av_alloc_size.patch new file mode 100644 index 000000000..e6fe7c191 --- /dev/null +++ b/contrib/ffmpeg/A01-avutil-mem-Fix-invalid-use-of-av_alloc_size.patch @@ -0,0 +1,33 @@ +From 4361293fcf59edb56879c36edcd25f0a91e0edf8 Mon Sep 17 00:00:00 2001 +From: Mark Harris +Date: Sat, 24 Nov 2018 13:02:02 -0800 +Subject: [PATCH] avutil/mem: Fix invalid use of av_alloc_size + +The alloc_size attribute is valid only on functions that return a +pointer. GCC 9 (not yet released) warns about invalid usage: + +./libavutil/mem.h:342:1: warning: 'alloc_size' attribute ignored on a function returning int' [-Wattributes] + 342 | av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size); + | ^~~~~~~~~~~~~ + +Signed-off-by: Michael Niedermayer +--- + libavutil/mem.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavutil/mem.h b/libavutil/mem.h +index 55ae573ac9..5fb1a02dd9 100644 +--- a/libavutil/mem.h ++++ b/libavutil/mem.h +@@ -339,7 +339,7 @@ av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size) + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be + * correctly aligned. + */ +-av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size); ++int av_reallocp_array(void *ptr, size_t nmemb, size_t size); + + /** + * Reallocate the given buffer if it is not large enough, otherwise do nothing. +-- +2.21.0 + diff --git a/gtk/module.rules b/gtk/module.rules index 09d99b466..579f4d08a 100644 --- a/gtk/module.rules +++ b/gtk/module.rules @@ -19,7 +19,7 @@ $(GTK.CONFIGURE.stamp): $(GTK.src/)configure.ac $(GTK.src/)src/Makefile.am PKG_CONFIG_PATH=$(BUILD/)contrib/lib/pkgconfig:$(PKG_CONFIG_PATH) \ CC="$(GCC.gcc)" \ CXX="$(GCC.gxx)" \ - CFLAGS="$(call fn.ARGS,GTK.GCC,.g .O *D ?extra)" \ + CFLAGS="$(call fn.ARGS,GTK.GCC,.g .O *D *W ?extra)" \ LDFLAGS="$(call fn.ARGS,GTK.GCC,?strip .g .O ?extra.exe)" \ PYTHON="$(PYTHON.exe)" \ --prefix=$(PREFIX) \ diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c index 340066364..0b851e842 100644 --- a/libhb/decavcodec.c +++ b/libhb/decavcodec.c @@ -418,7 +418,7 @@ static void audioParserFlush(hb_work_object_t * w) hb_work_private_t * pv = w->private_data; uint8_t * pout = NULL; int pout_len = 0; - int64_t parser_pts; + int64_t parser_pts = AV_NOPTS_VALUE; do { @@ -1647,7 +1647,8 @@ static void videoParserFlush(hb_work_object_t * w) int result; uint8_t * pout = NULL; int pout_len = 0; - int64_t parser_pts, parser_dts; + int64_t parser_pts = AV_NOPTS_VALUE; + int64_t parser_dts = AV_NOPTS_VALUE; do { diff --git a/libhb/dvd.c b/libhb/dvd.c index 5708934bf..12611d397 100644 --- a/libhb/dvd.c +++ b/libhb/dvd.c @@ -175,7 +175,7 @@ static int hb_dvdread_title_count( hb_dvd_t * e ) static void add_subtitle( hb_list_t * list_subtitle, int position, iso639_lang_t * lang, int lang_extension, - uint32_t * palette, int style ) + uint8_t * palette, int style ) { hb_subtitle_t * subtitle; int ii, count; @@ -616,8 +616,8 @@ static hb_title_t * hb_dvdread_title_scan( hb_dvd_t * e, int t, uint64_t min_dur // Add Wide Screen subtitle. pos = (spu_control >> 16) & 0x1F; add_subtitle(title->list_subtitle, pos, lang, lang_ext, - vts->vts_pgcit->pgci_srp[pgc_id-1].pgc->palette, - HB_VOBSUB_STYLE_WIDE); + (uint8_t*)vts->vts_pgcit->pgci_srp[pgc_id-1].pgc->palette, + HB_VOBSUB_STYLE_WIDE); // permitted_df // 1 - Letterbox not permitted @@ -628,24 +628,24 @@ static hb_title_t * hb_dvdread_title_scan( hb_dvd_t * e, int t, uint64_t min_dur // Letterbox permitted. Add Letterbox subtitle. pos = (spu_control >> 8) & 0x1F; add_subtitle(title->list_subtitle, pos, lang, lang_ext, - vts->vts_pgcit->pgci_srp[pgc_id-1].pgc->palette, - HB_VOBSUB_STYLE_LETTERBOX); + (uint8_t*)vts->vts_pgcit->pgci_srp[pgc_id-1].pgc->palette, + HB_VOBSUB_STYLE_LETTERBOX); } if (!(vts->vtsi_mat->vts_video_attr.permitted_df & 2)) { // Pan&Scan permitted. Add Pan&Scan subtitle. pos = spu_control & 0x1F; add_subtitle(title->list_subtitle, pos, lang, lang_ext, - vts->vts_pgcit->pgci_srp[pgc_id-1].pgc->palette, - HB_VOBSUB_STYLE_PANSCAN); + (uint8_t*)vts->vts_pgcit->pgci_srp[pgc_id-1].pgc->palette, + HB_VOBSUB_STYLE_PANSCAN); } } else { pos = (spu_control >> 24) & 0x1F; add_subtitle(title->list_subtitle, pos, lang, lang_ext, - vts->vts_pgcit->pgci_srp[pgc_id-1].pgc->palette, - HB_VOBSUB_STYLE_4_3); + (uint8_t*)vts->vts_pgcit->pgci_srp[pgc_id-1].pgc->palette, + HB_VOBSUB_STYLE_4_3); } } diff --git a/libhb/dvdnav.c b/libhb/dvdnav.c index 9eb5534ed..6e165024b 100644 --- a/libhb/dvdnav.c +++ b/libhb/dvdnav.c @@ -319,7 +319,7 @@ PttDuration(ifo_handle_t *ifo, int ttn, int pttn, int *blocks, int *last_pgcn) static void add_subtitle( hb_list_t * list_subtitle, int position, iso639_lang_t * lang, int lang_extension, - uint32_t * palette, int style ) + uint8_t * palette, int style ) { hb_subtitle_t * subtitle; int ii, count; @@ -797,8 +797,8 @@ static hb_title_t * hb_dvdnav_title_scan( hb_dvd_t * e, int t, uint64_t min_dura // Add Wide Screen subtitle. pos = (spu_control >> 16) & 0x1F; add_subtitle(title->list_subtitle, pos, lang, lang_ext, - ifo->vts_pgcit->pgci_srp[title_pgcn-1].pgc->palette, - HB_VOBSUB_STYLE_WIDE); + (uint8_t*)ifo->vts_pgcit->pgci_srp[title_pgcn-1].pgc->palette, + HB_VOBSUB_STYLE_WIDE); // permitted_df // 1 - Letterbox not permitted @@ -809,24 +809,24 @@ static hb_title_t * hb_dvdnav_title_scan( hb_dvd_t * e, int t, uint64_t min_dura // Letterbox permitted. Add Letterbox subtitle. pos = (spu_control >> 8) & 0x1F; add_subtitle(title->list_subtitle, pos, lang, lang_ext, - ifo->vts_pgcit->pgci_srp[title_pgcn-1].pgc->palette, - HB_VOBSUB_STYLE_LETTERBOX); + (uint8_t*)ifo->vts_pgcit->pgci_srp[title_pgcn-1].pgc->palette, + HB_VOBSUB_STYLE_LETTERBOX); } if (!(ifo->vtsi_mat->vts_video_attr.permitted_df & 2)) { // Pan&Scan permitted. Add Pan&Scan subtitle. pos = spu_control & 0x1F; add_subtitle(title->list_subtitle, pos, lang, lang_ext, - ifo->vts_pgcit->pgci_srp[title_pgcn-1].pgc->palette, - HB_VOBSUB_STYLE_PANSCAN); + (uint8_t*)ifo->vts_pgcit->pgci_srp[title_pgcn-1].pgc->palette, + HB_VOBSUB_STYLE_PANSCAN); } } else { pos = (spu_control >> 24) & 0x1F; add_subtitle(title->list_subtitle, pos, lang, lang_ext, - ifo->vts_pgcit->pgci_srp[title_pgcn-1].pgc->palette, - HB_VOBSUB_STYLE_4_3); + (uint8_t*)ifo->vts_pgcit->pgci_srp[title_pgcn-1].pgc->palette, + HB_VOBSUB_STYLE_4_3); } } diff --git a/make/include/gcc.defs b/make/include/gcc.defs index bd2d82dd0..e670c8cd9 100644 --- a/make/include/gcc.defs +++ b/make/include/gcc.defs @@ -8,7 +8,7 @@ GCC.c_std = 1 GCC.cxx_std = 0 GCC.ML = 1 GCC.H = 0 -GCC.W = all +GCC.W = all no-format-truncation GCC.archs = GCC.sysroot = GCC.minver = -- 2.40.0