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

warning: ISO C++ prohibits anonymous structs [-Wpedantic] #59

Closed
privefl opened this issue Jul 28, 2018 · 17 comments
Closed

warning: ISO C++ prohibits anonymous structs [-Wpedantic] #59

privefl opened this issue Jul 28, 2018 · 17 comments

Comments

@privefl
Copy link

privefl commented Jul 28, 2018

I get these warnings from https://github.com/boostorg/interprocess/blob/develop/include/boost/interprocess/detail/win32_api.hpp#L145 (also L153, L178 and L180).

This seems to be similar to this issue.

@igaztanaga
Copy link
Member

Which compiler?

For GCC >= 6, there is a directive to disable pedantic errors in that header:

pragma GCC diagnostic ignored "-Wpedantic"

@privefl
Copy link
Author

privefl commented Aug 3, 2018

I'm not sure, please see these reports: https://cran.r-project.org/web/checks/check_results_pcadapt.html

It is said that for r-devel-windows-ix86+x86_64, compiler GCC 4.9.3 (i686-posix-dwarf / x86_64-posix-seh, MinGW-W64 project) is used. Yet, it seems to be the same compiler for r-release-windows-ix86+x86_64, for which there is no warning.

@privefl
Copy link
Author

privefl commented Aug 11, 2018

Any update on this?
Sorry to bother you, but this is blocking me for the submission of my R package.

@igaztanaga
Copy link
Member

Wihout access to the compiler and it's warning it's difficult to tell. Can you please try to replace line https://github.com/boostorg/interprocess/blob/develop/include/boost/interprocess/detail/win32_api.hpp#L106 from:

if (BOOST_GCC >= 60000)

to

if (BOOST_GCC >= 40800)

and see if this helps?

@privefl
Copy link
Author

privefl commented Aug 13, 2018

Seems it removes the warning. Thanks
Would it be possible instead of silencing warnings to name the 4 structs so that there is no warning at all (or do something like in the other issue I linked to at the beginning)?

@igaztanaga
Copy link
Member

It is not possible because those definitions exactly describe the implementation and ABI provided by Microsoft windows headers so it's better to maintain full compatibility. I guess Mingw provided windows.h is treating those headers as system headers. Patch applied in commit:

818ef81

Many thanks for the report.

@privefl
Copy link
Author

privefl commented Aug 13, 2018

Thanks! Do you think this change will be part of Boost release 1.69?
@eddelbuettel is asking to make sure he can change this in R package {BH}.

@igaztanaga
Copy link
Member

Yes, sure. Once develop branch has cycled in several compilers I'll merge into the release branch.

@igaztanaga
Copy link
Member

Merged in master branch:

1624494

@ghost
Copy link

ghost commented Oct 2, 2018

@privefl while we wait for an update of the R package {BH}, have you found an interim solution? my CRAN submission is also stuck on this.

@eddelbuettel
Copy link

-Wpedantic is not an option CRAN uses. In fact, it warns against it as not portable. So when you two say "this blocks my submission" exactly what do you mean?

As of today, 152 packages on CRAN reverse-depend on BH. According to you two that would not be possible (modulo not all 152 using IPC but you get the idea).

That said, always nice to get changes into upstream. I try to update BH once or twice a year.

@ghost
Copy link

ghost commented Oct 2, 2018

-Wpedantic is not an option CRAN uses. In fact, it warns against it as not portable. So when you two say "this blocks my submission" exactly what do you mean?

To speak for @privefl based on a guess, it blocks the submission in the sense that our R packages pass CRAN checks up to this warning. Specifically in my case, there seems to be no problem with the package for macOS, but the package does not pass CRAN incoming checks for Windows because of this warning.

@eddelbuettel
Copy link

eddelbuettel commented Oct 2, 2018

Again, winbuilder does not set -pedantic, despite your claims. I just ran four builds, and several others at rhub. The claim that "CRAN uses -pedantic" is false, based on my 15 years of uploading packages there.

(They do use -Wall, and there can be pages and pages of warnings with Boost and our BH package -- sure. But that is mostly just annoying and not blocking an upload.)

@ghost
Copy link

ghost commented Oct 2, 2018

