Add G_BEGIN_DECLS/G_END_DECLS to public headers

https://bugzilla.redhat.com/show_bug.cgi?id=1927439
This commit is contained in:
Kalev Lember 2021-02-12 20:51:16 +01:00
parent b4680b002f
commit 7ad9f2f5c6
2 changed files with 216 additions and 1 deletions

View File

@ -0,0 +1,208 @@
From 426284759c58df81bdbc80167f01058a2c197c0d Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Fri, 12 Feb 2021 15:55:28 +0100
Subject: [PATCH] Add G_BEGIN_DECLS/G_END_DECLS to public headers
This ensures that we correctly specify C linkage when including flatpak
headers from C++ code.
This should fix fallout from glib's change to include C++ code in its
headers, see https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1935
for discussion.
Fixes https://github.com/flatpak/flatpak/issues/4117
---
common/flatpak-bundle-ref.h | 4 ++++
common/flatpak-installation.h | 3 +++
common/flatpak-installed-ref.h | 4 ++++
common/flatpak-instance.h | 4 ++++
common/flatpak-ref.h | 4 ++++
common/flatpak-related-ref.h | 4 ++++
common/flatpak-remote-ref.h | 4 ++++
common/flatpak-remote.h | 3 +++
common/flatpak-transaction.h | 4 ++++
9 files changed, 34 insertions(+)
diff --git a/common/flatpak-bundle-ref.h b/common/flatpak-bundle-ref.h
index 20484dbd..0b3638bf 100644
--- a/common/flatpak-bundle-ref.h
+++ b/common/flatpak-bundle-ref.h
@@ -30,6 +30,8 @@ typedef struct _FlatpakBundleRef FlatpakBundleRef;
#include <gio/gio.h>
#include <flatpak-ref.h>
+G_BEGIN_DECLS
+
#define FLATPAK_TYPE_BUNDLE_REF flatpak_bundle_ref_get_type ()
#define FLATPAK_BUNDLE_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_BUNDLE_REF, FlatpakBundleRef))
#define FLATPAK_IS_BUNDLE_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_BUNDLE_REF))
@@ -62,4 +64,6 @@ FLATPAK_EXTERN char *flatpak_bundle_ref_get_runtime_repo_url (Flatpak
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakBundleRef, g_object_unref)
#endif
+G_END_DECLS
+
#endif /* __FLATPAK_BUNDLE_REF_H__ */
diff --git a/common/flatpak-installation.h b/common/flatpak-installation.h
index b9385c9d..899163e5 100644
--- a/common/flatpak-installation.h
+++ b/common/flatpak-installation.h
@@ -32,6 +32,8 @@ typedef struct _FlatpakInstallation FlatpakInstallation;
#include <flatpak-instance.h>
#include <flatpak-remote.h>
+G_BEGIN_DECLS
+
#define FLATPAK_TYPE_INSTALLATION flatpak_installation_get_type ()
#define FLATPAK_INSTALLATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_INSTALLATION, FlatpakInstallation))
#define FLATPAK_IS_INSTALLATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_INSTALLATION))
@@ -482,5 +484,6 @@ FLATPAK_EXTERN gboolean flatpak_installation_run_triggers (FlatpakInsta
GCancellable *cancellable,
GError **error);
+G_END_DECLS
#endif /* __FLATPAK_INSTALLATION_H__ */
diff --git a/common/flatpak-installed-ref.h b/common/flatpak-installed-ref.h
index 9de04519..0bb90ef2 100644
--- a/common/flatpak-installed-ref.h
+++ b/common/flatpak-installed-ref.h
@@ -30,6 +30,8 @@ typedef struct _FlatpakInstalledRef FlatpakInstalledRef;
#include <gio/gio.h>
#include <flatpak-ref.h>
+G_BEGIN_DECLS
+
#define FLATPAK_TYPE_INSTALLED_REF flatpak_installed_ref_get_type ()
#define FLATPAK_INSTALLED_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_INSTALLED_REF, FlatpakInstalledRef))
#define FLATPAK_IS_INSTALLED_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_INSTALLED_REF))
@@ -71,4 +73,6 @@ FLATPAK_EXTERN GBytes *flatpak_installed_ref_load_appdata (FlatpakInstalled
FLATPAK_EXTERN const char * flatpak_installed_ref_get_eol (FlatpakInstalledRef *self);
FLATPAK_EXTERN const char * flatpak_installed_ref_get_eol_rebase (FlatpakInstalledRef *self);
+G_END_DECLS
+
#endif /* __FLATPAK_INSTALLED_REF_H__ */
diff --git a/common/flatpak-instance.h b/common/flatpak-instance.h
index 772551f5..7b064cf9 100644
--- a/common/flatpak-instance.h
+++ b/common/flatpak-instance.h
@@ -29,6 +29,8 @@ typedef struct _FlatpakInstance FlatpakInstance;
#include <glib-object.h>
+G_BEGIN_DECLS
+
#define FLATPAK_TYPE_INSTANCE flatpak_instance_get_type ()
#define FLATPAK_INSTANCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_INSTANCE, FlatpakInstance))
#define FLATPAK_IS_INSTANCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_INSTANCE))
@@ -65,4 +67,6 @@ FLATPAK_EXTERN GKeyFile * flatpak_instance_get_info (FlatpakInstance *self);
FLATPAK_EXTERN gboolean flatpak_instance_is_running (FlatpakInstance *self);
+G_END_DECLS
+
#endif /* __FLATPAK_INSTANCE_H__ */
diff --git a/common/flatpak-ref.h b/common/flatpak-ref.h
index 285379b4..f6d36202 100644
--- a/common/flatpak-ref.h
+++ b/common/flatpak-ref.h
@@ -29,6 +29,8 @@ typedef struct _FlatpakRef FlatpakRef;
#include <glib-object.h>
+G_BEGIN_DECLS
+
#define FLATPAK_TYPE_REF flatpak_ref_get_type ()
#define FLATPAK_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_REF, FlatpakRef))
#define FLATPAK_IS_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_REF))
@@ -73,4 +75,6 @@ FLATPAK_EXTERN FlatpakRef * flatpak_ref_parse (const char *ref,
GError **error);
FLATPAK_EXTERN const char * flatpak_ref_get_collection_id (FlatpakRef *self);
+G_END_DECLS
+
#endif /* __FLATPAK_REF_H__ */
diff --git a/common/flatpak-related-ref.h b/common/flatpak-related-ref.h
index f33dae8c..10d32a15 100644
--- a/common/flatpak-related-ref.h
+++ b/common/flatpak-related-ref.h
@@ -30,6 +30,8 @@ typedef struct _FlatpakRelatedRef FlatpakRelatedRef;
#include <gio/gio.h>
#include <flatpak-ref.h>
+G_BEGIN_DECLS
+
#define FLATPAK_TYPE_RELATED_REF flatpak_related_ref_get_type ()
#define FLATPAK_RELATED_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_RELATED_REF, FlatpakRelatedRef))
#define FLATPAK_IS_RELATED_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_RELATED_REF))
@@ -55,4 +57,6 @@ FLATPAK_EXTERN gboolean flatpak_related_ref_should_download (FlatpakRelatedR
FLATPAK_EXTERN gboolean flatpak_related_ref_should_delete (FlatpakRelatedRef *self);
FLATPAK_EXTERN gboolean flatpak_related_ref_should_autoprune (FlatpakRelatedRef *self);
+G_END_DECLS
+
#endif /* __FLATPAK_RELATED_REF_H__ */
diff --git a/common/flatpak-remote-ref.h b/common/flatpak-remote-ref.h
index 0c9a4e82..b6478a07 100644
--- a/common/flatpak-remote-ref.h
+++ b/common/flatpak-remote-ref.h
@@ -30,6 +30,8 @@ typedef struct _FlatpakRemoteRef FlatpakRemoteRef;
#include <gio/gio.h>
#include <flatpak-ref.h>
+G_BEGIN_DECLS
+
#define FLATPAK_TYPE_REMOTE_REF flatpak_remote_ref_get_type ()
#define FLATPAK_REMOTE_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_REMOTE_REF, FlatpakRemoteRef))
#define FLATPAK_IS_REMOTE_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_REMOTE_REF))
@@ -57,4 +59,6 @@ FLATPAK_EXTERN const char * flatpak_remote_ref_get_eol_rebase (FlatpakRemoteRef
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakRemoteRef, g_object_unref)
#endif
+G_END_DECLS
+
#endif /* __FLATPAK_REMOTE_REF_H__ */
diff --git a/common/flatpak-remote.h b/common/flatpak-remote.h
index fa223d33..64954132 100644
--- a/common/flatpak-remote.h
+++ b/common/flatpak-remote.h
@@ -44,6 +44,8 @@ typedef struct _FlatpakRemote FlatpakRemote;
#include <gio/gio.h>
#include <flatpak-remote-ref.h>
+G_BEGIN_DECLS
+
#define FLATPAK_TYPE_REMOTE flatpak_remote_get_type ()
#define FLATPAK_REMOTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_REMOTE, FlatpakRemote))
#define FLATPAK_IS_REMOTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_REMOTE))
@@ -124,5 +126,6 @@ FLATPAK_EXTERN void flatpak_remote_set_filter (FlatpakRemote *self,
FLATPAK_EXTERN FlatpakRemoteType flatpak_remote_get_remote_type (FlatpakRemote *self);
+G_END_DECLS
#endif /* __FLATPAK_REMOTE_H__ */
diff --git a/common/flatpak-transaction.h b/common/flatpak-transaction.h
index 37c4144d..870bfbc1 100644
--- a/common/flatpak-transaction.h
+++ b/common/flatpak-transaction.h
@@ -28,6 +28,8 @@
#include <gio/gio.h>
#include <flatpak-installation.h>
+G_BEGIN_DECLS
+
#define FLATPAK_TYPE_TRANSACTION flatpak_transaction_get_type ()
#define FLATPAK_TYPE_TRANSACTION_PROGRESS flatpak_transaction_progress_get_type ()
#define FLATPAK_TYPE_TRANSACTION_OPERATION flatpak_transaction_operation_get_type ()
@@ -315,4 +317,6 @@ gboolean flatpak_transaction_add_uninstall (FlatpakTransaction *self,
FLATPAK_EXTERN
gboolean flatpak_transaction_is_empty (FlatpakTransaction *self);
+G_END_DECLS
+
#endif /* __FLATPAK_TRANSACTION_H__ */
--
2.29.2

View File

@ -3,7 +3,7 @@
Name: flatpak Name: flatpak
Version: 1.10.1 Version: 1.10.1
Release: 2%{?dist} Release: 3%{?dist}
Summary: Application deployment framework for desktop apps Summary: Application deployment framework for desktop apps
License: LGPLv2+ License: LGPLv2+
@ -12,6 +12,10 @@ Source0: https://github.com/flatpak/flatpak/releases/download/%{version}/
# Add Fedora flatpak repositories # Add Fedora flatpak repositories
Source1: flatpak-add-fedora-repos.service Source1: flatpak-add-fedora-repos.service
# https://github.com/flatpak/flatpak/pull/4119
# https://bugzilla.redhat.com/show_bug.cgi?id=1927439
Patch0: 0001-Add-G_BEGIN_DECLS-G_END_DECLS-to-public-headers.patch
BuildRequires: pkgconfig(appstream-glib) BuildRequires: pkgconfig(appstream-glib)
BuildRequires: pkgconfig(dconf) BuildRequires: pkgconfig(dconf)
BuildRequires: pkgconfig(fuse) BuildRequires: pkgconfig(fuse)
@ -263,6 +267,9 @@ fi
%changelog %changelog
* Fri Feb 12 2021 Kalev Lember <klember@redhat.com> - 1.10.1-3
- Add G_BEGIN_DECLS/G_END_DECLS to public headers (#1927439)
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.1-2 * Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild