Re: [sigc] Renaming nil



As promised, here is a patch.

I produced it from the public CVS repository, which seems to be lagging a bit. So expect trivial conflicts in ChangeLog.

Also I don't know what is wrong on my box, but ./autogen.sh doesn't just work. So I couldn't do any testing. Although I'm not expecting any problem, at the very least, I wanted to do 'make && make tests'. Can whoever applies this patch do that testing and just let me know if I broke something?

Thanks,
--
hpreg
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libsigc++2/ChangeLog,v
retrieving revision 1.228
diff -u -r1.228 ChangeLog
--- ChangeLog	21 Dec 2005 08:28:17 -0000	1.228
+++ ChangeLog	27 May 2006 06:40:25 -0000
@@ -1,3 +1,14 @@
+2006-05-26  Régis Duchesne <hpreg vmware com>
+
+	* sigc++/adaptors/macros/bind.h.m4:
+	* sigc++/adaptors/macros/retype.h.m4:
+	* sigc++/functors/macros/functor_trait.h.m4:
+	* sigc++/functors/macros/slot.h.m4:
+	* sigc++/macros/retype.h.m4:
+	* sigc++/macros/signal.h.m4:
+	Renamed 'nil' to 'none' to allow an Objective-C++ compiler to compile
+	the library header files.
+
 2005-12-21  Murray Cumming  <murrayc murrayc com>
 
 	* sigc++/macros/signal.h.m4: Make remaining 
Index: sigc++/adaptors/macros/bind.h.m4
===================================================================
RCS file: /cvs/gnome/libsigc++2/sigc++/adaptors/macros/bind.h.m4,v
retrieving revision 1.19
diff -u -r1.19 bind.h.m4
--- sigc++/adaptors/macros/bind.h.m4	10 Jun 2005 17:35:40 -0000	1.19
+++ sigc++/adaptors/macros/bind.h.m4	27 May 2006 06:40:26 -0000
@@ -80,7 +80,7 @@
  * @ingroup bind
  */
 template <class T_functor, class T_bound>
