Raise minimum required version of glib-2.0 to 2.40

At the same time require --std=gnu11 instead of --sdt=gnu99.

This allows us to drop some conditionals is several places. I've
chosen 2.4 as that is the version available in travis, which appears to
be the oldest platform care about. Debian stable has 2.46 in backports,
our windows environment has 2.42
This commit is contained in:
Geert Janssens 2017-03-16 22:21:26 +01:00
parent 79df9b5c26
commit 8acbc41c61
19 changed files with 35 additions and 207 deletions

View File

@ -163,7 +163,7 @@ IF (NOT PKG_CONFIG_FOUND)
ENDIF (NOT PKG_CONFIG_FOUND) ENDIF (NOT PKG_CONFIG_FOUND)
# glib et al. # glib et al.
GNC_PKG_CHECK_MODULES (GLIB2 REQUIRED glib-2.0>=2.20) GNC_PKG_CHECK_MODULES (GLIB2 REQUIRED glib-2.0>=2.40)
GNC_PKG_CHECK_MODULES (GOBJECT REQUIRED gobject-2.0>=2.20) GNC_PKG_CHECK_MODULES (GOBJECT REQUIRED gobject-2.0>=2.20)
GNC_PKG_CHECK_MODULES (GMODULE REQUIRED gmodule-2.0>=2.20) GNC_PKG_CHECK_MODULES (GMODULE REQUIRED gmodule-2.0>=2.20)
GNC_PKG_CHECK_MODULES (GTHREAD REQUIRED gthread-2.0>=2.20) GNC_PKG_CHECK_MODULES (GTHREAD REQUIRED gthread-2.0>=2.20)
@ -452,11 +452,11 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") # FIXME: should be -std=
IF (UNIX) IF (UNIX)
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wdeclaration-after-statement -Wno-pointer-sign -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wno-unused") SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wdeclaration-after-statement -Wno-pointer-sign -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wno-unused")
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=deprecated-declarations -std=gnu99") SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=deprecated-declarations -std=gnu11")
SET( CMAKE_C_FLAGS_RELEASE "-O3 ${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2") SET( CMAKE_C_FLAGS_RELEASE "-O3 ${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2")
ENDIF (UNIX) ENDIF (UNIX)
IF (MINGW) IF (MINGW)
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wdeclaration-after-statement -Wno-pointer-sign -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wno-unused -std=gnu99") SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wdeclaration-after-statement -Wno-pointer-sign -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wno-unused -std=gnu11")
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWINVER=0x0500") # Workaround for bug in gtest on mingw, see https://github.com/google/googletest/issues/893 SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWINVER=0x0500") # Workaround for bug in gtest on mingw, see https://github.com/google/googletest/issues/893
ENDIF (MINGW) ENDIF (MINGW)
IF (APPLE) IF (APPLE)

View File

