[Rcpp-devel] Formatting Fixed - Clang 3.0 and 3.3 errors on sugar/set.h

Thell Fowler tbfowler4 at gmail.com
Mon Nov 19 19:58:59 CET 2012


Chris,


On Mon, Nov 19, 2012 at 12:40 PM, Chris Jefferson <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<Rcpp-devel at lists.r-forge.r-project.org>
> https://lists.r-forge.r-**project.org/cgi-bin/mailman/**
> listinfo/rcpp-devel<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>{
        ^
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
                            ~~~~~^
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/lib
In addition: Warning message:
running command '/usr/lib/R/bin/R CMD SHLIB file34e290f2bc0.cpp 2>
file34e290f2bc0.cpp.err.txt' had status 1


Sincerely,
Thell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20121119/24ea0851/attachment-0001.html>


More information about the Rcpp-devel mailing list