[glibmm] Fix the build with --disable-deprecated-api
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Fix the build with --disable-deprecated-api
- Date: Sat, 5 Dec 2015 10:56:56 +0000 (UTC)
commit c3101a0bc7c5d0d2cca7c2c7e6f7e6d4882f5cd1
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date: Sat Dec 5 11:51:36 2015 +0100
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.
examples/thread/threadpool.cc | 17 ++++++++++++++---
gio/src/action.hg | 2 ++
gio/src/actiongroup.hg | 2 ++
gio/src/appinfo.hg | 2 ++
gio/src/asyncresult.hg | 4 ++--
gio/src/memoryinputstream.hg | 2 ++
gio/src/menuitem.ccg | 2 ++
gio/src/menuitem.hg | 2 ++
gio/src/notification.hg | 2 ++
gio/src/unixsocketaddress.hg | 2 ++
glib/glibmm/sarray.h | 6 ++----
glib/glibmm/threadpool.cc | 4 +---
glib/glibmm/threadpool.h | 5 ++---
glib/src/filelist.am | 16 +++++++---------
14 files changed, 44 insertions(+), 24 deletions(-)
---
diff --git a/examples/thread/threadpool.cc b/examples/thread/threadpool.cc
index b1a382d..5109674 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
diff --git a/gio/src/action.hg b/gio/src/action.hg
index 1b10876..8788da3 100644
--- a/gio/src/action.hg
+++ b/gio/src/action.hg
@@ -15,6 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+_CONFIGINCLUDE(giommconfig.h)
+
#include <glibmm/interface.h>
#include <glibmm/varianttype.h>
#include <gio/gio.h>
diff --git a/gio/src/actiongroup.hg b/gio/src/actiongroup.hg
index 99af197..3e42368 100644
--- a/gio/src/actiongroup.hg
+++ b/gio/src/actiongroup.hg
@@ -15,6 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+_CONFIGINCLUDE(giommconfig.h)
+
#include <glibmm/interface.h>
#include <glibmm/varianttype.h>
#include <gio/gio.h> //To declare g_action_group_get_action_state_type().
diff --git a/gio/src/appinfo.hg b/gio/src/appinfo.hg
index 330e2a2..848f7fc 100644
--- a/gio/src/appinfo.hg
+++ b/gio/src/appinfo.hg
@@ -15,6 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+_CONFIGINCLUDE(giommconfig.h)
+
#include <giomm/applaunchcontext.h>
#include <exception>
diff --git a/gio/src/asyncresult.hg b/gio/src/asyncresult.hg
index 7705700..395b63f 100644
--- a/gio/src/asyncresult.hg
+++ b/gio/src/asyncresult.hg
@@ -1,5 +1,3 @@
-// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-
/* Copyright (C) 2007 The giomm Development Team
*
* This library is free software; you can redistribute it and/or
@@ -17,6 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+_CONFIGINCLUDE(giommconfig.h)
+
#include <glibmm/interface.h>
#include <glibmm/object.h>
diff --git a/gio/src/memoryinputstream.hg b/gio/src/memoryinputstream.hg
index 0d51959..9ac5f9a 100644
--- a/gio/src/memoryinputstream.hg
+++ b/gio/src/memoryinputstream.hg
@@ -15,6 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+_CONFIGINCLUDE(giommconfig.h)
+
#include <giomm/inputstream.h>
#include <giomm/seekable.h>
diff --git a/gio/src/menuitem.ccg b/gio/src/menuitem.ccg
index 5903cd7..6483f42 100644
--- a/gio/src/menuitem.ccg
+++ b/gio/src/menuitem.ccg
@@ -45,10 +45,12 @@ MenuItem::MenuItem(const Glib::RefPtr<MenuModel>& submenu)
set_submenu(submenu);
}
+_DEPRECATE_IFDEF_START
void MenuItem::set_action_and_target(const Glib::ustring& action)
{
g_menu_item_set_action_and_target_value(gobj(), action.c_str(), nullptr);
}
+_DEPRECATE_IFDEF_END
void MenuItem::set_action(const Glib::ustring& action)
{
diff --git a/gio/src/menuitem.hg b/gio/src/menuitem.hg
index 258aba9..9c54a45 100644
--- a/gio/src/menuitem.hg
+++ b/gio/src/menuitem.hg
@@ -15,6 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+_CONFIGINCLUDE(giommconfig.h)
+
#include <glibmm/object.h>
#include <giomm/menumodel.h>
#include <giomm/icon.h>
diff --git a/gio/src/notification.hg b/gio/src/notification.hg
index 83c38ba..02ff5e8 100644
--- a/gio/src/notification.hg
+++ b/gio/src/notification.hg
@@ -14,6 +14,8 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
+_CONFIGINCLUDE(giommconfig.h)
+
#include <glibmm/object.h>
#include <glibmm/ustring.h>
#include <glibmm/variant.h>
diff --git a/gio/src/unixsocketaddress.hg b/gio/src/unixsocketaddress.hg
index 5fe8010..e3e4170 100644
--- a/gio/src/unixsocketaddress.hg
+++ b/gio/src/unixsocketaddress.hg
@@ -15,6 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+_CONFIGINCLUDE(giommconfig.h)
+
#include <giomm/socketaddress.h>
_DEFS(giomm,gio)
diff --git a/glib/glibmm/sarray.h b/glib/glibmm/sarray.h
index 6226f50..2ec2fea 100644
--- a/glib/glibmm/sarray.h
+++ b/glib/glibmm/sarray.h
@@ -1,9 +1,6 @@
-// -*- c++ -*-
#ifndef _GLIBMM_SARRAY_H
#define _GLIBMM_SARRAY_H
-/* $Id$ */
-
/* array.h
*
* Copyright (C) 2002 The gtkmm Development Team
@@ -23,6 +20,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmmconfig.h>
+
#ifndef GLIBMM_DISABLE_DEPRECATED
#include <glibmm/arrayhandle.h>
#include <glibmm/ustring.h>
@@ -39,4 +38,3 @@ typedef Glib::ArrayHandle<Glib::ustring> SArray;
#endif //GLIBMM_DISABLE_DEPRECATED
#endif // _GLIBMM_SARRAY_H
-
diff --git a/glib/glibmm/threadpool.cc b/glib/glibmm/threadpool.cc
index 198e7ed..f021815 100644
--- a/glib/glibmm/threadpool.cc
+++ b/glib/glibmm/threadpool.cc
@@ -1,5 +1,3 @@
-// -*- c++ -*-
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
@@ -17,9 +15,9 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmmconfig.h>
#ifndef GLIBMM_DISABLE_DEPRECATED
-#include <glibmmconfig.h>
#include <glibmm/threadpool.h>
#include <glibmm/exceptionhandler.h>
#include <glibmm/threads.h>
diff --git a/glib/glibmm/threadpool.h b/glib/glibmm/threadpool.h
index 8b92010..fbf4739 100644
--- a/glib/glibmm/threadpool.h
+++ b/glib/glibmm/threadpool.h
@@ -1,9 +1,6 @@
-// -*- c++ -*-
#ifndef _GLIBMM_THREADPOOL_H
#define _GLIBMM_THREADPOOL_H
-/* $Id$ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
@@ -21,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmmconfig.h>
+
#ifndef GLIBMM_DISABLE_DEPRECATED
#include <sigc++/sigc++.h>
diff --git a/glib/src/filelist.am b/glib/src/filelist.am
index 9434132..a35ffdc 100644
--- a/glib/src/filelist.am
+++ b/glib/src/filelist.am
@@ -35,26 +35,24 @@ glibmm_files_any_hg = \
regex.hg \
shell.hg \
spawn.hg \
+ thread.hg \
threads.hg \
timezone.hg \
unicode.hg \
uriutils.hg \
+ valuearray.hg \
variant.hg \
variantdict.hg \
variantiter.hg \
varianttype.hg
-glibmm_files_deprecated_hg = \
- thread.hg \
- valuearray.hg
-
-if DISABLE_DEPRECATED_API
+## Unconditionally used files,
+## deprecated files (even if configured with --disable-deprecated-api),
+## if there are architecture-specific files, only those for the present architecture.
glibmm_files_used_hg = $(glibmm_files_any_hg)
-else
-glibmm_files_used_hg = $(glibmm_files_any_hg) $(glibmm_files_deprecated_hg)
-endif
-glibmm_files_hg = $(glibmm_files_any_hg) $(glibmm_files_deprecated_hg)
+## All .hg files
+glibmm_files_hg = $(glibmm_files_any_hg)
glibmm_files_ccg = $(glibmm_files_hg:.hg=.ccg)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]