On Mon, 16 Aug 2021 at 19:14:58 +0100, Simon McVittie wrote: > 1. Move inclusions of system headers outside extern "C" blocks ... > Attached patch 0001-Move-system-header-inclusions-outside-extern-C.patch > implements this. > > 2. Target a specific GLib version by defining the macros > GLIB_VERSION_MIN_REQUIRED and GLIB_VERSION_MAX_ALLOWED ... > Attached patch 0001-build-Target-a-specific-GLib-API-version.patch > implements this.
Now with patches actually attached. smcv
>From 26f06c0416b1266b7d70ade61a8d29050960a208 Mon Sep 17 00:00:00 2001 From: Simon McVittie <s...@debian.org> Date: Mon, 16 Aug 2021 18:41:25 +0100 Subject: [PATCH] build: Target a specific GLib API version Setting GLIB_VERSION_MIN_REQUIRED selects the minimum required version of GLib for this project. Code that was deprecated after that version will not cause deprecation warnings, and where header files have changed their compile-time behaviour over time, the behaviour that was seen in the selected version will be used where possible. Setting GLIB_VERSION_MAX_ALLOWED causes GLib to emit warnings if a function introduced after the selected version is used. In particular, this disables new C++ behaviour introduced in GLib 2.68, which caused this project to fail to build. GLib 2.54 is an arbitrary choice: it happens to be the version that was the current stable release when gxtuner 3.0.0 was released. It could be reduced if gxtuner needs to compile on older distributions, or increased if a newer dependency is acceptable. Bug: https://github.com/brummer10/gxtuner/issues/19 Bug-Debian: https://bugs.debian.org/992246 Forwarded: https://github.com/brummer10/gxtuner/pull/21 --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 88221f6..2680f86 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,8 @@ NAME = gxtuner LIBS = `pkg-config --libs jack gtk+-3.0 gthread-2.0 fftw3f x11` -lzita-resampler CFLAGS += -Wall -ffast-math `pkg-config --cflags jack gtk+-3.0 gthread-2.0 fftw3f` + CFLAGS += -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_54 + CFLAGS += -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_54 OBJS = resources.o jacktuner.o gxtuner.o cmdparser.o gx_pitch_tracker.o gtkknob.o \ paintbox.o tuner.o deskpager.o main.o DEBNAME = $(NAME)_$(VER) -- 2.32.0
>From 2f3771ed5a6ca17688280953eff2859ba93ba8d9 Mon Sep 17 00:00:00 2001 From: Simon McVittie <s...@debian.org> Date: Mon, 16 Aug 2021 18:07:17 +0100 Subject: [PATCH] Move system header inclusions outside extern "C" GLib and GTK both include extern "C" guards in their header files, so it is unnecessary to wrap them in an extern "C" block. A redundant extern "C" block can be harmful, because header files might test #ifdef __cplusplus and include C++ syntax if it is defined, even in an otherwise C header. In particular, GLib has done this since version 2.68, in order to make macros like g_object_ref() type-safe when called from C++ code. the result was that this project failed to compile. Bug: https://github.com/brummer10/gxtuner/issues/19 Bug-Debian: https://bugs.debian.org/992246 Forwarded: https://github.com/brummer10/gxtuner/pull/20 --- gtkknob.h | 4 ++-- gxtuner.h | 8 +++----- paintbox.h | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/gtkknob.h b/gtkknob.h index d7d1cae..f5d8f0a 100644 --- a/gtkknob.h +++ b/gtkknob.h @@ -24,14 +24,14 @@ #ifndef __GTK_KNOB_H__ #define __GTK_KNOB_H__ +#include <gtk/gtk.h> + #ifdef __cplusplus extern "C" { #endif #pragma once -#include <gtk/gtk.h> - G_BEGIN_DECLS #define GTK_TYPE_KNOB (gtk_knob_get_type()) diff --git a/gxtuner.h b/gxtuner.h index 4b729ec..8ca2399 100644 --- a/gxtuner.h +++ b/gxtuner.h @@ -26,15 +26,13 @@ #ifndef _GX_TUNER_H_ #define _GX_TUNER_H_ -#ifdef __cplusplus -extern "C" { -#endif - #include <glib-object.h> #include <gtk/gtk.h> #include <string.h> - +#ifdef __cplusplus +extern "C" { +#endif G_BEGIN_DECLS diff --git a/paintbox.h b/paintbox.h index 5e2781b..9821ef3 100644 --- a/paintbox.h +++ b/paintbox.h @@ -21,12 +21,12 @@ #ifndef __PAINT_BOX_H__ #define __PAINT_BOX_H__ +#include <gtk/gtk.h> + #ifdef __cplusplus extern "C" { #endif -#include <gtk/gtk.h> - G_BEGIN_DECLS #define GX_TYPE_PAINT_BOX (gx_paint_box_get_type ()) -- 2.32.0