@ -69,9 +69,13 @@ AC_PROG_CC
AM_PROG_CC_C_O AM_PROG_CC_C_O
AC_GNU_SOURCE AC_GNU_SOURCE
AC_PROG_INTLTOOL AC_PROG_INTLTOOL
# Ensure the compiler supports C++ 11: # Ensure the C++ compiler supports C++ 11:
AX_CXX_COMPILE_STDCXX_11(ext) AX_CXX_COMPILE_STDCXX_11(ext)
AC_PROG_CC_C99 # Ensure the C compiler supports C11
AX_CHECK_COMPILE_FLAG([-std=gnu11],
[AX_APPEND_FLAG([-std=gnu11])],
[AC_MSG_ERROR([The compiler doesn't support the C11 (gnu11) standard.])
])
AC_SUBST(GNUCASH_MAJOR_VERSION) AC_SUBST(GNUCASH_MAJOR_VERSION)
AC_SUBST(GNUCASH_MINOR_VERSION) AC_SUBST(GNUCASH_MINOR_VERSION)
@ -329,46 +333,10 @@ AM_BINRELOC
### -------------------------------------------------------------------------- ### --------------------------------------------------------------------------
### Glib checks. ### Glib checks.
# We require glib >= 2.28, released together with gtk-2.24; # We require glib >= 2.40
# We first check for other versions due to required C standard and deprecations. PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.40 gthread-2.0
# 2.44 requires C11.
# 2.36 deprecated g_type_init
# 2.32 deprecated some gthread functions
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.44 gio-2.0 >= 2.25 gthread-2.0
gobject-2.0 gmodule-2.0,
[
AC_DEFINE([HAVE_GLIB_2_38], [1], [Configure leading quote around assertions])
AC_DEFINE([HAVE_GLIB_2_36], [1], [Configure g_type_init deprecation])
AC_DEFINE([HAVE_GLIB_2_32], [1], [Configure gthread deprecations])
],
[
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.38 gio-2.0 >= 2.25 gthread-2.0
gobject-2.0 gmodule-2.0,
[
AC_DEFINE([HAVE_GLIB_2_38], [1], [Configure leading quote around assertions])
AC_DEFINE([HAVE_GLIB_2_36], [1], [Configure g_type_init deprecation])
AC_DEFINE([HAVE_GLIB_2_32], [1], [Configure gthread deprecations])
],
[
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.36 gio-2.0 >= 2.25 gthread-2.0
gobject-2.0 gmodule-2.0,
[
AC_DEFINE([HAVE_GLIB_2_36], [1], [Configure g_type_init deprecation])
AC_DEFINE([HAVE_GLIB_2_32], [1], [Configure gthread deprecations])
],
[
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.32 gio-2.0 >= 2.25 gthread-2.0
gobject-2.0 gmodule-2.0,
[
AC_DEFINE([HAVE_GLIB_2_32], [1], [Configure gthread deprecations])
],
[
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28 gio-2.0 >= 2.25 gthread-2.0
gobject-2.0 gmodule-2.0) gobject-2.0 gmodule-2.0)
])
])
])
])
AC_CHECK_HEADERS(dirent.h dlfcn.h dl.h utmp.h locale.h mcheck.h unistd.h wctype.h) AC_CHECK_HEADERS(dirent.h dlfcn.h dl.h utmp.h locale.h mcheck.h unistd.h wctype.h)
GLIB_GSETTINGS GLIB_GSETTINGS
@ -393,18 +361,8 @@ AC_TRY_RUN([
],[ ],[
AC_MSG_RESULT(assuming yes) AC_MSG_RESULT(assuming yes)
]) ])
dnl Check for redefinition of typedef GListStore, briefly in GLib 2.44.
dnl Redefinition of typdefs is a C11 feature.
dnl Note that We use gnu99 or gnu11 because strdup is a gnu extension in gcc.
CFLAGS="${CFLAGS} -Werror"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <gio/gio.h>
])], [ac_cv_cstd=gnu99], [ac_cv_cstd=gnu11])
CFLAGS="$GNC_OLDCFLAGS" CFLAGS="$GNC_OLDCFLAGS"
LDFLAGS="$GNC_OLDLDFLAGS" LDFLAGS="$GNC_OLDLDFLAGS"
dnl First remove any existing -std= setting from CFLAGS then add the one we want.
CFLAGS=`echo ${CFLAGS} | sed -E -e "s,-std=[[a-z0-9]]+,,g"`
CFLAGS="${CFLAGS} -std=${ac_cv_cstd}"
# Gnucash replaced dlopen/dlsym by the g_module functions; dlsym # Gnucash replaced dlopen/dlsym by the g_module functions; dlsym
# is needed optionally in one place for BSD linkers, though. # is needed optionally in one place for BSD linkers, though.

View File

@ -100,18 +100,6 @@ IF (APPLE)
ENDIF(APPLE) ENDIF(APPLE)
IF(GLIB2_VERSION VERSION_GREATER 2.32.0 OR GLIB2_VERSION VERSION_EQUAL 2.32.0)
SET(HAVE_GLIB_2_32 1)
ENDIF()
IF(GLIB2_VERSION VERSION_GREATER 2.36.0 OR GLIB2_VERSION VERSION_EQUAL 2.36.0)
SET(HAVE_GLIB_2_36 1)
ENDIF()
IF(GLIB2_VERSION VERSION_GREATER 2.38.0 OR GLIB2_VERSION VERSION_EQUAL 2.38.0)
SET(HAVE_GLIB_2_38 1)
ENDIF()
IF(DISABLE_DEPRECATED_GNOME) IF(DISABLE_DEPRECATED_GNOME)
SET(GNOME_DISABLE_DEPRECATED 1) SET(GNOME_DISABLE_DEPRECATED 1)
ENDIF(DISABLE_DEPRECATED_GNOME) ENDIF(DISABLE_DEPRECATED_GNOME)

View File

