Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

long long warnings in algorithm.h #502

Closed
nathan-russell opened this issue Jul 10, 2016 · 2 comments
Closed

long long warnings in algorithm.h #502

nathan-russell opened this issue Jul 10, 2016 · 2 comments

Comments

@nathan-russell
Copy link
Contributor

Per @dcdillon's comment in #501,

The long long warnings are puzzling as all references to long long seem to be wrapped in ifdefs appropriately

in reference to @thirdwing's compiler output,

* checking whether package ‘with.dot’ can be installed ... WARNING
Found the following significant warnings:
/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include/Rcpp/algorithm.h:48:62: warning: 'long long' is a C++11 extension [-Wc++11-long-long] 
/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include/Rcpp/algorithm.h:77:80: warning: 'long long' is a C++11 extension [-Wc++11-long-long]   
/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include/Rcpp/algorithm.h:89:43: warning: 'long long' is a C++11 extension [-Wc++11-long-long] 
/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include/Rcpp/algorithm.h:100:61: warning: 'long long' is a C++11 extension [-Wc++11-long-long] 
/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include/Rcpp/algorithm.h:117:43: warning: 'long long' is a C++11 extension [-Wc++11-long-long]   
/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include/Rcpp/algorithm.h:128:61: warning: 'long long' is a C++11 extension [-Wc++11-long-long] 

I have also been experiencing this with more recent versions of Rcpp (since the addition of algorithm.h). As far as I can tell, this only happens when compiling with clang and passing the -pedantic flag:

devtools::install_github("RcppCore/Rcpp") 

clang++ -I/usr/share/R/include -DNDEBUG -I../inst/include/ \   
-fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 \
-Wformat -Wall -pedantic -Werror=format-security -D_FORTIFY_SOURCE=2 \
-g  -c Date.cpp -o Date.o

In file included from Date.cpp:31:
In file included from ../inst/include/Rcpp.h:84:
../inst/include/Rcpp/algorithm.h:48:62: warning: 'long long' is a C++11 extension [-Wc++11-long-long]
    struct ctype_helper< sizeof(CTYPE_LONG_LONG) > { typedef long long type; static const bool value = true; };
                                                             ^
../inst/include/Rcpp/algorithm.h:77:80: warning: 'long long' is a C++11 extension [-Wc++11-long-long]
    struct ctype_helper< sizeof(CTYPE_UNSIGNED_LONG_LONG) > { typedef unsigned long long type; static const bool value = true; };
                                                                               ^
../inst/include/Rcpp/algorithm.h:89:43: warning: 'long long' is a C++11 extension [-Wc++11-long-long]
        static CTYPE_LONG_LONG test(const long long &);
                                          ^
../inst/include/Rcpp/algorithm.h:100:61: warning: 'long long' is a C++11 extension [-Wc++11-long-long]
        static CTYPE_UNSIGNED_LONG_LONG test(const unsigned long long &);
                                                            ^
../inst/include/Rcpp/algorithm.h:117:43: warning: 'long long' is a C++11 extension [-Wc++11-long-long]
        static CTYPE_LONG_LONG test(const long long &);
                                          ^
../inst/include/Rcpp/algorithm.h:128:61: warning: 'long long' is a C++11 extension [-Wc++11-long-long]
        static CTYPE_UNSIGNED_LONG_LONG test(const unsigned long long &);
                                                            ^
6 warnings generated.

Using g++ with the same compiler flags, I do not get these warnings. Replacing long long and unsigned long long with rcpp_long_long_type and rcpp_ulong_long_type, respectively, seems to fix this. I can submit a PR if there are no objections with this approach.

nathan-russell added a commit to nathan-russell/Rcpp that referenced this issue Jul 10, 2016
@eddelbuettel
Copy link
Member

Nice. I was honing in on a release but I think I'll take this one (and will of course run another set of rev.dep checks).

@thirdwing
Copy link
Member

Fixed in #503

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants