diff options
author | Murray Cumming <murrayc@murrayc.com> | 2007-03-03 16:34:52 +0000 |
---|---|---|
committer | Murray Cumming <murrayc@src.gnome.org> | 2007-03-03 16:34:52 +0000 |
commit | 9791c0f969b6ccc6ad5c76a425d50affd87f7926 (patch) | |
tree | 80f9effb358d7d9b13065c80cf73c2a5dee49e1d | |
parent | f7fd70136c48a3b1448ba56ca915f0dd5af97145 (diff) | |
download | glibmm-9791c0f969b6ccc6ad5c76a425d50affd87f7926.tar.gz |
Added a test for the case that time_t is equivalent to guint32, as seems
2007-03-03 Murray Cumming <murrayc@murrayc.com>
* configure.in:
* glib/glibmmconfig.h.in:
* glib/src/date.ccg:
* glib/src/date.hg:
* scripts/Makefile.am:
* scripts/c_std.m4: Added a test for the case that time_t is equivalent to
guint32, as seems to be the case on NetBSD-4.99.6/amd64, so we can ifdef-out
the (deprecated, anyway) Glib::Date::set_time(GTime) method when necessary, because
GTime is also equivalent to guint32.
Bug #386990.
svn path=/branches/glibmm-2-12/; revision=382
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | configure.in | 1 | ||||
-rw-r--r-- | glib/glibmmconfig.h.in | 2 | ||||
-rw-r--r-- | glib/src/date.ccg | 10 | ||||
-rw-r--r-- | glib/src/date.hg | 10 | ||||
-rw-r--r-- | scripts/Makefile.am | 2 | ||||
-rw-r--r-- | scripts/c_std.m4 | 43 |
7 files changed, 78 insertions, 3 deletions
@@ -1,3 +1,16 @@ +2007-03-03 Murray Cumming <murrayc@murrayc.com> + + * configure.in: + * glib/glibmmconfig.h.in: + * glib/src/date.ccg: + * glib/src/date.hg: + * scripts/Makefile.am: + * scripts/c_std.m4: Added a test for the case that time_t is equivalent to + guint32, as seems to be the case on NetBSD-4.99.6/amd64, so we can ifdef-out + the (deprecated, anyway) Glib::Date::set_time(GTime) method when necessary, because + GTime is also equivalent to guint32. + Bug #386990. + 2.12.6: 2007-02-10 Murray Cumming <murrayc@murrayc.com> diff --git a/configure.in b/configure.in index a5a04b1f..ef3eae8b 100644 --- a/configure.in +++ b/configure.in @@ -198,6 +198,7 @@ GLIBMM_CXX_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION() GLIBMM_CXX_CAN_ASSIGN_NON_EXTERN_C_FUNCTIONS_TO_EXTERN_C_CALLBACKS() GLIBMM_CXX_CAN_USE_NAMESPACES_INSIDE_EXTERNC() GLIBMM_CXX_ALLOWS_STATIC_INLINE_NPOS() +GLIBMM_C_STD_TIME_T_IS_NOT_INT32() # Create a list of input directories for Doxygen. diff --git a/glib/glibmmconfig.h.in b/glib/glibmmconfig.h.in index da7a98da..8a971fe5 100644 --- a/glib/glibmmconfig.h.in +++ b/glib/glibmmconfig.h.in @@ -37,6 +37,7 @@ #undef GLIBMM_HAVE_SUN_REVERSE_ITERATOR #undef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS #undef GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS +#undef GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32 #undef GLIBMM_COMPILER_SUN_FORTE #undef GLIBMM_DEBUG_REFCOUNTING #undef GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION @@ -56,6 +57,7 @@ #define GLIBMM_HAVE_STD_ITERATOR_TRAITS 1 #define GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS 2 #define GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS 1 + #define GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32 1 #define GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION 1 #define GLIBMM_CAN_ASSIGN_NON_EXTERN_C_FUNCTIONS_TO_EXTERN_C_CALLBACKS 1 #define GLIBMM_CAN_USE_NAMESPACES_INSIDE_EXTERNC 1 diff --git a/glib/src/date.ccg b/glib/src/date.ccg index 47b6fdd5..8f66c8e8 100644 --- a/glib/src/date.ccg +++ b/glib/src/date.ccg @@ -1,5 +1,5 @@ // -*- c++ -*- -/* $Id$ */ +/* $Id: date.ccg,v 1.7 2006/07/16 13:54:02 jjongsma Exp $ */ /* Copyright (C) 2002 The gtkmm Development Team * @@ -65,14 +65,22 @@ void Date::set_parse(const Glib::ustring& str) g_date_set_parse(&gobject_, str.c_str()); } + _DEPRECATE_IFDEF_START + +//Avoid a build problem in the case that time_t is equivalent to guint32 (GTime is also guint32) +//That would make the set_time() method overload impossible. +#ifdef GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32 void Date::set_time(GTime time) { //This method, and the C function that it wraps, are deprecated. g_date_set_time(&gobject_, time); } +#endif //GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32 + _DEPRECATE_IFDEF_END + void Date::set_time(time_t timet) { g_date_set_time_t(&gobject_, timet); diff --git a/glib/src/date.hg b/glib/src/date.hg index 0a223901..9d04a297 100644 --- a/glib/src/date.hg +++ b/glib/src/date.hg @@ -1,4 +1,4 @@ -/* $Id$ */ +/* $Id: date.hg,v 1.6 2005/11/29 15:53:27 murrayc Exp $ */ /* Copyright (C) 2002 The gtkmm Development Team * @@ -70,7 +70,12 @@ public: */ void set_parse (const Glib::ustring& str); + _DEPRECATE_IFDEF_START + + //Avoid a build problem in the case that time_t is equivalent to guint32 (GTime is also guint32) + //That would make the set_time() method overload impossible. + #ifdef GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32 /** Sets the value of a date from a GTime (time_t) value. * * @param time GTime value to set. @@ -78,8 +83,11 @@ public: * @deprecated Please use set_time(time_t) or set_time(const GTimeVal&). */ void set_time(GTime time); + #endif //GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32 + _DEPRECATE_IFDEF_END + /** Sets the value of a date from a <type>time_t</type> value. * * @param timet time_t value to set diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 0edd72f1..6a387909 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -3,6 +3,6 @@ m4dir = $(datadir)/aclocal m4_DATA = glibmm_check_perl.m4 EXTRA_DIST = README config.sub missing config.guess install-sh \ - ltmain.sh cxx.m4 cxx_std.m4 docgen.m4 macros.m4 reduced.m4 \ + ltmain.sh cxx.m4 cxx_std.m4 c_std.m4 docgen.m4 macros.m4 reduced.m4 \ $(m4_DATA) diff --git a/scripts/c_std.m4 b/scripts/c_std.m4 new file mode 100644 index 00000000..f4a8b56f --- /dev/null +++ b/scripts/c_std.m4 @@ -0,0 +1,43 @@ +cv_c_std_time_t_is_not_int32 +## GLIBMM_CXX_HAS_NAMESPACE_STD() +## +## Test whether libstdc++ declares namespace std. For safety, +## also check whether several randomly selected STL symbols +## are available in namespace std. +## +## On success, #define GLIBMM_HAVE_NAMESPACE_STD to 1. +## +AC_DEFUN([GLIBMM_C_STD_TIME_T_IS_NOT_INT32], +[ + AC_CACHE_CHECK( + [whether time_t is not equivalent to gint32, meaning that it can be used for a method overload], + [gtkmm_cv_c_std_time_t_is_not_int32], + [ + AC_TRY_COMPILE( + [ + #include <time.h> + ],[ + typedef signed int gint32; + class Test + { + void something(gint32 val) + {} + + void something(time_t val) + {} + }; + ], + [gtkmm_cv_c_std_time_t_is_not_int32="yes"], + [gtkmm_cv_c_std_time_t_is_not_int32="no"] + ) + ]) + + if test "x${gtkmm_cv_c_std_time_t_is_not_int32}" = "xyes"; then + { + AC_DEFINE([GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32],[1], [Defined when time_t is not equivalent to gint32, meaning that it can be used for a method overload]) + } + fi +]) + + + |