[Rcpp-commits] r1146 - in pkg/Rcpp: inst inst/include/Rcpp src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon May 3 21:57:06 CEST 2010


Author: romain
Date: 2010-05-03 21:57:06 +0200 (Mon, 03 May 2010)
New Revision: 1146

Modified:
   pkg/Rcpp/inst/ChangeLog
   pkg/Rcpp/inst/include/Rcpp/exceptions.h
   pkg/Rcpp/src/exceptions.cpp
Log:
do the same for simple exception classes

Modified: pkg/Rcpp/inst/ChangeLog
===================================================================
--- pkg/Rcpp/inst/ChangeLog	2010-05-03 18:56:22 UTC (rev 1145)
+++ pkg/Rcpp/inst/ChangeLog	2010-05-03 19:57:06 UTC (rev 1146)
@@ -1,3 +1,10 @@
+2010-05-03	Romain Francois <romain at r-enthusiasts.com>
+
+	* inst/include/Rcpp/exceptions.h : move the what methods of exception 
+	classes so that the symbol is defined for sure in the shared library. This
+	seems to make a difference dur to vague linkage issues. decrypted from
+	http://gcc.gnu.org/wiki/Visibility
+
 2010-05-02	Romain Francois <romain at r-enthusiasts.com>
 
 	* inst/include/Rcpp/as.h: add throw(not_compatible) in Rcpp::as

Modified: pkg/Rcpp/inst/include/Rcpp/exceptions.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/exceptions.h	2010-05-03 18:56:22 UTC (rev 1145)
+++ pkg/Rcpp/inst/include/Rcpp/exceptions.h	2010-05-03 19:57:06 UTC (rev 1146)
@@ -28,7 +28,7 @@
 	public:
 		exception(const char* message_, const char* file, int line ) ;
 		virtual ~exception() throw() ;
-		virtual const char* what() const throw() { return message.c_str() ; };
+		virtual const char* what() const throw() ;
 	private:
 		std::string message ;
 } ;
@@ -59,17 +59,17 @@
 public:                                                                        \
 	__CLASS__() throw() {} ;                                                   \
 	virtual ~__CLASS__() throw(){} ;                                           \
-	virtual const char* what() const throw(){ return __MESSAGE__ ; } ;         \
+	virtual const char* what() const throw() ;                                 \
 } ;
 
-RCPP_SIMPLE_EXCEPTION_CLASS(not_a_matrix, "not a matrix" )
-RCPP_SIMPLE_EXCEPTION_CLASS(index_out_of_bounds, "index out of bounds" )
-RCPP_SIMPLE_EXCEPTION_CLASS(parse_error, "parse error") 
-RCPP_SIMPLE_EXCEPTION_CLASS(not_s4, "not an S4 object" )
-RCPP_SIMPLE_EXCEPTION_CLASS(no_such_slot, "no such slot" )
-RCPP_SIMPLE_EXCEPTION_CLASS(not_a_closure, "not a closure" )
-RCPP_SIMPLE_EXCEPTION_CLASS(no_such_function, "no such function" )
-RCPP_SIMPLE_EXCEPTION_CLASS(unevaluated_promise, "promise not yet evaluated" )
+RCPP_SIMPLE_EXCEPTION_CLASS(not_a_matrix)
+RCPP_SIMPLE_EXCEPTION_CLASS(index_out_of_bounds)
+RCPP_SIMPLE_EXCEPTION_CLASS(parse_error) 
+RCPP_SIMPLE_EXCEPTION_CLASS(not_s4)
+RCPP_SIMPLE_EXCEPTION_CLASS(no_such_slot)
+RCPP_SIMPLE_EXCEPTION_CLASS(not_a_closure)
+RCPP_SIMPLE_EXCEPTION_CLASS(no_such_function)
+RCPP_SIMPLE_EXCEPTION_CLASS(unevaluated_promise)
 
 
 RCPP_EXCEPTION_CLASS(not_compatible, message )

Modified: pkg/Rcpp/src/exceptions.cpp
===================================================================
--- pkg/Rcpp/src/exceptions.cpp	2010-05-03 18:56:22 UTC (rev 1145)
+++ pkg/Rcpp/src/exceptions.cpp	2010-05-03 19:57:06 UTC (rev 1146)
@@ -32,6 +32,8 @@
 #define RCPP_EXCEPTION_WHAT(__CLASS__) \
 const char* __CLASS__::what() const throw(){ return message.c_str(); }
 
+RCPP_EXCEPTION_WHAT(exception)
+
 RCPP_EXCEPTION_WHAT(not_compatible)
 RCPP_EXCEPTION_WHAT(S4_creation_error)
 RCPP_EXCEPTION_WHAT(no_such_binding)
@@ -42,7 +44,19 @@
 
 #undef RCPP_EXCEPTION_WHAT
 
+#define RCPP_SIMPLE_EXCEPTION_WHAT(__CLASS__,__MESSAGE__)  \
+const char* __CLASS__::what() const throw(){ return __MESSAGE__ ; }
 
+RCPP_SIMPLE_EXCEPTION_WHAT(not_a_matrix, "not a matrix" )
+RCPP_SIMPLE_EXCEPTION_WHAT(index_out_of_bounds, "index out of bounds" )
+RCPP_SIMPLE_EXCEPTION_WHAT(parse_error, "parse error") 
+RCPP_SIMPLE_EXCEPTION_WHAT(not_s4, "not an S4 object" )
+RCPP_SIMPLE_EXCEPTION_WHAT(no_such_slot, "no such slot" )
+RCPP_SIMPLE_EXCEPTION_WHAT(not_a_closure, "not a closure" )
+RCPP_SIMPLE_EXCEPTION_WHAT(no_such_function, "no such function" )
+RCPP_SIMPLE_EXCEPTION_WHAT(unevaluated_promise, "promise not yet evaluated" )
+
+#undef RCPP_SIMPLE_EXCEPTION_WHAT
 }
 
 /* for now, the fancy exception handling is only available in GCC, 



More information about the Rcpp-commits mailing list