summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjell.ahlstedt@bredband.net>2015-12-05 11:51:36 +0100
committerKjell Ahlstedt <kjell.ahlstedt@bredband.net>2015-12-05 11:51:36 +0100
commitc3101a0bc7c5d0d2cca7c2c7e6f7e6d4882f5cd1 (patch)
treeec43315a802da7bdcfb0aa443aac5d944d2620cd /examples
parent1b5cab8581c9c412ea2cf3f5f7b5de0add9d870d (diff)
downloadglibmm-c3101a0bc7c5d0d2cca7c2c7e6f7e6d4882f5cd1.tar.gz
Fix the build with --disable-deprecated-api
* examples/thread/threadpool.cc: If --disable-deprecated-api, just print a message and exit. * gio/src/<several>.hg: Add _CONFIGINCLUDE(giommconfig.h). * gio/src/menuitem.ccg: Add a missing _DEPRECATE_IFDEF_START/_END pair. * glib/glibmm/sarray.h: * glib/glibmm/threadpool.[cc|h]: #include <glibmmconfig.h> before ifndef GLIBMM_DISABLE_DEPRECATED. * glib/src/filelist.am: Remove glibmm_files_deprecated_hg. List deprecated files in glibmm_files_any_hg. The config file must be included before #ifndef xxx_DISABLE_DEPRECATED both in the .h file and in the .cc file, or else deprecated API is not properly disabled by --disable-deprecated-api.
Diffstat (limited to 'examples')
-rw-r--r--examples/thread/threadpool.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/examples/thread/threadpool.cc b/examples/thread/threadpool.cc
index b1a382da..51096746 100644
--- a/examples/thread/threadpool.cc
+++ b/examples/thread/threadpool.cc
@@ -7,12 +7,23 @@
//TODO: Maybe use std::async() instead?
#undef GLIBMM_DISABLE_DEPRECATED
+#include <glibmmconfig.h>
+
+#ifdef GLIBMM_DISABLE_DEPRECATED
+int main(int, char**)
+{
+ // If glibmm is configured with --disable-deprecated-api,
+ // GLIBMM_DISABLE_DEPRECATED is defined in glibmmconfig.h.
+ std::cout << "Glib::ThreadPool not available because deprecated API has been disabled." << std::endl;
+ return 77; // Tell automake's test harness to skip this test.
+}
+
+#else
+
#include <glibmm/random.h>
#include <glibmm/threadpool.h>
#include <glibmm/timer.h>
-
-
namespace
{
@@ -51,4 +62,4 @@ int main(int, char**)
return 0;
}
-
+#endif //GLIBMM_DISABLE_DEPRECATED