[glibmm] glibmm/main: More declarations within #ifndef GLIBMM_DISABLE_DEPRECATED
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] glibmm/main: More declarations within #ifndef GLIBMM_DISABLE_DEPRECATED
- Date: Sun, 29 Nov 2015 15:55:22 +0000 (UTC)
commit 4a98c1d3597530b28657bf9b357c0e716109a002
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date: Sun Nov 29 16:52:11 2015 +0100
glibmm/main: More declarations within #ifndef GLIBMM_DISABLE_DEPRECATED
* glib/glibmm/main.h: Include 'namespace Threads' declarations only if
GLIBMM_DISABLE_DEPRECATED is not defined.
* glib/glibmm/main.cc: Inlude glibmm/threads.h only if
GLIBMM_DISABLE_DEPRECATED is not defined.
Use G_GNUC_[BEGIN|END]_IGNORE_DEPRECATIONS instead of undefining
G_DISABLE_DEPRECATED.
glib/glibmm/main.cc | 10 ++++++----
glib/glibmm/main.h | 3 +--
2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/glib/glibmm/main.cc b/glib/glibmm/main.cc
index d44d71b..483b377 100644
--- a/glib/glibmm/main.cc
+++ b/glib/glibmm/main.cc
@@ -15,13 +15,13 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#undef G_DISABLE_DEPRECATED //So we can use newly-deprecated API, to preserve our API.
-#define GLIB_DISABLE_DEPRECATION_WARNINGS 1
-
-#include <glibmm/threads.h>
+#include <glibmmconfig.h> // May define GLIBMM_DISABLE_DEPRECATED
#ifndef GLIBMM_DISABLE_DEPRECATED
+//Include glibmm/thread.h first because we need it to be first to include <glib.h>,
+//so we can do an undef trick to still use deprecated API in the header:
#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#endif //GLIBMM_DISABLE_DEPRECATED
#include <glibmm/main.h>
@@ -976,10 +976,12 @@ void Source::remove_poll(Glib::PollFD& poll_fd)
}
#ifndef GLIBMM_DISABLE_DEPRECATED
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
void Source::get_current_time(Glib::TimeVal& current_time)
{
g_source_get_current_time(gobject_, ¤t_time);
}
+G_GNUC_END_IGNORE_DEPRECATIONS
#endif //GLIBMM_DISABLE_DEPRECATED
gint64 Source::get_time() const
diff --git a/glib/glibmm/main.h b/glib/glibmm/main.h
index 622f2db..47ce0dc 100644
--- a/glib/glibmm/main.h
+++ b/glib/glibmm/main.h
@@ -1,4 +1,3 @@
-// -*- c++ -*-
#ifndef _GLIBMM_MAIN_H
#define _GLIBMM_MAIN_H
@@ -34,13 +33,13 @@ namespace Glib
#ifndef GLIBMM_DISABLE_DEPRECATED
class Cond;
class Mutex;
-#endif //GLIBMM_DISABLE_DEPRECATED
namespace Threads
{
class Cond;
class Mutex;
}
+#endif //GLIBMM_DISABLE_DEPRECATED
/** @defgroup MainLoop The Main Event Loop
* Manages all available sources of events.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]