From 8acbc41c61f63149a0583e4fe49dc133eb081d5f Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Thu, 16 Mar 2017 22:21:26 +0100 Subject: [PATCH] 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 --- CMakeLists.txt | 6 +-- configure.ac | 62 ++++------------------ src/CMakeLists.txt | 12 ----- src/backend/xml/io-gncxml-v2.cpp | 5 -- src/bin/gnucash-bin.c | 3 -- src/config.h.cmake.in | 9 ---- src/engine/test/utest-Account.cpp | 19 +++---- src/engine/test/utest-Split.cpp | 7 +-- src/engine/test/utest-Transaction.cpp | 13 ++--- src/gnome-utils/gnc-tree-model-account.c | 12 ----- src/gnome-utils/gnc-tree-model-commodity.c | 12 ----- src/gnome-utils/gnc-tree-model-owner.c | 12 ----- src/gnome-utils/gnc-tree-model-price.c | 12 ----- src/gnome-utils/gnc-tree-model-split-reg.c | 12 ----- src/libqof/qof/qofutil.cpp | 3 -- src/libqof/qof/test/test-gnc-date.c | 6 --- src/libqof/qof/test/test-qofbook.c | 10 +--- src/libqof/qof/test/test-qofinstance.cpp | 22 +++----- src/plugins/bi_import/dialog-bi-import.c | 5 -- 19 files changed, 35 insertions(+), 207 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 252f7bc0ea..7343b9db04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,7 +163,7 @@ IF (NOT PKG_CONFIG_FOUND) ENDIF (NOT PKG_CONFIG_FOUND) # 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 (GMODULE REQUIRED gmodule-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) 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") ENDIF (UNIX) 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 ENDIF (MINGW) IF (APPLE) diff --git a/configure.ac b/configure.ac index 54ccef9de3..b7aa9a8950 100644 --- a/configure.ac +++ b/configure.ac @@ -69,9 +69,13 @@ AC_PROG_CC AM_PROG_CC_C_O AC_GNU_SOURCE AC_PROG_INTLTOOL -# Ensure the compiler supports C++ 11: +# Ensure the C++ compiler supports C++ 11: 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_MINOR_VERSION) @@ -329,46 +333,10 @@ AM_BINRELOC ### -------------------------------------------------------------------------- ### Glib checks. -# We require glib >= 2.28, released together with gtk-2.24; -# We first check for other versions due to required C standard and deprecations. -# 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) - ]) - ]) - ]) -]) +# We require glib >= 2.40 +PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.40 gthread-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) GLIB_GSETTINGS @@ -393,18 +361,8 @@ AC_TRY_RUN([ ],[ 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 -])], [ac_cv_cstd=gnu99], [ac_cv_cstd=gnu11]) CFLAGS="$GNC_OLDCFLAGS" 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 # is needed optionally in one place for BSD linkers, though. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2d0a3105ad..bb169b02cc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -100,18 +100,6 @@ IF (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) SET(GNOME_DISABLE_DEPRECATED 1) ENDIF(DISABLE_DEPRECATED_GNOME) diff --git a/src/backend/xml/io-gncxml-v2.cpp b/src/backend/xml/io-gncxml-v2.cpp index 37b9425693..88062ea658 100644 --- a/src/backend/xml/io-gncxml-v2.cpp +++ b/src/backend/xml/io-gncxml-v2.cpp @@ -1560,13 +1560,8 @@ try_gz_open (const char* filename, const char* perms, gboolean use_gzip, params->perms = g_strdup (perms); 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, params); -#endif if (!thread) { g_warning ("Could not create thread for (de)compression: %s", diff --git a/src/bin/gnucash-bin.c b/src/bin/gnucash-bin.c index dd5ab49283..f9c8d5aa21 100644 --- a/src/bin/gnucash-bin.c +++ b/src/bin/gnucash-bin.c @@ -746,9 +746,6 @@ main(int argc, char ** argv) #if !defined(G_THREADS_ENABLED) || defined(G_THREADS_IMPL_NONE) # error "No GLib thread implementation available!" #endif -#ifndef HAVE_GLIB_2_32 /* Automatic after GLib 2-32 */ - g_thread_init(NULL); -#endif #ifdef ENABLE_BINRELOC { GError *binreloc_error = NULL; diff --git a/src/config.h.cmake.in b/src/config.h.cmake.in index 22f69a4d5b..eca10bddb0 100644 --- a/src/config.h.cmake.in +++ b/src/config.h.cmake.in @@ -122,15 +122,6 @@ /* Define to 1 if you have the `getuid' function. */ #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 header file. */ #cmakedefine HAVE_GLOB_H 1 diff --git a/src/engine/test/utest-Account.cpp b/src/engine/test/utest-Account.cpp index 81990f6385..5c67184501 100644 --- a/src/engine/test/utest-Account.cpp +++ b/src/engine/test/utest-Account.cpp @@ -35,11 +35,6 @@ extern "C" #include "../Transaction.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)) #define USE_CLANG_FUNC_SIG 1 #endif @@ -477,7 +472,7 @@ test_gnc_account_list_name_violations (Fixture *fixture, gconstpointer pData) #else #define _func "gnc_account_list_name_violations" #endif - auto msg = _func ": assertion " _Q "separator != NULL' failed"; + auto msg = _func ": assertion 'separator != NULL' failed"; #undef _func auto check = test_error_struct_new(log_domain, log_level, msg); GList *results, *res_iter; @@ -763,8 +758,8 @@ test_xaccCloneAccount (Fixture *fixture, gconstpointer pData) #else #define _func "xaccCloneAccount" #endif - auto msg1 = _func ": assertion " _Q "GNC_IS_ACCOUNT(from)' failed"; - auto msg2 = _func ": assertion " _Q "QOF_IS_BOOK(book)' failed"; + auto msg1 = _func ": assertion 'GNC_IS_ACCOUNT(from)' failed"; + auto msg2 = _func ": assertion 'QOF_IS_BOOK(book)' failed"; #undef _func auto check = test_error_struct_new("gnc.engine", loglevel, msg1); AccountPrivate *acct_p, *clone_p; @@ -868,7 +863,7 @@ test_xaccFreeAccount (Fixture *fixture, gconstpointer pData) #else #define _func "xaccTransGetSplitIndex" #endif - auto msg2 = _func ": assertion " _Q "trans && split' failed"; + auto msg2 = _func ": assertion 'trans && split' failed"; #undef _func auto loglevel = static_cast(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL); auto check1 = test_error_struct_new("gnc.account", loglevel, msg1); @@ -982,7 +977,7 @@ test_xaccAccountCommitEdit (Fixture *fixture, gconstpointer pData) #else #define _func "xaccTransGetSplitIndex" #endif - auto msg2 = _func ": assertion " _Q "trans && split' failed"; + auto msg2 = _func ": assertion 'trans && split' failed"; #undef _func auto loglevel = static_cast(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL); 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 #define _func "gnc_account_insert_split" #endif - auto msg1 = _func ": assertion " _Q "GNC_IS_ACCOUNT(acc)' failed"; - auto msg2 = _func ": assertion " _Q "GNC_IS_SPLIT(s)' failed"; + auto msg1 = _func ": assertion 'GNC_IS_ACCOUNT(acc)' failed"; + auto msg2 = _func ": assertion 'GNC_IS_SPLIT(s)' failed"; #undef _func auto loglevel = static_cast(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL); // auto log_domain = "gnc.engine"; diff --git a/src/engine/test/utest-Split.cpp b/src/engine/test/utest-Split.cpp index 36a2663fa9..a0e9ceb961 100644 --- a/src/engine/test/utest-Split.cpp +++ b/src/engine/test/utest-Split.cpp @@ -37,11 +37,6 @@ extern "C" #include #include -#ifdef HAVE_GLIB_2_38 -#define _Q "'" -#else -#define _Q "`" -#endif #if defined(__clang__) && (__clang_major__ == 5 || (__clang_major__ == 3 && __clang_minor__ < 5)) #define USE_CLANG_FUNC_SIG 1 #endif @@ -1290,7 +1285,7 @@ test_get_corr_account_split (Fixture *fixture, gconstpointer pData) #else #define _func "get_corr_account_split" #endif - gchar *msg = _func ": assertion " _Q "sa' failed"; + gchar *msg = _func ": assertion 'sa' failed"; #undef _func GLogLevelFlags loglevel = static_cast(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL); TestErrorStruct *check = test_error_struct_new ("gnc.engine", diff --git a/src/engine/test/utest-Transaction.cpp b/src/engine/test/utest-Transaction.cpp index 5982ba81f0..9b5f56d56b 100644 --- a/src/engine/test/utest-Transaction.cpp +++ b/src/engine/test/utest-Transaction.cpp @@ -36,11 +36,6 @@ extern "C" #include "../gnc-event.h" #include -#ifdef HAVE_GLIB_2_38 -#define _Q "'" -#else -#define _Q "`" -#endif #if defined(__clang__) && (__clang_major__ == 5 || (__clang_major__ == 3 && __clang_minor__ < 5)) #define USE_CLANG_FUNC_SIG 1 #endif @@ -423,7 +418,7 @@ test_gnc_transaction_set_get_property (Fixture *fixture, gconstpointer pData) char buff[80]; 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", 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_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), "num", &t_num, "description", &t_desc, @@ -501,7 +496,7 @@ test_xaccMallocTransaction (Fixture *fixture, gconstpointer pData) #else #define _func "xaccMallocTransaction" #endif - auto msg = _func ": assertion " _Q "book' failed"; + auto msg = _func ": assertion 'book' failed"; #undef _func auto logdomain = "gnc.engine"; auto loglevel = static_cast(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL); @@ -1288,7 +1283,7 @@ test_xaccTransGetAccountBalance (Fixture *fixture, gconstpointer pData) #else #define _func "xaccTransGetAccountBalance" #endif - auto msg1 = _func ": assertion " _Q "account && trans' failed"; + auto msg1 = _func ": assertion 'account && trans' failed"; #undef _func auto loglevel = static_cast(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL); auto check = test_error_struct_new ("gnc.engine", loglevel, msg1); diff --git a/src/gnome-utils/gnc-tree-model-account.c b/src/gnome-utils/gnc-tree-model-account.c index 12a8aa3b96..ded9207bb2 100644 --- a/src/gnome-utils/gnc-tree-model-account.c +++ b/src/gnome-utils/gnc-tree-model-account.c @@ -315,17 +315,6 @@ static const gchar * iter_to_string (GtkTreeIter *iter) { #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 (>mits_buffer_key); - if (string == NULL) - { - string = g_malloc(ITER_STRING_LEN + 1); - g_static_private_set (>mits_buffer_key, string, g_free); - } -#else static GPrivate gtmits_buffer_key = G_PRIVATE_INIT(g_free); gchar *string; @@ -335,7 +324,6 @@ iter_to_string (GtkTreeIter *iter) string = g_malloc(ITER_STRING_LEN + 1); g_private_set (>mits_buffer_key, string); } -#endif #else static char string[ITER_STRING_LEN + 1]; #endif diff --git a/src/gnome-utils/gnc-tree-model-commodity.c b/src/gnome-utils/gnc-tree-model-commodity.c index 5db3802d83..c911845b81 100644 --- a/src/gnome-utils/gnc-tree-model-commodity.c +++ b/src/gnome-utils/gnc-tree-model-commodity.c @@ -315,17 +315,6 @@ iter_to_string (GtkTreeIter *iter) gnc_commodity_namespace *name_space; gnc_commodity *commodity = NULL; #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 (>mits_buffer_key); - if (string == NULL) - { - string = g_malloc(ITER_STRING_LEN + 1); - g_static_private_set (>mits_buffer_key, string, g_free); - } -#else static GPrivate gtmits_buffer_key = G_PRIVATE_INIT(g_free); gchar *string; @@ -335,7 +324,6 @@ iter_to_string (GtkTreeIter *iter) string = g_malloc(ITER_STRING_LEN + 1); g_private_set (>mits_buffer_key, string); } -#endif #else static char string[ITER_STRING_LEN + 1]; #endif diff --git a/src/gnome-utils/gnc-tree-model-owner.c b/src/gnome-utils/gnc-tree-model-owner.c index a94e276a73..8f0183ecca 100644 --- a/src/gnome-utils/gnc-tree-model-owner.c +++ b/src/gnome-utils/gnc-tree-model-owner.c @@ -317,17 +317,6 @@ static const gchar * iter_to_string (GtkTreeIter *iter) { #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 (>mits_buffer_key); - if (string == NULL) - { - string = g_malloc(ITER_STRING_LEN + 1); - g_static_private_set (>mits_buffer_key, string, g_free); - } -#else static GPrivate gtmits_buffer_key = G_PRIVATE_INIT(g_free); gchar *string; @@ -337,7 +326,6 @@ iter_to_string (GtkTreeIter *iter) string = g_malloc(ITER_STRING_LEN + 1); g_private_set (>mits_buffer_key, string); } -#endif #else static char string[ITER_STRING_LEN + 1]; #endif diff --git a/src/gnome-utils/gnc-tree-model-price.c b/src/gnome-utils/gnc-tree-model-price.c index ec41172310..28964b7e6c 100644 --- a/src/gnome-utils/gnc-tree-model-price.c +++ b/src/gnome-utils/gnc-tree-model-price.c @@ -379,17 +379,6 @@ iter_to_string (GncTreeModelPrice *model, GtkTreeIter *iter) gnc_commodity *commodity; GNCPrice *price; #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 (>mits_buffer_key); - if (string == NULL) - { - string = g_malloc(ITER_STRING_LEN + 1); - g_static_private_set (>mits_buffer_key, string, g_free); - } -#else static GPrivate gtmits_buffer_key = G_PRIVATE_INIT(g_free); gchar *string; @@ -399,7 +388,6 @@ iter_to_string (GncTreeModelPrice *model, GtkTreeIter *iter) string = g_malloc(ITER_STRING_LEN + 1); g_private_set (>mits_buffer_key, string); } -#endif #else static char string[ITER_STRING_LEN + 1]; #endif diff --git a/src/gnome-utils/gnc-tree-model-split-reg.c b/src/gnome-utils/gnc-tree-model-split-reg.c index 051059bf04..48e77d5c4c 100644 --- a/src/gnome-utils/gnc-tree-model-split-reg.c +++ b/src/gnome-utils/gnc-tree-model-split-reg.c @@ -1109,17 +1109,6 @@ static const gchar * iter_to_string (GtkTreeIter *iter) { #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 (>mits_buffer_key); - if (string == NULL) - { - string = g_malloc (ITER_STRING_LEN + 1); - g_static_private_set (>mits_buffer_key, string, g_free); - } -#else static GPrivate gtmits_buffer_key = G_PRIVATE_INIT (g_free); gchar *string; @@ -1129,7 +1118,6 @@ iter_to_string (GtkTreeIter *iter) string = g_malloc (ITER_STRING_LEN + 1); g_private_set (>mits_buffer_key, string); } -#endif #else static char string[ITER_STRING_LEN + 1]; #endif diff --git a/src/libqof/qof/qofutil.cpp b/src/libqof/qof/qofutil.cpp index 0e988b8dae..8394eecf0d 100644 --- a/src/libqof/qof/qofutil.cpp +++ b/src/libqof/qof/qofutil.cpp @@ -258,9 +258,6 @@ static gboolean qof_util_str_equal(gconstpointer v, gconstpointer v2) void qof_init (void) { -#ifndef HAVE_GLIB_2_36 - g_type_init(); /* Automatic as of GLib 2.36 */ -#endif qof_log_init(); qof_string_cache_init(); qof_object_initialize (); diff --git a/src/libqof/qof/test/test-gnc-date.c b/src/libqof/qof/test/test-gnc-date.c index 1d24e35414..73bccbaffd 100644 --- a/src/libqof/qof/test/test-gnc-date.c +++ b/src/libqof/qof/test/test-gnc-date.c @@ -46,12 +46,6 @@ extern "C" # include "strptime.h" #endif -#ifdef HAVE_GLIB_2_38 -#define _Q "'" -#else -#define _Q "`" -#endif - 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 max_secs = (INT64_C(3600) * (INT64_C(24) * INT64_C(365) + 6)) * (INT64_C(9999) - INT64_C(1970)); diff --git a/src/libqof/qof/test/test-qofbook.c b/src/libqof/qof/test/test-qofbook.c index ee086a1fbe..aaee600163 100644 --- a/src/libqof/qof/test/test-qofbook.c +++ b/src/libqof/qof/test/test-qofbook.c @@ -37,12 +37,6 @@ extern "C" #include "../qofbook-p.h" #include "../qofbookslots.h" -#ifdef HAVE_GLIB_2_38 -#define _Q "'" -#else -#define _Q "`" -#endif - static const gchar *suitename = "/qof/qofbook"; 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 "qof_book_foreach_collection" #endif - gchar *msg1 = _func ": assertion " _Q "book' failed"; - gchar *msg2 = _func ": assertion " _Q "cb' failed"; + gchar *msg1 = _func ": assertion 'book' failed"; + gchar *msg2 = _func ": assertion 'cb' failed"; #undef _func gchar *log_domain = "qof"; guint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL, hdlr; diff --git a/src/libqof/qof/test/test-qofinstance.cpp b/src/libqof/qof/test/test-qofinstance.cpp index e9e3c6b56c..2758c109aa 100644 --- a/src/libqof/qof/test/test-qofinstance.cpp +++ b/src/libqof/qof/test/test-qofinstance.cpp @@ -35,12 +35,6 @@ extern "C" void test_suite_qofinstance ( void ); static gchar* error_message; static gboolean is_called; -#ifdef HAVE_GLIB_2_38 -#define _Q "'" -#else -#define _Q "`" -#endif - static struct { QofInstance *m_inst = nullptr; @@ -201,10 +195,10 @@ test_instance_new_destroy( void ) QofInstanceClass *klass; /* test var */ Timespec *timespec_priv; - const char *msg1 = "qof_instance_get_collection: assertion " _Q "QOF_IS_INSTANCE(ptr)' failed"; - const char *msg2 = "qof_instance_get_editlevel: assertion " _Q "QOF_IS_INSTANCE(ptr)' failed"; - const char *msg3 = "qof_instance_get_destroying: assertion " _Q "QOF_IS_INSTANCE(ptr)' failed"; - const char *msg4 = "qof_instance_get_dirty_flag: 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 '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 'QOF_IS_INSTANCE(ptr)' failed"; const char *log_domain = "qof"; auto loglevel = static_cast(G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL); 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, (GLogFunc)test_checked_handler, check); 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(check->msg); check->msg = g_strdup(msg2); 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(check->msg); check->msg = g_strdup(msg3); 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(check->msg); check->msg = g_strdup(msg4); 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_log_remove_handler (log_domain, hdlr); test_error_struct_free(check); diff --git a/src/plugins/bi_import/dialog-bi-import.c b/src/plugins/bi_import/dialog-bi-import.c index 1a84e26f94..f8c25494d4 100644 --- a/src/plugins/bi_import/dialog-bi-import.c +++ b/src/plugins/bi_import/dialog-bi-import.c @@ -63,11 +63,6 @@ #include "business/business-gnome/dialog-invoice.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 #define FILL_IN_HELPER(match_name,column) \ temp = g_match_info_fetch_named (match_info, match_name); \