[Rcpp-devel] Formatting Fixed - Clang 3.0 and 3.3 errors on sugar/set.h
Chris Jefferson
chris at bubblescope.net
Mon Nov 19 20:18:54 CET 2012
On 19/11/12 18:58, Thell Fowler wrote:
> Chris,
>
>
> On Mon, Nov 19, 2012 at 12:40 PM, Chris Jefferson
> <chris at bubblescope.net <mailto:chris at bubblescope.net>> wrote:
>
> On 19/11/12 17:33, Thell Fowler wrote:
>
>
> /home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:28:2: error:
> invalid preprocessing directive
> #elseif defined(HAS_TR1_UNORDERED_SET)
>
>
> Without looking any deeper at this (sorry), clang doesn't not
> accept elseif, it requires elif.
>
> gcc actually doesn't do what you expect with elseif. It just
> ignores it if the #if isn't added, and causes a compile-time error
> if you end up actually reaching that line. So in:
>
> #if defined(X)
>
> #elseif defined(Y)
>
> #endif
>
> If X is not defined, nothing is included even if Y is defined. If
> X is defined, a compile-time error always occurs.
>
> in you want someone with gcc, clang and c++0x experience have a
> dig through these headers, I am happy to download them and have a
> look.
>
> Chris
>
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> <mailto:Rcpp-devel at lists.r-forge.r-project.org>
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>
>
> Sure enough. Good eye! I edited the sets.h and that error is gone.
>
> After reducing the example code to::
>
> suppressMessages( require( inline) )
> suppressMessages( require( Rcpp ) )
>
> test <- cxxfunction( sig=signature(),
> body='
> using namespace Rcpp;
> return R_NilValue;
> ',
> plugin="Rcpp",
> verbose=FALSE)
>
> --
>
> The circular reference is still there (clang 3.3)::
>
> Error in compileCode(f, code, language = language, verbose = verbose) :
> Compilation ERROR, function(s)/method(s) not created! In file
> included from file34e22dd4a557.cpp:6:
> In file included from /home/thell/R/library/Rcpp/include/Rcpp.h:27:
> In file included from /home/thell/R/library/Rcpp/include/RcppCommon.h:349:
> In file included from
> /home/thell/R/library/Rcpp/include/Rcpp/sugar/sugar_forward.h:29:
> In file included from
> /home/thell/R/library/Rcpp/include/Rcpp/sugar/logical/logical.h:27:
> /home/thell/R/library/Rcpp/include/Rcpp/sugar/logical/SingleLogicalResult.h:36:2:
> error: circular inheritance between
> 'conversion_to_bool_is_forbidden<x>' and
> 'conversion_to_bool_is_forbidden<x>'
> conversion_to_bool_is_forbidden<x>{
> ^
This is also fixed in svn (having just checked it out).
You can locally fix it by changing line 36 from:
conversion_to_bool_is_forbidden<x>{
to:
forbidden_conversion<x>{
> In file included from file34e22dd4a557.cpp:6:
> In file included from /home/thell/R/library/Rcpp/include/Rcpp.h:68:
> In file included from
> /home/thell/R/library/Rcpp/include/Rcpp/sugar/sugar.h:29:
> In file included from
> /home/thell/R/library/Rcpp/include/Rcpp/sugar/functions/functions.h:62:
> /home/thell/R/library/Rcpp/incl
>
> And using clang 3.0::
>
> Error in compileCode(f, code, language = language, verbose = verbose) :
> Compilation ERROR, function(s)/method(s) not created! In file
> included from file34e290f2bc0.cpp:4:
> In file included from /home/thell/R/library/Rcpp/include/Rcpp.h:68:
> In file included from
> /home/thell/R/library/Rcpp/include/Rcpp/sugar/sugar.h:29:
> In file included from
> /home/thell/R/library/Rcpp/include/Rcpp/sugar/functions/functions.h:62:
> /home/thell/R/library/Rcpp/include/Rcpp/sugar/functions/unique.h:46:5:
> error: no type named 'unordered_set' in namespace 'std'
> RCPP_UNIQUE_SET<STORAGE> set ;
> ^~~~~~~~~~~~~~~
> /home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:26:34: note:
> expanded from:
> #define RCPP_UNIQUE_SET std::unordered_set
I would guess this is caused by clang 3.0's c++11 support not being very
good. I certainly would be tempted not to try to fix it, unless there is
a good reason for it. clang 3.2 should be out very shortly, with very
good support.
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20121119/19c798ca/attachment.html>
More information about the Rcpp-devel
mailing list