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

clang complains about "no newline at end of file" in Rcpp/utils/tinyformat.h #701

Closed
Enchufa2 opened this Issue May 30, 2017 · 7 comments

Comments

Projects
None yet
3 participants
@Enchufa2
Contributor

Enchufa2 commented May 30, 2017

I see this when I compile my package with clang. Also here, among other things:

/data/gannet/ripley/R/packages/tests-clang-SAN/Rcpp.Rcheck/Rcpp/include/Rcpp/utils/tinyformat.h:1046:32: warning: no newline at end of file [-Wnewline-eof]
#endif // TINYFORMAT_H_INCLUDED

If the comment is required, a newline should appease clang.

@eddelbuettel

This comment has been minimized.

Show comment
Hide comment
@eddelbuettel

eddelbuettel May 30, 2017

Member

Clang version? Exact invocation command?

Member

eddelbuettel commented May 30, 2017

Clang version? Exact invocation command?

@Enchufa2

This comment has been minimized.

Show comment
Hide comment
@Enchufa2

Enchufa2 May 30, 2017

Contributor

Sorry, in my system, clang 3.9.1, default version shipped with Fedora 25:

ccache clang++ -Qunused-arguments -I/usr/include/R -DNDEBUG -DBOOST_NO_LONG_LONG -I/usr/local/include -I"/home/xxx/R/x86_64-redhat-linux-gnu-library/3.3/Rcpp/include" -I"/home/xxx/R/x86_64-redhat-linux-gnu-library/3.3/BH/include"   -fpic  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic  -pedantic -Wno-long-long -c policy.cpp -o policy.o
In file included from RcppExports.cpp:4:
In file included from /home/xxx/R/x86_64-redhat-linux-gnu-library/3.3/Rcpp/include/Rcpp.h:27:
In file included from /home/xxx/R/x86_64-redhat-linux-gnu-library/3.3/Rcpp/include/RcppCommon.h:70:
/home/xxx/R/x86_64-redhat-linux-gnu-library/3.3/Rcpp/include/Rcpp/utils/tinyformat.h:1046:32: warning: no newline at end of file [-Wnewline-eof]
#endif // TINYFORMAT_H_INCLUDED

The link points to CRAN's clang-UBSAN checks.

Contributor

Enchufa2 commented May 30, 2017

Sorry, in my system, clang 3.9.1, default version shipped with Fedora 25:

ccache clang++ -Qunused-arguments -I/usr/include/R -DNDEBUG -DBOOST_NO_LONG_LONG -I/usr/local/include -I"/home/xxx/R/x86_64-redhat-linux-gnu-library/3.3/Rcpp/include" -I"/home/xxx/R/x86_64-redhat-linux-gnu-library/3.3/BH/include"   -fpic  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic  -pedantic -Wno-long-long -c policy.cpp -o policy.o
In file included from RcppExports.cpp:4:
In file included from /home/xxx/R/x86_64-redhat-linux-gnu-library/3.3/Rcpp/include/Rcpp.h:27:
In file included from /home/xxx/R/x86_64-redhat-linux-gnu-library/3.3/Rcpp/include/RcppCommon.h:70:
/home/xxx/R/x86_64-redhat-linux-gnu-library/3.3/Rcpp/include/Rcpp/utils/tinyformat.h:1046:32: warning: no newline at end of file [-Wnewline-eof]
#endif // TINYFORMAT_H_INCLUDED

The link points to CRAN's clang-UBSAN checks.

@eddelbuettel

This comment has been minimized.

Show comment
Hide comment
@eddelbuettel

eddelbuettel May 30, 2017

Member

I cannot reproduce it, though I can generate pages of other warnings :-/

clang++-3.8 and clang++-3.9 on Ubuntu.

Member

eddelbuettel commented May 30, 2017

I cannot reproduce it, though I can generate pages of other warnings :-/

clang++-3.8 and clang++-3.9 on Ubuntu.

@eddelbuettel

This comment has been minimized.

Show comment
Hide comment
@eddelbuettel

eddelbuettel May 30, 2017

Member

NOW I get it, using `-Wno-conversion -pedantic'.

Member

eddelbuettel commented May 30, 2017

NOW I get it, using `-Wno-conversion -pedantic'.

@Enchufa2

This comment has been minimized.

Show comment
Hide comment
@Enchufa2

Enchufa2 May 30, 2017

Contributor

It seems that this is a warning in some versions of C++ only: see comments here and here.

Contributor

Enchufa2 commented May 30, 2017

It seems that this is a warning in some versions of C++ only: see comments here and here.

@coatless

This comment has been minimized.

Show comment
Hide comment
@coatless

coatless May 30, 2017

Contributor

What is an appropriate battery of compile flags to run against?

Contributor

coatless commented May 30, 2017

What is an appropriate battery of compile flags to run against?

@eddelbuettel

This comment has been minimized.

Show comment
Hide comment
@eddelbuettel

eddelbuettel May 30, 2017

Member

Well @krlmlr helped to get rid of a few of the (easier) conversion warnings so now -Wall -Wextra -pedantic works, now we have some harder ones (in the: need to make sure we don't accidentally pick a wrong variable conversions) left.

My (current) default (for g++) is

CXXFLAGS += -O3 -Wall -pipe -Wno-unused -pedantic -Wextra -Wno-deprecated-declarations

but I few more commented-out lines in there. For clang++ I used

CC=ccache clang-3.9 -Qunused-arguments 
CXX=ccache clang++-3.9 -Qunused-arguments  
CXXFLAGS=-Wall -O3 -Wno-conversion -pedantic
Member

eddelbuettel commented May 30, 2017

Well @krlmlr helped to get rid of a few of the (easier) conversion warnings so now -Wall -Wextra -pedantic works, now we have some harder ones (in the: need to make sure we don't accidentally pick a wrong variable conversions) left.

My (current) default (for g++) is

CXXFLAGS += -O3 -Wall -pipe -Wno-unused -pedantic -Wextra -Wno-deprecated-declarations

but I few more commented-out lines in there. For clang++ I used

CC=ccache clang-3.9 -Qunused-arguments 
CXX=ccache clang++-3.9 -Qunused-arguments  
CXXFLAGS=-Wall -O3 -Wno-conversion -pedantic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment