lvc/api-sanity-checker

‘-std=c++11’ is valid for C++/ObjC++ but not for C

solardatov opened this issue · 1 comments

I am trying to generate tests for legacy C++ library (using C++11 features). So, I created XML config based on flags.make generated to build this library by our build system.

Is it ok that generating tests reports about following warnings? Can I specify to use C++ compiler to avoid such warnings?

creating ABI dump ...
cc1: warning: command line option ‘-std=c++11’ is valid for C++/ObjC++ but not for C
cc1: warning: command line option ‘-std=c++11’ is valid for C++/ObjC++ but not for C
cc1: warning: command line option ‘-Wnon-virtual-dtor’ is valid for C++/ObjC++ but not for C
cc1: warning: command line option ‘-Wno-reorder’ is valid for C++/ObjC++ but not for C
cc1: warning: command line option ‘-Wno-overloaded-virtual’ is valid for C++/ObjC++ but not for C
cc1: warning: command line option ‘-Wno-ctor-dtor-privacy’ is valid for C++/ObjC++ but not for C

Also generation was failed and the log contains lots of class redefinitions like
error: redefinition of ‘class xxx::YYYY’ class YYY

Each our header with class definition has #pragma once

Is there any chance that this pragma don't work when I generate tests using your tool?

Thanks in advance,
Vladimir

Not a developer for this project, I'm actually trying to solve this on my own work.

But I have found a temporary solution to this issue,
my cmake configuration is compiling .hpp as C instead of C++ for some reason, so you can add:
#ifdef __cplusplus
//Code
#endif

And that forces the compiler to ignore the code if it isn't compiling in C++. It may cause problems if the compiler never passes through the code with C++ in mind though.

(Wish me luck figuring out why cmake thinks it should ever use C instead of C++)