@ -1560,13 +1560,8 @@ try_gz_open (const char* filename, const char* perms, gboolean use_gzip,
params->perms = g_strdup (perms); params->perms = g_strdup (perms);
params->compress = compress; params->compress = compress;
#ifndef HAVE_GLIB_2_32
thread = g_thread_create ((GThreadFunc) gz_thread_func, params,
TRUE, &error);
#else
thread = g_thread_new ("xml_thread", (GThreadFunc) gz_thread_func, thread = g_thread_new ("xml_thread", (GThreadFunc) gz_thread_func,
params); params);
#endif
if (!thread) if (!thread)
{ {
g_warning ("Could not create thread for (de)compression: %s", g_warning ("Could not create thread for (de)compression: %s",

View File

@ -746,9 +746,6 @@ main(int argc, char ** argv)
#if !defined(G_THREADS_ENABLED) || defined(G_THREADS_IMPL_NONE) #if !defined(G_THREADS_ENABLED) || defined(G_THREADS_IMPL_NONE)
# error "No GLib thread implementation available!" # error "No GLib thread implementation available!"
#endif #endif
#ifndef HAVE_GLIB_2_32 /* Automatic after GLib 2-32 */
g_thread_init(NULL);
#endif
#ifdef ENABLE_BINRELOC #ifdef ENABLE_BINRELOC
{ {
GError *binreloc_error = NULL; GError *binreloc_error = NULL;

View File

@ -122,15 +122,6 @@
/* Define to 1 if you have the `getuid' function. */ /* Define to 1 if you have the `getuid' function. */
#cmakedefine HAVE_GETUID 1 #cmakedefine HAVE_GETUID 1
/* Configure gthread deprecations */
#cmakedefine HAVE_GLIB_2_32 1
/* Configure g_type_init deprecation */
#cmakedefine HAVE_GLIB_2_36 1
/* Configure leading quote around assertions */
#cmakedefine HAVE_GLIB_2_38 1
/* Define to 1 if you have the <glob.h> header file. */ /* Define to 1 if you have the <glob.h> header file. */
#cmakedefine HAVE_GLOB_H 1 #cmakedefine HAVE_GLOB_H 1

View File

@ -35,11 +35,6 @@ extern "C"
#include "../Transaction.h" #include "../Transaction.h"
#include "../gnc-lot.h" #include "../gnc-lot.h"
#ifdef HAVE_GLIB_2_38
#define _Q "'"
#else
#define _Q "`"
#endif
#if defined(__clang__) && (__clang_major__ == 5 || (__clang_major__ == 3 && __clang_minor__ < 5)) #if defined(__clang__) && (__clang_major__ == 5 || (__clang_major__ == 3 && __clang_minor__ < 5))
#define USE_CLANG_FUNC_SIG 1 #define USE_CLANG_FUNC_SIG 1
#endif #endif
@ -477,7 +472,7 @@ test_gnc_account_list_name_violations (Fixture *fixture, gconstpointer pData)
#else #else
#define _func "gnc_account_list_name_violations" #define _func "gnc_account_list_name_violations"
#endif #endif
auto msg = _func ": assertion " _Q "separator != NULL' failed"; auto msg = _func ": assertion 'separator != NULL' failed";
#undef _func #undef _func
auto check = test_error_struct_new(log_domain, log_level, msg); auto check = test_error_struct_new(log_domain, log_level, msg);
GList *results, *res_iter; GList *results, *res_iter;
@ -763,8 +758,8 @@ test_xaccCloneAccount (Fixture *fixture, gconstpointer pData)
#else #else
#define _func "xaccCloneAccount" #define _func "xaccCloneAccount"
#endif #endif
auto msg1 = _func ": assertion " _Q "GNC_IS_ACCOUNT(from)' failed"; auto msg1 = _func ": assertion 'GNC_IS_ACCOUNT(from)' failed";
auto msg2 = _func ": assertion " _Q "QOF_IS_BOOK(book)' failed"; auto msg2 = _func ": assertion 'QOF_IS_BOOK(book)' failed";
#undef _func #undef _func
auto check = test_error_struct_new("gnc.engine", loglevel, msg1); auto check = test_error_struct_new("gnc.engine", loglevel, msg1);
AccountPrivate *acct_p, *clone_p; AccountPrivate *acct_p, *clone_p;
@ -868,7 +863,7 @@ test_xaccFreeAccount (Fixture *fixture, gconstpointer pData)
#else #else
#define _func "xaccTransGetSplitIndex" #define _func "xaccTransGetSplitIndex"
#endif #endif
auto msg2 = _func ": assertion " _Q "trans && split' failed"; auto msg2 = _func ": assertion 'trans && split' failed";
#undef _func #undef _func
auto loglevel = static_cast<GLogLevelFlags>(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL); auto loglevel = static_cast<GLogLevelFlags>(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL);
auto check1 = test_error_struct_new("gnc.account", loglevel, msg1); auto check1 = test_error_struct_new("gnc.account", loglevel, msg1);
@ -982,7 +977,7 @@ test_xaccAccountCommitEdit (Fixture *fixture, gconstpointer pData)
#else #else
#define _func "xaccTransGetSplitIndex" #define _func "xaccTransGetSplitIndex"
#endif #endif
auto msg2 = _func ": assertion " _Q "trans && split' failed"; auto msg2 = _func ": assertion 'trans && split' failed";
#undef _func #undef _func
auto loglevel = static_cast<GLogLevelFlags>(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL); auto loglevel = static_cast<GLogLevelFlags>(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL);
auto check1 = test_error_struct_new("gnc.account", loglevel, msg1); auto check1 = test_error_struct_new("gnc.account", loglevel, msg1);
@ -1099,8 +1094,8 @@ test_gnc_account_insert_remove_split (Fixture *fixture, gconstpointer pData)
#else #else
#define _func "gnc_account_insert_split" #define _func "gnc_account_insert_split"
#endif #endif
auto msg1 = _func ": assertion " _Q "GNC_IS_ACCOUNT(acc)' failed"; auto msg1 = _func ": assertion 'GNC_IS_ACCOUNT(acc)' failed";
auto msg2 = _func ": assertion " _Q "GNC_IS_SPLIT(s)' failed"; auto msg2 = _func ": assertion 'GNC_IS_SPLIT(s)' failed";
#undef _func #undef _func
auto loglevel = static_cast<GLogLevelFlags>(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL); auto loglevel = static_cast<GLogLevelFlags>(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL);
// auto log_domain = "gnc.engine"; // auto log_domain = "gnc.engine";

View File

@ -37,11 +37,6 @@ extern "C"
#include <gnc-event.h> #include <gnc-event.h>
#include <qofinstance-p.h> #include <qofinstance-p.h>
#ifdef HAVE_GLIB_2_38
#define _Q "'"
#else
#define _Q "`"
#endif
#if defined(__clang__) && (__clang_major__ == 5 || (__clang_major__ == 3 && __clang_minor__ < 5)) #if defined(__clang__) && (__clang_major__ == 5 || (__clang_major__ == 3 && __clang_minor__ < 5))
#define USE_CLANG_FUNC_SIG 1 #define USE_CLANG_FUNC_SIG 1
#endif #endif
@ -1290,7 +1285,7 @@ test_get_corr_account_split (Fixture *fixture, gconstpointer pData)
#else #else
#define _func "get_corr_account_split" #define _func "get_corr_account_split"
#endif #endif
gchar *msg = _func ": assertion " _Q "sa' failed"; gchar *msg = _func ": assertion 'sa' failed";
#undef _func #undef _func
GLogLevelFlags loglevel = static_cast<GLogLevelFlags>(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL); GLogLevelFlags loglevel = static_cast<GLogLevelFlags>(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL);
TestErrorStruct *check = test_error_struct_new ("gnc.engine", TestErrorStruct *check = test_error_struct_new ("gnc.engine",

View File

@ -36,11 +36,6 @@ extern "C"
#include "../gnc-event.h" #include "../gnc-event.h"
#include <qof.h> #include <qof.h>
#ifdef HAVE_GLIB_2_38
#define _Q "'"
#else
#define _Q "`"
#endif
#if defined(__clang__) && (__clang_major__ == 5 || (__clang_major__ == 3 && __clang_minor__ < 5)) #if defined(__clang__) && (__clang_major__ == 5 || (__clang_major__ == 3 && __clang_minor__ < 5))
#define USE_CLANG_FUNC_SIG 1 #define USE_CLANG_FUNC_SIG 1
#endif #endif
@ -423,7 +418,7 @@ test_gnc_transaction_set_get_property (Fixture *fixture, gconstpointer pData)
char buff[80]; char buff[80];
strftime (buff, 80, "%a %b %d %H:%M:%S %Y", localtime(&secs)); strftime (buff, 80, "%a %b %d %H:%M:%S %Y", localtime(&secs));
auto msg1 = "g_object_set_valist: object class " _Q "Transaction' has no property named " _Q "bogus'"; auto msg1 = "g_object_set_valist: object class 'Transaction' has no property named 'bogus'";
auto msg2 = g_strdup_printf ("[xaccTransSetDateInternal] addr=%p set date to %" G_GUINT64_FORMAT ".%09ld %s\n", auto msg2 = g_strdup_printf ("[xaccTransSetDateInternal] addr=%p set date to %" G_GUINT64_FORMAT ".%09ld %s\n",
txn, now.tv_sec, now.tv_nsec, buff); txn, now.tv_sec, now.tv_nsec, buff);
@ -463,7 +458,7 @@ test_gnc_transaction_set_get_property (Fixture *fixture, gconstpointer pData)
g_assert_cmpint (check2->hits, ==, 2); g_assert_cmpint (check2->hits, ==, 2);
g_free (check1->msg); g_free (check1->msg);
check1->msg = g_strdup ("g_object_get_valist: object class " _Q "Transaction' has no property named " _Q "bogus'"); check1->msg = g_strdup ("g_object_get_valist: object class 'Transaction' has no property named 'bogus'");
g_object_get (G_OBJECT (txn), g_object_get (G_OBJECT (txn),
"num", &t_num, "num", &t_num,
"description", &t_desc, "description", &t_desc,
@ -501,7 +496,7 @@ test_xaccMallocTransaction (Fixture *fixture, gconstpointer pData)
#else #else
#define _func "xaccMallocTransaction" #define _func "xaccMallocTransaction"
#endif #endif
auto msg = _func ": assertion " _Q "book' failed"; auto msg = _func ": assertion 'book' failed";
#undef _func #undef _func
auto logdomain = "gnc.engine"; auto logdomain = "gnc.engine";
auto loglevel = static_cast<GLogLevelFlags>(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL); auto loglevel = static_cast<GLogLevelFlags>(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL);
@ -1288,7 +1283,7 @@ test_xaccTransGetAccountBalance (Fixture *fixture, gconstpointer pData)
#else #else
#define _func "xaccTransGetAccountBalance" #define _func "xaccTransGetAccountBalance"
#endif #endif
auto msg1 = _func ": assertion " _Q "account && trans' failed"; auto msg1 = _func ": assertion 'account && trans' failed";
#undef _func #undef _func
auto loglevel = static_cast<GLogLevelFlags>(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL); auto loglevel = static_cast<GLogLevelFlags>(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL);
auto check = test_error_struct_new ("gnc.engine", loglevel, msg1); auto check = test_error_struct_new ("gnc.engine", loglevel, msg1);

View File

@ -315,17 +315,6 @@ static const gchar *
iter_to_string (GtkTreeIter *iter) iter_to_string (GtkTreeIter *iter)
{ {
#ifdef G_THREADS_ENABLED #ifdef G_THREADS_ENABLED
#ifndef HAVE_GLIB_2_32
static GStaticPrivate gtmits_buffer_key = G_STATIC_PRIVATE_INIT;
gchar *string;
string = g_static_private_get (&gtmits_buffer_key);
if (string == NULL)
{
string = g_malloc(ITER_STRING_LEN + 1);
g_static_private_set (&gtmits_buffer_key, string, g_free);
}
#else
static GPrivate gtmits_buffer_key = G_PRIVATE_INIT(g_free); static GPrivate gtmits_buffer_key = G_PRIVATE_INIT(g_free);
gchar *string; gchar *string;
@ -335,7 +324,6 @@ iter_to_string (GtkTreeIter *iter)
string = g_malloc(ITER_STRING_LEN + 1); string = g_malloc(ITER_STRING_LEN + 1);
g_private_set (&gtmits_buffer_key, string); g_private_set (&gtmits_buffer_key, string);
} }
#endif
#else #else
static char string[ITER_STRING_LEN + 1]; static char string[ITER_STRING_LEN + 1];
#endif #endif

View File

@ -315,17 +315,6 @@ iter_to_string (GtkTreeIter *iter)
gnc_commodity_namespace *name_space; gnc_commodity_namespace *name_space;
gnc_commodity *commodity = NULL; gnc_commodity *commodity = NULL;
#ifdef G_THREADS_ENABLED #ifdef G_THREADS_ENABLED
#ifndef HAVE_GLIB_2_32
static GStaticPrivate gtmits_buffer_key = G_STATIC_PRIVATE_INIT;
gchar *string;
string = g_static_private_get (&gtmits_buffer_key);
if (string == NULL)
{
string = g_malloc(ITER_STRING_LEN + 1);
g_static_private_set (&gtmits_buffer_key, string, g_free);
}
#else
static GPrivate gtmits_buffer_key = G_PRIVATE_INIT(g_free); static GPrivate gtmits_buffer_key = G_PRIVATE_INIT(g_free);
gchar *string; gchar *string;
@ -335,7 +324,6 @@ iter_to_string (GtkTreeIter *iter)
string = g_malloc(ITER_STRING_LEN + 1); string = g_malloc(ITER_STRING_LEN + 1);
g_private_set (&gtmits_buffer_key, string); g_private_set (&gtmits_buffer_key, string);
} }
#endif
#else #else
static char string[ITER_STRING_LEN + 1]; static char string[ITER_STRING_LEN + 1];
#endif #endif

View File

@ -317,17 +317,6 @@ static const gchar *
iter_to_string (GtkTreeIter *iter) iter_to_string (GtkTreeIter *iter)
{ {
#ifdef G_THREADS_ENABLED #ifdef G_THREADS_ENABLED
#ifndef HAVE_GLIB_2_32
static GStaticPrivate gtmits_buffer_key = G_STATIC_PRIVATE_INIT;
gchar *string;
string = g_static_private_get (&gtmits_buffer_key);
if (string == NULL)
{
string = g_malloc(ITER_STRING_LEN + 1);
g_static_private_set (&gtmits_buffer_key, string, g_free);
}
#else
static GPrivate gtmits_buffer_key = G_PRIVATE_INIT(g_free); static GPrivate gtmits_buffer_key = G_PRIVATE_INIT(g_free);
gchar *string; gchar *string;
@ -337,7 +326,6 @@ iter_to_string (GtkTreeIter *iter)
string = g_malloc(ITER_STRING_LEN + 1); string = g_malloc(ITER_STRING_LEN + 1);
g_private_set (&gtmits_buffer_key, string); g_private_set (&gtmits_buffer_key, string);
} }
#endif
#else #else
static char string[ITER_STRING_LEN + 1]; static char string[ITER_STRING_LEN + 1];
#endif #endif

View File

@ -379,17 +379,6 @@ iter_to_string (GncTreeModelPrice *model, GtkTreeIter *iter)
gnc_commodity *commodity; gnc_commodity *commodity;
GNCPrice *price; GNCPrice *price;
#ifdef G_THREADS_ENABLED #ifdef G_THREADS_ENABLED
#ifndef HAVE_GLIB_2_32
static GStaticPrivate gtmits_buffer_key = G_STATIC_PRIVATE_INIT;
gchar *string;
string = g_static_private_get (&gtmits_buffer_key);
if (string == NULL)
{
string = g_malloc(ITER_STRING_LEN + 1);
g_static_private_set (&gtmits_buffer_key, string, g_free);
}
#else
static GPrivate gtmits_buffer_key = G_PRIVATE_INIT(g_free); static GPrivate gtmits_buffer_key = G_PRIVATE_INIT(g_free);
gchar *string; gchar *string;
@ -399,7 +388,6 @@ iter_to_string (GncTreeModelPrice *model, GtkTreeIter *iter)
string = g_malloc(ITER_STRING_LEN + 1); string = g_malloc(ITER_STRING_LEN + 1);
g_private_set (&gtmits_buffer_key, string); g_private_set (&gtmits_buffer_key, string);
} }
#endif
#else #else
static char string[ITER_STRING_LEN + 1]; static char string[ITER_STRING_LEN + 1];
#endif #endif

View File

@ -1109,17 +1109,6 @@ static const gchar *
iter_to_string (GtkTreeIter *iter) iter_to_string (GtkTreeIter *iter)
{ {
#ifdef G_THREADS_ENABLED #ifdef G_THREADS_ENABLED
#ifndef HAVE_GLIB_2_32
static GStaticPrivate gtmits_buffer_key = G_STATIC_PRIVATE_INIT;
gchar *string;
string = g_static_private_get (&gtmits_buffer_key);
if (string == NULL)
{
string = g_malloc (ITER_STRING_LEN + 1);
g_static_private_set (&gtmits_buffer_key, string, g_free);
}
#else
static GPrivate gtmits_buffer_key = G_PRIVATE_INIT (g_free); static GPrivate gtmits_buffer_key = G_PRIVATE_INIT (g_free);
gchar *string; gchar *string;
@ -1129,7 +1118,6 @@ iter_to_string (GtkTreeIter *iter)
string = g_malloc (ITER_STRING_LEN + 1); string = g_malloc (ITER_STRING_LEN + 1);
g_private_set (&gtmits_buffer_key, string); g_private_set (&gtmits_buffer_key, string);
} }
#endif
#else #else
static char string[ITER_STRING_LEN + 1]; static char string[ITER_STRING_LEN + 1];
#endif #endif

View File

@ -258,9 +258,6 @@ static gboolean qof_util_str_equal(gconstpointer v, gconstpointer v2)
void void
qof_init (void) qof_init (void)
{ {
#ifndef HAVE_GLIB_2_36
g_type_init(); /* Automatic as of GLib 2.36 */
#endif
qof_log_init(); qof_log_init();
qof_string_cache_init(); qof_string_cache_init();
qof_object_initialize (); qof_object_initialize ();

View File

@ -46,12 +46,6 @@ extern "C"
# include "strptime.h" # include "strptime.h"
#endif #endif
#ifdef HAVE_GLIB_2_38
#define _Q "'"
#else
#define _Q "`"
#endif
static const gchar *suitename = "/qof/gnc-date"; static const gchar *suitename = "/qof/gnc-date";
static const time64 secs_per_year = INT64_C(3600) * (INT64_C(24) * INT64_C(365) + 6); static const time64 secs_per_year = INT64_C(3600) * (INT64_C(24) * INT64_C(365) + 6);
static const time64 max_secs = (INT64_C(3600) * (INT64_C(24) * INT64_C(365) + 6)) * (INT64_C(9999) - INT64_C(1970)); static const time64 max_secs = (INT64_C(3600) * (INT64_C(24) * INT64_C(365) + 6)) * (INT64_C(9999) - INT64_C(1970));

View File

@ -37,12 +37,6 @@ extern "C"
#include "../qofbook-p.h" #include "../qofbook-p.h"
#include "../qofbookslots.h" #include "../qofbookslots.h"
#ifdef HAVE_GLIB_2_38
#define _Q "'"
#else
#define _Q "`"
#endif
static const gchar *suitename = "/qof/qofbook"; static const gchar *suitename = "/qof/qofbook";
void test_suite_qofbook ( void ); void test_suite_qofbook ( void );
@ -782,8 +776,8 @@ test_book_foreach_collection( Fixture *fixture, gconstpointer pData )
#define _func "void qof_book_foreach_collection(const QofBook*, QofCollectionForeachCB, gpointer)" #define _func "void qof_book_foreach_collection(const QofBook*, QofCollectionForeachCB, gpointer)"
//#define _func "qof_book_foreach_collection" //#define _func "qof_book_foreach_collection"
#endif #endif
gchar *msg1 = _func ": assertion " _Q "book' failed"; gchar *msg1 = _func ": assertion 'book' failed";
gchar *msg2 = _func ": assertion " _Q "cb' failed"; gchar *msg2 = _func ": assertion 'cb' failed";
#undef _func #undef _func
gchar *log_domain = "qof"; gchar *log_domain = "qof";
guint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL, hdlr; guint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL, hdlr;

View File

@ -35,12 +35,6 @@ extern "C" void test_suite_qofinstance ( void );
static gchar* error_message; static gchar* error_message;
static gboolean is_called; static gboolean is_called;
#ifdef HAVE_GLIB_2_38
#define _Q "'"
#else
#define _Q "`"
#endif
static struct static struct
{ {
QofInstance *m_inst = nullptr; QofInstance *m_inst = nullptr;
@ -201,10 +195,10 @@ test_instance_new_destroy( void )
QofInstanceClass *klass; QofInstanceClass *klass;
/* test var */ /* test var */
Timespec *timespec_priv; Timespec *timespec_priv;
const char *msg1 = "qof_instance_get_collection: assertion " _Q "QOF_IS_INSTANCE(ptr)' failed"; const char *msg1 = "qof_instance_get_collection: assertion 'QOF_IS_INSTANCE(ptr)' failed";
const char *msg2 = "qof_instance_get_editlevel: assertion " _Q "QOF_IS_INSTANCE(ptr)' failed"; const char *msg2 = "qof_instance_get_editlevel: assertion 'QOF_IS_INSTANCE(ptr)' failed";
const char *msg3 = "qof_instance_get_destroying: assertion " _Q "QOF_IS_INSTANCE(ptr)' failed"; const char *msg3 = "qof_instance_get_destroying: assertion 'QOF_IS_INSTANCE(ptr)' failed";
const char *msg4 = "qof_instance_get_dirty_flag: assertion " _Q "QOF_IS_INSTANCE(ptr)' failed"; const char *msg4 = "qof_instance_get_dirty_flag: assertion 'QOF_IS_INSTANCE(ptr)' failed";
const char *log_domain = "qof"; const char *log_domain = "qof";
auto loglevel = static_cast<GLogLevelFlags>(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL); auto loglevel = static_cast<GLogLevelFlags>(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL);
auto check = test_error_struct_new(log_domain, loglevel, msg1); auto check = test_error_struct_new(log_domain, loglevel, msg1);
@ -244,25 +238,25 @@ test_instance_new_destroy( void )
auto hdlr = g_log_set_handler (log_domain, loglevel, auto hdlr = g_log_set_handler (log_domain, loglevel,
(GLogFunc)test_checked_handler, check); (GLogFunc)test_checked_handler, check);
g_assert( qof_instance_get_collection( inst ) == NULL ); g_assert( qof_instance_get_collection( inst ) == NULL );
g_assert( g_strrstr( error_message, "assertion " _Q "QOF_IS_INSTANCE(ptr)' failed" ) != NULL ); g_assert( g_strrstr( error_message, "assertion 'QOF_IS_INSTANCE(ptr)' failed" ) != NULL );
g_free( error_message ); g_free( error_message );
g_free(check->msg); g_free(check->msg);
check->msg = g_strdup(msg2); check->msg = g_strdup(msg2);
g_assert_cmpint( qof_instance_get_editlevel( inst ), == , 0 ); g_assert_cmpint( qof_instance_get_editlevel( inst ), == , 0 );
g_assert( g_strrstr( error_message, "assertion " _Q "QOF_IS_INSTANCE(ptr)' failed" ) != NULL ); g_assert( g_strrstr( error_message, "assertion 'QOF_IS_INSTANCE(ptr)' failed" ) != NULL );
g_free( error_message ); g_free( error_message );
g_free(check->msg); g_free(check->msg);
check->msg = g_strdup(msg3); check->msg = g_strdup(msg3);
g_assert( !qof_instance_get_destroying( inst ) ); g_assert( !qof_instance_get_destroying( inst ) );
g_assert( g_strrstr( error_message, "assertion " _Q "QOF_IS_INSTANCE(ptr)' failed" ) != NULL ); g_assert( g_strrstr( error_message, "assertion 'QOF_IS_INSTANCE(ptr)' failed" ) != NULL );
g_free( error_message ); g_free( error_message );
g_free(check->msg); g_free(check->msg);
check->msg = g_strdup(msg4); check->msg = g_strdup(msg4);
g_assert( !qof_instance_get_dirty_flag( inst ) ); g_assert( !qof_instance_get_dirty_flag( inst ) );
g_assert( g_strrstr( error_message, "assertion " _Q "QOF_IS_INSTANCE(ptr)' failed" ) != NULL ); g_assert( g_strrstr( error_message, "assertion 'QOF_IS_INSTANCE(ptr)' failed" ) != NULL );
g_free( error_message ); g_free( error_message );
g_log_remove_handler (log_domain, hdlr); g_log_remove_handler (log_domain, hdlr);
test_error_struct_free(check); test_error_struct_free(check);

View File

@ -63,11 +63,6 @@
#include "business/business-gnome/dialog-invoice.h" #include "business/business-gnome/dialog-invoice.h"
#include "business/business-gnome/business-gnome-utils.h" #include "business/business-gnome/business-gnome-utils.h"
//#ifdef HAVE_GLIB_2_14
// glib >= 2.14.0
// perl regular expressions are available
// this helper macro takes a regexp match and fills the model // this helper macro takes a regexp match and fills the model
#define FILL_IN_HELPER(match_name,column) \ #define FILL_IN_HELPER(match_name,column) \
temp = g_match_info_fetch_named (match_info, match_name); \ temp = g_match_info_fetch_named (match_info, match_name); \