b4n left a comment (geany/geany-plugins#1476)

> I'm not sure if we have the same thing in mind - I thought about adding 
> `-DG_GNUC_FALLTHROUGH` to gcc arguments on glib < 2.60 so the macro would get 
> defined and it wouldn't require source code modification.

Oh, my bad.  Still untested, but something like this:
```diff
diff --git a/build/lsp.m4 b/build/lsp.m4
index 2aaa6da3..11098887 100644
--- a/build/lsp.m4
+++ b/build/lsp.m4
@@ -12,6 +12,10 @@ AC_DEFUN([GP_CHECK_LSP],
             [Force using system json-glib and jsonrpc-glib libraries for the 
LSP plugin. [[default=no]]]),,
         enable_system_jsonrpc=no)
 
+    PKG_CHECK_MODULES([GLIB_2_60], [glib-2.0 >= 2.60],
+                      [have_glib_2_60=yes], [have_glib_2_60=no])
+    AM_CONDITIONAL([HAVE_GLIB_2_60], [test "x$have_glib_2_60" = "xyes"])
+
     PKG_CHECK_MODULES([SYSTEM_JSONRPC],
         [${JSON_GLIB_PACKAGE_NAME} >= ${JSON_GLIB_VERSION}
          ${JSONRPC_GLIB_PACKAGE_NAME} >= ${JSONRPC_GLIB_VERSION}],
diff --git a/lsp/deps/Makefile.am b/lsp/deps/Makefile.am
index f3e03c22..c766d705 100644
--- a/lsp/deps/Makefile.am
+++ b/lsp/deps/Makefile.am
@@ -70,6 +70,11 @@ libjsonrpc_la_CPPFLAGS = $(AM_CPPFLAGS) \
        -I$(top_srcdir)/lsp/deps/jsonrpc-glib
 libjsonrpc_la_CFLAGS = $(AM_CFLAGS)
 
+if ! HAVE_GLIB_2_60
+# compatibility for GLib < 2.60
+libjsonrpc_la_CPPFLAGS += -DG_GNUC_FALLTHROUGH
+endif HAVE_GLIB_2_60
+
 # do not enable cppcheck for json-glib or jsonrpc-glib as it generates lots of
 # false positives and it's not "our" code anyway
 #
```

Or `AM_SUBST` some variable that contain `-DG_GNUC_FALLTHROUGH` from `lsp.m4`, 
and use it directly in `libjsonrpc_la_CPPFLAGS`, which would be effectively the 
same.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/pull/1476#issuecomment-3053426826
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany-plugins/pull/1476/c3053426...@github.com>

Reply via email to