[gspell/wip/misc] Replace _GSPELL_EXTERN by G_MODULE_EXPORT
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gspell/wip/misc] Replace _GSPELL_EXTERN by G_MODULE_EXPORT
- Date: Thu, 18 Aug 2022 18:38:58 +0000 (UTC)
commit ea38c97bea707127e96ea66bbe832414e00c1306
Author: Sébastien Wilmet <swilmet informatique-libre be>
Date: Tue Aug 16 16:00:00 2022 +0200
Replace _GSPELL_EXTERN by G_MODULE_EXPORT
Like how it is done in the Amtk library.
To simplify things.
configure.ac | 48 +++++++++++++++----------------------------
gspell/gspell-enum-types.h.in | 2 +-
gspell/gspell-version.h | 16 ++++++---------
3 files changed, 23 insertions(+), 43 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index cac457f..641e8d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -134,39 +134,23 @@ AX_CODE_COVERAGE
AX_REQUIRE_DEFINED([AX_VALGRIND_CHECK])
AX_VALGRIND_CHECK
-# Symbol visibility handling.
-#
-# This requires to #include config.h in every *.c file where there is a public
-# symbol. As a simpler rule, it's easier to #include config.h in all gspell/*.c
-# files, to be sure that we don't miss any public symbol.
+# Check if the compiler supports -fvisibility=hidden
+SAVED_CFLAGS="${CFLAGS}"
+CFLAGS="-fvisibility=hidden"
+AC_MSG_CHECKING([for -fvisibility=hidden compiler flag])
+AC_TRY_COMPILE([], [return 0],
+ AC_MSG_RESULT(yes)
+ enable_fvisibility_hidden=yes,
+ AC_MSG_RESULT(no)
+ enable_fvisibility_hidden=no)
+CFLAGS="${SAVED_CFLAGS}"
+
GSPELL_HIDDEN_VISIBILITY_CFLAGS=""
-case "$host" in
- *-*-mingw*)
- dnl on mingw32 we do -fvisibility=hidden and __declspec(dllexport)
- AC_DEFINE([_GSPELL_EXTERN], [__attribute__((visibility("default"))) __declspec(dllexport) extern],
- [defines how to decorate public symbols while building])
- GSPELL_HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
- ;;
- *)
- dnl on other compilers, check if we can do -fvisibility=hidden
- SAVED_CFLAGS="${CFLAGS}"
- CFLAGS="-fvisibility=hidden"
- AC_MSG_CHECKING([for -fvisibility=hidden compiler flag])
- AC_TRY_COMPILE([], [return 0],
- AC_MSG_RESULT(yes)
- enable_fvisibility_hidden=yes,
- AC_MSG_RESULT(no)
- enable_fvisibility_hidden=no)
- CFLAGS="${SAVED_CFLAGS}"
-
- AS_IF([test "${enable_fvisibility_hidden}" = "yes"], [
- AC_DEFINE([_GSPELL_EXTERN], [__attribute__((visibility("default"))) extern],
- [defines how to decorate public symbols while building])
- GSPELL_HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
- ])
- ;;
-esac
-AC_SUBST(GSPELL_HIDDEN_VISIBILITY_CFLAGS)
+if test "x${enable_fvisibility_hidden}" = "xyes"
+then
+ GSPELL_HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
+fi
+AC_SUBST([GSPELL_HIDDEN_VISIBILITY_CFLAGS])
# Check for Mac OS X platform
AC_MSG_CHECKING([for Mac OS X platform])
diff --git a/gspell/gspell-enum-types.h.in b/gspell/gspell-enum-types.h.in
index 5054d4b..9f0d92c 100644
--- a/gspell/gspell-enum-types.h.in
+++ b/gspell/gspell-enum-types.h.in
@@ -21,7 +21,7 @@ G_BEGIN_DECLS
/*** BEGIN enumeration-production ***/
#define GSPELL_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
-_GSPELL_EXTERN
+G_MODULE_EXPORT
GType @enum_name@_get_type (void);
/*** END enumeration-production ***/
diff --git a/gspell/gspell-version.h b/gspell/gspell-version.h
index 1f151d1..ce7305c 100644
--- a/gspell/gspell-version.h
+++ b/gspell/gspell-version.h
@@ -1,7 +1,7 @@
/*
* This file is part of gspell, a spell-checking library.
*
- * Copyright 2017 - Sébastien Wilmet
+ * Copyright 2017, 2022 - Sébastien Wilmet
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -24,18 +24,14 @@
#error "Only <gspell/gspell.h> can be included directly."
#endif
-#include <glib.h>
+#include <gmodule.h>
G_BEGIN_DECLS
-#ifndef _GSPELL_EXTERN
-#define _GSPELL_EXTERN extern
-#endif
-
-#define GSPELL_AVAILABLE_IN_ALL _GSPELL_EXTERN
-#define GSPELL_AVAILABLE_IN_1_2 _GSPELL_EXTERN
-#define GSPELL_AVAILABLE_IN_1_4 _GSPELL_EXTERN
-#define GSPELL_AVAILABLE_IN_1_6 _GSPELL_EXTERN
+#define GSPELL_AVAILABLE_IN_ALL G_MODULE_EXPORT
+#define GSPELL_AVAILABLE_IN_1_2 G_MODULE_EXPORT
+#define GSPELL_AVAILABLE_IN_1_4 G_MODULE_EXPORT
+#define GSPELL_AVAILABLE_IN_1_6 G_MODULE_EXPORT
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]