-struct bind_functor<$1, T_functor, T_bound, LIST(LOOP(nil, CALL_SIZE - 1))> : public adapts<T_functor>
+struct bind_functor<$1, T_functor, T_bound, LIST(LOOP(none, CALL_SIZE - 1))> : public adapts<T_functor>
 {
   typedef typename adapts<T_functor>::adaptor_type adaptor_type;
 
@@ -120,7 +120,7 @@
  * @ingroup bind
  */
 template <LIST(class T_functor, LOOP(class T_type%1, $1))>
-struct bind_functor<LIST(-1, T_functor, LIST(LOOP(T_type%1, $1), LOOP(nil, CALL_SIZE - $1)))> : public adapts<T_functor>
+struct bind_functor<LIST(-1, T_functor, LIST(LOOP(T_type%1, $1), LOOP(none, CALL_SIZE - $1)))> : public adapts<T_functor>
 {
   typedef typename adapts<T_functor>::adaptor_type adaptor_type;
 
@@ -332,7 +332,7 @@
  *
  * @ingroup bind
  */
-template <LIST(int I_location, class T_functor, LOOP(class T_type%1=nil, CALL_SIZE))>
+template <LIST(int I_location, class T_functor, LOOP(class T_type%1=none, CALL_SIZE))>
 struct bind_functor;
 
 FOR(0,eval(CALL_SIZE-1),[[BIND_FUNCTOR_LOCATION(%1)]])dnl
Index: sigc++/adaptors/macros/retype.h.m4
===================================================================
RCS file: /cvs/gnome/libsigc++2/sigc++/adaptors/macros/retype.h.m4,v
retrieving revision 1.8
diff -u -r1.8 retype.h.m4
--- sigc++/adaptors/macros/retype.h.m4	1 Feb 2005 11:02:20 -0000	1.8
+++ sigc++/adaptors/macros/retype.h.m4	27 May 2006 06:40:26 -0000
@@ -133,7 +133,7 @@
  *
  * @ingroup retype
  */
-template <LIST(class T_functor, LOOP(class T_type%1=nil, CALL_SIZE))>
+template <LIST(class T_functor, LOOP(class T_type%1=none, CALL_SIZE))>
 struct retype_functor
   : public adapts<T_functor>
 {
Index: sigc++/functors/macros/functor_trait.h.m4
===================================================================
RCS file: /cvs/gnome/libsigc++2/sigc++/functors/macros/functor_trait.h.m4,v
retrieving revision 1.4
diff -u -r1.4 functor_trait.h.m4
--- sigc++/functors/macros/functor_trait.h.m4	12 Apr 2004 21:53:37 -0000	1.4
+++ sigc++/functors/macros/functor_trait.h.m4	27 May 2006 06:40:26 -0000
@@ -77,14 +77,25 @@
 
 namespace sigc {
 
-/** nil struct type.
- * The nil struct type is used as default template argument in the
+/** none struct type.
+ * The none struct type is used as default template argument in the
  * unnumbered sigc::signal and sigc::slot templates.
  *
  * @ingroup signal
  * @ingroup slot
  */
-struct nil;
+struct none;
+
+/** nil type (deprecated).
+ * The nil type is an alias for the none struct type. It is not available when
+ * using an Objective-C++ compiler (because nil has a different meaning in
+ * Objective-C). Otherwise its use is deprecated, but it is defined so that
+ * source code written against libsigc++ versions <= 2.0.17 still compiles.
+ * @deprecated Use none instead.
+ */
+#ifndef __OBJC__
+typedef none nil;
+#endif
 
 
 /** @defgroup functors Functors
Index: sigc++/functors/macros/slot.h.m4
===================================================================
RCS file: /cvs/gnome/libsigc++2/sigc++/functors/macros/slot.h.m4,v
retrieving revision 1.17
diff -u -r1.17 slot.h.m4
--- sigc++/functors/macros/slot.h.m4	10 Jun 2005 17:35:40 -0000	1.17
+++ sigc++/functors/macros/slot.h.m4	27 May 2006 06:40:26 -0000
@@ -26,7 +26,7 @@
  * The template arguments determine the function signature of operator()():
  * - @e T_return The return type of operator()().dnl
 FOR(1,$1,[
- * - @e T_arg%1 Argument type used in the definition of operator()(). The default @p nil means no argument.])
+ * - @e T_arg%1 Argument type used in the definition of operator()(). The default @p none means no argument.])
  *
  * To use simply assign the slot to the desired functor. If the functor
  * is not compatible with the parameter list defined with the template
@@ -107,7 +107,7 @@
  * The template arguments determine the function signature of operator()():
  * - @e T_return The return type of operator()().dnl
 FOR(1,$1,[
- * - @e T_arg%1 Argument type used in the definition of operator()(). The default @p nil means no argument.])
+ * - @e T_arg%1 Argument type used in the definition of operator()(). The default @p none means no argument.])
  *
  * To use simply assign the slot to the desired functor. If the functor
  * is not compatible with the parameter list defined with the template
@@ -125,18 +125,18 @@
  *
  * @ingroup slot
  */
-template <LIST(class T_return, LOOP(class T_arg%1 = nil, $1))>],[dnl
+template <LIST(class T_return, LOOP(class T_arg%1 = none, $1))>],[dnl
 
 /** Convenience wrapper for the numbered sigc::slot$1 template.
  * See the base class for useful methods.
  * This is the template specialization of the unnumbered sigc::slot
  * template for $1 argument(s), specialized for different numbers of arguments
- * This is possible because the template has default (nil) template types.
+ * This is possible because the template has default (none) template types.
 dnl *
 dnl * @ingroup slot
  */
 template <LIST(class T_return, LOOP(class T_arg%1, $1))>])
-class slot ifelse($1, $2,,[<LIST(T_return, LIST(LOOP(T_arg%1, $1), LOOP(nil, CALL_SIZE - $1)))>])
+class slot ifelse($1, $2,,[<LIST(T_return, LIST(LOOP(T_arg%1, $1), LOOP(none, CALL_SIZE - $1)))>])
   : public slot$1<LIST(T_return, LOOP(T_arg%1, $1))>
 {
 public:
Index: sigc++/macros/retype.h.m4
===================================================================
RCS file: /cvs/gnome/libsigc++2/sigc++/macros/retype.h.m4,v
retrieving revision 1.7
diff -u -r1.7 retype.h.m4
--- sigc++/macros/retype.h.m4	1 Feb 2005 11:02:21 -0000	1.7
+++ sigc++/macros/retype.h.m4	27 May 2006 06:40:27 -0000
@@ -77,7 +77,7 @@
 
 namespace SigC {
 
-template <LIST(class T_functor, class T_return, LOOP(class T_type%1=::sigc::nil, CALL_SIZE))>
+template <LIST(class T_functor, class T_return, LOOP(class T_type%1=::sigc::none, CALL_SIZE))>
 struct retype_slot_functor
   : public ::sigc::adapts<T_functor>
 {
Index: sigc++/macros/signal.h.m4
===================================================================
RCS file: /cvs/gnome/libsigc++2/sigc++/macros/signal.h.m4,v
retrieving revision 1.24
diff -u -r1.24 signal.h.m4
--- sigc++/macros/signal.h.m4	21 Dec 2005 08:28:18 -0000	1.24
+++ sigc++/macros/signal.h.m4	27 May 2006 06:40:27 -0000
@@ -23,7 +23,7 @@
  * This template implements the emit() function of signal$1.
  * Template specializations are available to optimize signal
  * emission when no accumulator is used, i.e. the template
- * argument @e T_accumulator is @p nil.
+ * argument @e T_accumulator is @p none.
  */
 template <LIST(class T_return, LOOP(class T_arg%1, $1), class T_accumulator)>
 struct signal_emit$1
@@ -108,9 +108,9 @@
  * function for the case that no accumulator is used.
  */
 template <LIST(class T_return, LOOP(class T_arg%1, $1))>
-struct signal_emit$1<LIST(T_return, LOOP(T_arg%1, $1), nil)>
+struct signal_emit$1<LIST(T_return, LOOP(T_arg%1, $1), none)>
 {
-  typedef signal_emit$1<LIST(T_return, LOOP(T_arg%1, $1), nil) > self_type;
+  typedef signal_emit$1<LIST(T_return, LOOP(T_arg%1, $1), none) > self_type;
   typedef T_return result_type;
   typedef slot<LIST(T_return, LOOP(T_arg%1, $1))> slot_type;
   typedef signal_impl::const_iterator_type iterator_type;
@@ -206,9 +206,9 @@
  * return type is @p void.
  */
 template <LOOP(class T_arg%1, $1)>
-struct signal_emit$1<LIST(void, LOOP(T_arg%1, $1), nil)>
+struct signal_emit$1<LIST(void, LOOP(T_arg%1, $1), none)>
 {
-  typedef signal_emit$1<LIST(void, LOOP(T_arg%1, $1), nil)> self_type;
+  typedef signal_emit$1<LIST(void, LOOP(T_arg%1, $1), none)> self_type;
   typedef void result_type;
   typedef slot<LIST(void, LOOP(T_arg%1, $1))> slot_type;
   typedef signal_impl::const_iterator_type iterator_type;
@@ -284,13 +284,13 @@
  * - @e T_return The desired return type for the emit() function (may be overridden by the accumulator).dnl
 FOR(1,$1,[
  * - @e T_arg%1 Argument type used in the definition of emit().])
- * - @e T_accumulator The accumulator type used for emission. The default @p nil means that no accumulator should be used, i.e. signal emission returns the return value of the last slot invoked.
+ * - @e T_accumulator The accumulator type used for emission. The default @p none means that no accumulator should be used, i.e. signal emission returns the return value of the last slot invoked.
  *
  * You should use the more convenient unnumbered sigc::signal template.
  *
  * @ingroup signal
  */
-template <LIST(class T_return, LOOP(class T_arg%1, $1), class T_accumulator=nil)>
+template <LIST(class T_return, LOOP(class T_arg%1, $1), class T_accumulator=none)>
 class signal$1
   : public signal_base
 {
@@ -330,7 +330,7 @@
    * During signal emission all slots that have been connected
    * to the signal are invoked unless they are manually set into
    * a blocking state. The parameters are passed on to the slots.
-   * If @e T_accumulated is not @p nil, an accumulator of this type
+   * If @e T_accumulated is not @p none, an accumulator of this type
    * is used to process the return values of the slot invocations.
    * Otherwise, the return value of the last slot invoked is returned.dnl
 FOR(1, $1,[
@@ -403,7 +403,7 @@
  * the emit() function:
  * - @e T_return The desired return type of the emit() function.dnl
 FOR(1,$1,[
- * - @e T_arg%1 Argument type used in the definition of emit(). The default @p nil means no argument.])
+ * - @e T_arg%1 Argument type used in the definition of emit(). The default @p none means no argument.])
  *
  * To specify an accumulator type the nested class signal::accumulated can be used.
  *
@@ -417,7 +417,7 @@
  *
  * @ingroup signal
  */
-template <LIST(class T_return, LOOP(class T_arg%1 = nil, $1))>],[dnl
+template <LIST(class T_return, LOOP(class T_arg%1 = none, $1))>],[dnl
 
 /** Convenience wrapper for the numbered sigc::signal$1 template.
  * See the base class for useful methods.
@@ -429,8 +429,8 @@
 ])dnl
  */
 template <LIST(class T_return, LOOP(class T_arg%1, $1))>])
-class signal ifelse($1, $2,,[<LIST(T_return, LOOP(T_arg%1,$1), LOOP(nil, CALL_SIZE - $1))>])
-  : public signal$1<LIST(T_return, LOOP(T_arg%1, $1),nil)>
+class signal ifelse($1, $2,,[<LIST(T_return, LOOP(T_arg%1,$1), LOOP(none, CALL_SIZE - $1))>])
+  : public signal$1<LIST(T_return, LOOP(T_arg%1, $1),none)>
 {
 public:
 ifelse($1, $2,[dnl
@@ -498,7 +498,7 @@
 
   signal() {}
   signal(const signal& src)
-    : signal$1<LIST(T_return, LOOP(T_arg%1, $1),nil)>(src) {}
+    : signal$1<LIST(T_return, LOOP(T_arg%1, $1),none)>(src) {}
 };
 
 ])
@@ -525,12 +525,12 @@
  * - @e T_return The desired return type for the emit() function (may be overridden by the accumulator).dnl
 FOR(1,$1,[
  * - @e T_arg%1 Argument type used in the definition of emit().])
- * - @e T_accumulator The accumulator type used for emission. The default @p nil means that no accumulator should be used. Signal emission returns the return value of the last slot invoked.
+ * - @e T_accumulator The accumulator type used for emission. The default @p none means that no accumulator should be used. Signal emission returns the return value of the last slot invoked.
  *
  * @deprecated Use the unnumbered template sigc::signal instead.
  * @ingroup compat
  */
-template <LIST(class T_return, LOOP(class T_arg%1, $1), class T_accumulator=::sigc::nil)>
+template <LIST(class T_return, LOOP(class T_arg%1, $1), class T_accumulator=::sigc::none)>
 class Signal$1
   : public ::sigc::signal$1<LIST(T_return, LOOP(T_arg%1, $1), T_accumulator)>
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]