<div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Nov 19, 2012 at 1:18 PM, Chris Jefferson <span dir="ltr"><<a href="mailto:chris@bubblescope.net" target="_blank">chris@bubblescope.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF"><div><div class="h5">
    <div>On 19/11/12 18:58, Thell Fowler wrote:<br>
    </div>
    <blockquote type="cite">Chris,
      <div><br>
      </div>
      <div><br>
      </div>
      <div class="gmail_extra">
        <div class="gmail_quote">On Mon, Nov 19, 2012 at 12:40 PM, Chris
          Jefferson <span dir="ltr"><<a href="mailto:chris@bubblescope.net" target="_blank">chris@bubblescope.net</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
            <div>On 19/11/12 17:33, Thell Fowler wrote:<br>
              <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                <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>
              </blockquote>
              <br>
            </div>
            Without looking any deeper at this (sorry), clang doesn't
            not accept elseif, it requires elif.<br>
            <br>
            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:<br>
            <br>
            #if defined(X)<br>
            <br>
            #elseif defined(Y)<br>
            <br>
            #endif<br>
            <br>
            If X is not defined, nothing is included even if Y is
            defined. If X is defined, a compile-time error always
            occurs.<br>
            <br>
            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.<br>
            <br>
            Chris<br>
            <br>
            _______________________________________________<br>
            Rcpp-devel mailing list<br>
            <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" target="_blank">Rcpp-devel@lists.r-forge.r-project.org</a><br>
            <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
          </blockquote>
        </div>
        <br>
        <div>Sure enough.  Good eye!  I edited the sets.h and that error
          is gone.</div>
        <div><br>
        </div>
        <div>
          <div>After reducing the example code to::</div>
          <div><br>
          </div>
          <div>
            <div>suppressMessages( require( inline) )</div>
            <div>suppressMessages( require( Rcpp ) )</div>
            <div><br>
            </div>
            <div>test <- cxxfunction( sig=signature(),</div>
            <div>               body='</div>
            <div>                      using namespace Rcpp;</div>
            <div>                      return R_NilValue;</div>
            <div>                    ',</div>
            <div>               plugin="Rcpp",</div>
            <div>               verbose=FALSE)</div>
          </div>
          <div><br>
          </div>
          <div class="gmail_extra">-- <br>
          </div>
        </div>
        <div><br>
        </div>
        <div>The circular reference is still there (clang 3.3)::</div>
        <div><br>
        </div>
        <div>
          <div>Error in compileCode(f, code, language = language,
            verbose = verbose) : </div>
          <div>  Compilation ERROR, function(s)/method(s) not created!
            In file included from file34e22dd4a557.cpp:6:</div>
          <div>In file included from
            /home/thell/R/library/Rcpp/include/Rcpp.h:27:</div>
          <div>In file included from
            /home/thell/R/library/Rcpp/include/RcppCommon.h:349:</div>
          <div>In file included from
            /home/thell/R/library/Rcpp/include/Rcpp/sugar/sugar_forward.h:29:</div>
          <div>In file included from
            /home/thell/R/library/Rcpp/include/Rcpp/sugar/logical/logical.h:27:</div>
          <div>/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>'</div>
          <div>        conversion_to_bool_is_forbidden<x>{</div>
          <div>        ^</div>
        </div>
      </div>
    </blockquote>
    <br></div></div>
    This is also fixed in svn (having just checked it out).<br>
    <br>
    You can locally fix it by changing line 36 from:<br>
    <br>
      conversion_to_bool_is_forbidden<x>{<br>
    <br>
    to:<br>
    <br>
        forbidden_conversion<x>{<div class="im"><br>
    <br>
    <br>
    <blockquote type="cite">
      <div class="gmail_extra">
        <div>
          <div>In file included from file34e22dd4a557.cpp:6:</div>
          <div>In file included from
            /home/thell/R/library/Rcpp/include/Rcpp.h:68:</div>
          <div>In file included from
            /home/thell/R/library/Rcpp/include/Rcpp/sugar/sugar.h:29:</div>
          <div>In file included from
            /home/thell/R/library/Rcpp/include/Rcpp/sugar/functions/functions.h:62:</div>
          <div>/home/thell/R/library/Rcpp/incl</div>
        </div>
        <div><br>
        </div>
        <div>And using clang 3.0::</div>
        <div><br>
        </div>
        <div>
          <div>
            Error in compileCode(f, code, language = language, verbose =
            verbose) : </div>
          <div>  Compilation ERROR, function(s)/method(s) not created!
            In file included from file34e290f2bc0.cpp:4:</div>
          <div>In file included from
            /home/thell/R/library/Rcpp/include/Rcpp.h:68:</div>
          <div>In file included from
            /home/thell/R/library/Rcpp/include/Rcpp/sugar/sugar.h:29:</div>
          <div>In file included from
            /home/thell/R/library/Rcpp/include/Rcpp/sugar/functions/functions.h:62:</div>
          <div>/home/thell/R/library/Rcpp/include/Rcpp/sugar/functions/unique.h:46:5:
            error: no type named 'unordered_set' in namespace 'std'</div>
          <div>    RCPP_UNIQUE_SET<STORAGE> set ;</div>
          <div>    ^~~~~~~~~~~~~~~</div>
          <div>/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:26:34:
            note: expanded from:</div>
          <div>    #define RCPP_UNIQUE_SET std::unordered_set</div>
        </div>
      </div>
    </blockquote>
    <br></div>
    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.<span class=""><font color="#888888"><br>
    <br>
    Chris<br>
  </font></span></div>

</blockquote></div><br><div class="gmail_extra">Using clang 3.0 the errors regarding unordered_set not being in "std" are fixed by including it prior to RcppCommon.</div><div class="gmail_extra"><br></div><div class="gmail_extra">
suppressMessages( require( inline) )</div><div class="gmail_extra">suppressMessages( require( Rcpp ) )</div><div class="gmail_extra"><br></div><div class="gmail_extra">test_include <- function()</div><div class="gmail_extra">
{</div><div class="gmail_extra">  plugin <- Rcpp:::Rcpp.plugin.maker(</div><div class="gmail_extra">    include.before= "#include <unordered_set>",</div><div class="gmail_extra">    LinkingTo="Rcpp" )</div>
<div class="gmail_extra">  settings <- plugin()  </div><div class="gmail_extra">  settings  </div><div class="gmail_extra">}</div><div class="gmail_extra">registerPlugin(name="test_include", plugin=test_include )</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">test <- cxxfunction( sig=signature(),</div><div class="gmail_extra">               body='</div><div class="gmail_extra">                      using namespace Rcpp;</div>
<div class="gmail_extra">                      return R_NilValue;</div><div class="gmail_extra">                    ',</div><div class="gmail_extra">               plugin="test_include",</div><div class="gmail_extra">
               verbose=TRUE)</div><div><br></div><div><br></div><div>The conversion fix got things working on clang 3.3 with and without the "-std=c++11" flag.</div><div><br></div><div><br></div><div>Thanks so much for the assists!  Now to figure out why the clang compile time vs gcc time is so horrible.</div>
<div><br></div>-- <br>Sincerely,<br>Thell<br>
</div>