I'm way out of my line of expertise here so you surely know much more about this than I do, but I have submission logs from CRAN showing precisely this warning.

screen shot 2018-10-01 at 22 04 50

@eddelbuettel
Copy link

eddelbuettel commented Oct 2, 2018

That does explain where -pedantic came from. If you are setting -pedantic in your src/Makevars or src/Makevars.win then you only have yourself to blame.

(Also posting images is in poor taste.)

Here is what I ran a few hours ago for package now in incoming/. Not using BH, but using win-builder:

* installing *source* package 'RcppNLoptExample' ...
** libs

*** arch - i386
d:/Compiler/gcc-4.9.3/mingw_32/bin/g++  -I"D:/RCompile/recent/R-3.5.1/include" -DNDEBUG  -I"d:/RCompile/CRANpkg/lib/3.5/Rcpp/include" -I"d:/RCompile/CRANpkg/lib/3.5/nloptr/include"   -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c RcppExports.cpp -o RcppExports.o
d:/Compiler/gcc-4.9.3/mingw_32/bin/g++  -I"D:/RCompile/recent/R-3.5.1/include" -DNDEBUG  -I"d:/RCompile/CRANpkg/lib/3.5/Rcpp/include" -I"d:/RCompile/CRANpkg/lib/3.5/nloptr/include"   -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c nlopt.cpp -o nlopt.o
d:/Compiler/gcc-4.9.3/mingw_32/bin/g++ -shared -s -static-libgcc -o RcppNLoptExample.dll tmp.def RcppExports.o nlopt.o -Ld:/Compiler/gcc-4.9.3/local330/lib/i386 -Ld:/Compiler/gcc-4.9.3/local330/lib -LD:/RCompile/recent/R-3.5.1/bin/i386 -lR
installing to d:/RCompile/CRANguest/R-release/lib/RcppNLoptExample/libs/i386

*** arch - x64
d:/Compiler/gcc-4.9.3/mingw_64/bin/g++ -m64 -I"D:/RCompile/recent/R-3.5.1/include" -DNDEBUG  -I"d:/RCompile/CRANpkg/lib/3.5/Rcpp/include" -I"d:/RCompile/CRANpkg/lib/3.5/nloptr/include"   -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c RcppExports.cpp -o RcppExports.o
d:/Compiler/gcc-4.9.3/mingw_64/bin/g++ -m64 -I"D:/RCompile/recent/R-3.5.1/include" -DNDEBUG  -I"d:/RCompile/CRANpkg/lib/3.5/Rcpp/include" -I"d:/RCompile/CRANpkg/lib/3.5/nloptr/include"   -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c nlopt.cpp -o nlopt.o
d:/Compiler/gcc-4.9.3/mingw_64/bin/g++ -m64 -shared -s -static-libgcc -o RcppNLoptExample.dll tmp.def RcppExports.o nlopt.o -Ld:/Compiler/gcc-4.9.3/local330/lib/x64 -Ld:/Compiler/gcc-4.9.3/local330/lib -LD:/RCompile/recent/R-3.5.1/bin/x64 -lR
installing to d:/RCompile/CRANguest/R-release/lib/RcppNLoptExample/libs/x64
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
* MD5 sums
packaged installation of 'RcppNLoptExample' as RcppNLoptExample_0.0.1.zip
* DONE (RcppNLoptExample)
In R CMD INSTALL

No -pedantic. Besides the two sets of -I... from the LinkingTo I set, we have
-O2 -Wall -mtune=core2
and nothing else.

(And out want to look at 00install.out, not 00check.log.)

@eddelbuettel
Copy link

In any event, we are abusing the poor old Boost Interprocess issue ticket here. Ask you r-package-devel if you have questions, we're there to help.

@privefl
Copy link
Author

privefl commented Oct 2, 2018

You need to "answer all" to the mail your receive from CRAN and explain why you think that this warning is a false positive.

I said:

Package BH comes with these issues on 'r-devel-windows-ix86+x86_64' only. This is also the case for many other packages (e.g. package bigmemory) and should be fixed in the next version of package BH.

Uwe Ligges was OK with this explanation. And my package is now on CRAN, despite this warning.

stheophil pushed a commit to think-cell/interprocess that referenced this issue Oct 9, 2020
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