<br>First:: Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final)<br>(based on LLVM 3.0)<br><br><br> >> setting environment variables:<br>PKG_LIBS = -lmpfr -lgmp -L/home/thell/R/library/Rcpp/lib -lRcpp<br>-Wl,-rpath,/home/thell/R/library/Rcpp/lib<br>
PKG_CPPFLAGS = -std=c++11<br><br> >> LinkingTo : Rcpp<br>CLINK_CPPFLAGS = -I"/home/thell/R/library/Rcpp/include"<br><br> >> Program source :<br><br> 1 :<br> 2 : // includes from the plugin<br> 3 :<br>
4 : #include <cmath><br> 5 : #include <iterator><br> 6 : #include <RcppCommon.h><br> 7 : #include <mpreal.h><br> 8 :<br> 9 : namespace Rcpp {<br> 10 : template <> SEXP wrap( const mpfr::mpreal& ) ;<br>
11 : }<br> 12 :<br> 13 : #include <Rcpp.h><br> 14 :<br> 15 : // Definitions from Rmpfr conversion utilities.<br> 16 : #if GMP_NUMB_BITS == 32<br> 17 :<br> 18 : # define R_mpfr_nr_ints nr_limbs<br> 19 : # define R_mpfr_exp_size 1<br>
20 :<br> 21 : #elif GMP_NUMB_BITS == 64<br> 22 :<br> 23 : # define R_mpfr_nr_ints (2*nr_limbs)<br> 24 : # define R_mpfr_exp_size 2<br> 25 :<br> 26 : #endif<br> 27 :<br> 28 : # define RIGHT_HALF(_LONG_) ((long long)(_LONG_) & 0x00000000FFFFFFFF)<br>
29 : # define LEFT_SHIFT(_LONG_) (((long long)(_LONG_)) << 32)<br> 30 :<br> 31 : namespace Rcpp {<br> 32 :<br> 33 : template<> SEXP wrap( const mpfr::mpreal& v )<br> 34 : {<br> 35 : mpfr_srcptr pv( v.mpfr_srcptr() );<br>
36 :<br> 37 : S4 vS4("mpfr1");<br> 38 : vS4.slot("prec") = wrap( (int)pv->_mpfr_prec );<br> 39 : vS4.slot("sign") = wrap( (int)pv->_mpfr_sign);<br> 40 :<br> 41 : IntegerVector d( std::ceil( (double)pv->_mpfr_prec /<br>
(double)mp_bits_per_limb ) );<br> 42 : mp_size_t i = 0;<br> 43 :<br> 44 : if( GMP_NUMB_BITS == 32 ) {<br> 45 :<br> 46 : vS4.slot("exp") = wrap( (int)pv->_mpfr_exp );<br> 47 :<br> 48 : for( auto & e : d ) {<br>
49 : e = (int) pv->_mpfr_d[i];<br> 50 : ++i;<br> 51 : }<br> 52 :<br> 53 : } else {<br> 54 :<br> 55 : IntegerVector exp(2);<br> 56 : exp[0] = (int) RIGHT_HALF(pv->_mpfr_exp);<br> 57 : exp[1] = (int) (pv->_mpfr_exp >> 32);<br>
58 : vS4.slot("exp") = exp;<br> 59 :<br> 60 : for(i=0; i < d.size(); i++) {<br> 61 : d[2*i] = (int) RIGHT_HALF(pv->_mpfr_d[i]);<br> 62 : d[2*i+1]= (int) (pv->_mpfr_d[i] >> 32);<br> 63 : }<br>
64 :<br> 65 : }<br> 66 :<br> 67 : vS4.slot("d") = d;<br> 68 : return vS4;<br> 69 : }<br> 70 :<br> 71 : }<br> 72 :<br> 73 :<br> 74 : #ifndef BEGIN_RCPP<br> 75 : #define BEGIN_RCPP<br> 76 : #endif<br>
77 :<br> 78 : #ifndef END_RCPP<br> 79 : #define END_RCPP<br> 80 : #endif<br> 81 :<br> 82 : using namespace Rcpp;<br> 83 :<br> 84 :<br> 85 : // user includes<br> 86 :<br> 87 :<br> 88 :<br> 89 : // declarations<br>
90 : extern "C" {<br> 91 : SEXP file34e23fb9ce5( SEXP x, SEXP prec) ;<br> 92 : }<br> 93 :<br> 94 : // definition<br> 95 :<br> 96 : SEXP file34e23fb9ce5( SEXP x, SEXP prec ){<br> 97 : BEGIN_RCPP<br> 98 :<br>
99 : using namespace mpfr;<br> 100 : using namespace Rcpp;<br> 101 :<br> 102 : mpreal::set_default_prec( as< unsigned long >( prec ) );<br> 103 : return wrap( fac_ui( as< double >( x ) ) );<br> 104 :<br> 105 : END_RCPP<br>
106 : }<br> 107 :<br> 108 :<br>Compilation argument:<br> /usr/lib/R/bin/R CMD SHLIB file34e23fb9ce5.cpp 2> file34e23fb9ce5.cpp.err.txt<br>"/usr/bin/clang++" -I/usr/share/R/include -DNDEBUG -std=c++11<br>-I"/home/thell/R/library/Rcpp/include" -fpic -O3 -pipe -g -c<br>
file34e23fb9ce5.cpp -o file34e23fb9ce5.o<br>In file included from file34e23fb9ce5.cpp:13:<br>In file included from /home/thell/R/library/Rcpp/include/Rcpp.h:68:<br>In file included from /home/thell/R/library/Rcpp/include/Rcpp/sugar/sugar.h:25:<br>
/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:28:2: error:<br>invalid preprocessing directive<br>#elseif defined(HAS_TR1_UNORDERED_SET)<br> ^<br>/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:29:13: warning:<br>
'RCPP_UNIQUE_SET' macro redefined<br> #define RCPP_UNIQUE_SET std::tr1::unordered_set<br> ^<br>/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:26:13: note:<br>previous definition is here<br> #define RCPP_UNIQUE_SET std::unordered_set<br>
^<br>/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:30:13: warning:<br>'RCPP_UNIQUE_MAP' macro redefined<br> #define RCPP_UNIQUE_MAP std::tr1::unordered_map<br> ^<br>/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:27:13: note:<br>
previous definition is here<br> #define RCPP_UNIQUE_MAP std::unordered_map<br> ^<br>file34e23fb9ce5.cpp:57:31: warning: shift count >= width of type<br>[-Wshift-count-overflow]<br>exp[1] = (int) (pv->_mpfr_exp >> 32);<br>
^ ~~<br>file34e23fb9ce5.cpp:62:33: warning: shift count >= width of type<br>[-Wshift-count-overflow]<br>d[2*i+1]= (int) (pv->_mpfr_d[i] >> 32);<br> ^ ~~<br>
4 warnings and 1 error generated.<br>make: *** [file34e23fb9ce5.o] Error 1<br><br>ERROR(s) during compilation: source code errors or compiler<br>configuration errors!<br><br><br>================================<br>Now:: clang version 3.3<br>
(<a href="http://llvm.org/git/clang.git86256af6c8515077278d0a78f183fb6d322518ac">http://llvm.org/git/clang.git86256af6c8515077278d0a78f183fb6d322518ac</a>)<br>(<br><a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a> 8f54a53f0ed2091e05d5ca87d239487da292cbbc)<br>
<br> >> setting environment variables:<br>PKG_LIBS = -lmpfr -lgmp -L/home/thell/R/library/Rcpp/lib -lRcpp<br>-Wl,-rpath,/home/thell/R/library/Rcpp/lib<br>PKG_CPPFLAGS = -std=c++11<br><br> >> LinkingTo : Rcpp<br>
CLINK_CPPFLAGS = -I"/home/thell/R/library/Rcpp/include"<br><br> >> Program source :<br><br> 1 :<br> 2 : // includes from the plugin<br> 3 :<br> 4 : #include <cmath><br> 5 : #include <iterator><br>
6 : #include <RcppCommon.h><br> 7 : #include <mpreal.h><br> 8 :<br> 9 : namespace Rcpp {<br> 10 : template <> SEXP wrap( const mpfr::mpreal& ) ;<br> 11 : }<br> 12 :<br> 13 : #include <Rcpp.h><br>
14 :<br> 15 : // Definitions from Rmpfr conversion utilities.<br> 16 : #if GMP_NUMB_BITS == 32<br> 17 :<br> 18 : # define R_mpfr_nr_ints nr_limbs<br> 19 : # define R_mpfr_exp_size 1<br> 20 :<br> 21 : #elif GMP_NUMB_BITS == 64<br>
22 :<br> 23 : # define R_mpfr_nr_ints (2*nr_limbs)<br> 24 : # define R_mpfr_exp_size 2<br> 25 :<br> 26 : #endif<br> 27 :<br> 28 : # define RIGHT_HALF(_LONG_) ((long long)(_LONG_) & 0x00000000FFFFFFFF)<br> 29 : # define LEFT_SHIFT(_LONG_) (((long long)(_LONG_)) << 32)<br>
30 :<br> 31 : namespace Rcpp {<br> 32 :<br> 33 : template<> SEXP wrap( const mpfr::mpreal& v )<br> 34 : {<br> 35 : mpfr_srcptr pv( v.mpfr_srcptr() );<br> 36 :<br> 37 : S4 vS4("mpfr1");<br> 38 : vS4.slot("prec") = wrap( (int)pv->_mpfr_prec );<br>
39 : vS4.slot("sign") = wrap( (int)pv->_mpfr_sign);<br> 40 :<br> 41 : IntegerVector d( std::ceil( (double)pv->_mpfr_prec /<br>(double)mp_bits_per_limb ) );<br> 42 : mp_size_t i = 0;<br> 43 :<br> 44 : if( GMP_NUMB_BITS == 32 ) {<br>
45 :<br> 46 : vS4.slot("exp") = wrap( (int)pv->_mpfr_exp );<br> 47 :<br> 48 : for( auto & e : d ) {<br> 49 : e = (int) pv->_mpfr_d[i];<br> 50 : ++i;<br> 51 : }<br> 52 :<br> 53 : } else {<br> 54 :<br>
55 : IntegerVector exp(2);<br> 56 : exp[0] = (int) RIGHT_HALF(pv->_mpfr_exp);<br> 57 : exp[1] = (int) (pv->_mpfr_exp >> 32);<br> 58 : vS4.slot("exp") = exp;<br> 59 :<br> 60 : for(i=0; i < d.size(); i++) {<br>
61 : d[2*i] = (int) RIGHT_HALF(pv->_mpfr_d[i]);<br> 62 : d[2*i+1]= (int) (pv->_mpfr_d[i] >> 32);<br> 63 : }<br> 64 :<br> 65 : }<br> 66 :<br> 67 : vS4.slot("d") = d;<br> 68 : return vS4;<br>
69 : }<br> 70 :<br> 71 : }<br> 72 :<br> 73 :<br> 74 : #ifndef BEGIN_RCPP<br> 75 : #define BEGIN_RCPP<br> 76 : #endif<br> 77 :<br> 78 : #ifndef END_RCPP<br> 79 : #define END_RCPP<br> 80 : #endif<br> 81 :<br> 82 : using namespace Rcpp;<br>
83 :<br> 84 :<br> 85 : // user includes<br> 86 :<br> 87 :<br> 88 :<br> 89 : // declarations<br> 90 : extern "C" {<br> 91 : SEXP file34e215a2f7e7( SEXP x, SEXP prec) ;<br> 92 : }<br> 93 :<br> 94 : // definition<br>
95 :<br> 96 : SEXP file34e215a2f7e7( SEXP x, SEXP prec ){<br> 97 : BEGIN_RCPP<br> 98 :<br> 99 : using namespace mpfr;<br> 100 : using namespace Rcpp;<br> 101 :<br> 102 : mpreal::set_default_prec( as< unsigned long >( prec ) );<br>
103 : return wrap( fac_ui( as< double >( x ) ) );<br> 104 :<br> 105 : END_RCPP<br> 106 : }<br> 107 :<br> 108 :<br>Compilation argument:<br> /usr/lib/R/bin/R CMD SHLIB file34e215a2f7e7.cpp 2><br>file34e215a2f7e7.cpp.err.txt<br>
"clang++" -I/usr/share/R/include -DNDEBUG -std=c++11<br>-I"/home/thell/R/library/Rcpp/include" -fpic -O3 -pipe -g -c<br>file34e215a2f7e7.cpp -o file34e215a2f7e7.o<br>In file included from file34e215a2f7e7.cpp:6:<br>
In file included from /home/thell/R/library/Rcpp/include/RcppCommon.h:349:<br>In file included from<br>/home/thell/R/library/Rcpp/include/Rcpp/sugar/sugar_forward.h:29:<br>In file included from<br>/home/thell/R/library/Rcpp/include/Rcpp/sugar/logical/logical.h:27:<br>
/home/thell/R/library/Rcpp/include/Rcpp/sugar/logical/SingleLogicalResult.h:36:2:<br>error: circular inheritance between<br>'conversion_to_bool_is_forbidden<x>' and<br>'conversion_to_bool_is_forbidden<x>'<br>
conversion_to_bool_is_forbidden<x>{<br> ^<br>In file included from file34e215a2f7e7.cpp:13:<br>In file included from /home/thell/R/library/Rcpp/include/Rcpp.h:68:<br>In file included from /home/thell/R/library/Rcpp/include/Rcpp/sugar/sugar.h:25:<br>
/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:28:2: error:<br>invalid preprocessing directive<br>#elseif defined(HAS_TR1_UNORDERED_SET)<br> ^<br>/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:29:13: warning:<br>
'RCPP_UNIQUE_SET' macro redefined<br> #define RCPP_UNIQUE_SET std::tr1::unordered_set<br> ^<br>/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:26:13: note:<br>previous definition is here<br> #define RCPP_UNIQUE_SET std::unordered_set<br>
^<br>/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:30:13: warning:<br>'RCPP_UNIQUE_MAP' macro redefined<br> #define RCPP_UNIQUE_MAP std::tr1::unordered_map<br> ^<br>/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:27:13: note:<br>
previous definition is here<br> #define RCPP_UNIQUE_MAP std::unordered_map<br> ^<br>file34e215a2f7e7.cpp:57:31: warning: shift count >= width of type<br>[-Wshift-count-overflow]<br>exp[1] = (int) (pv->_mpfr_exp >> 32);<br>
^ ~~<br>file34e215a2f7e7.cpp:62:33: warning: shift count >= width of type<br>[-Wshift-count-overflow]<br>d[2*i+1]= (int) (pv->_mpfr_d[i] >> 32);<br> ^ ~~<br>
4 warnings and 2 errors generated.<br>make: *** [file34e215a2f7e7.o] Error 1<br><br>ERROR(s) during compilation: source code errors or compiler<br>configuration errors!<br><br><br><br>The code compiles and works (the warnings are expected for now) using g++.<br>