-
Notifications
You must be signed in to change notification settings - Fork 1
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
A better wrapper is needed #3
Comments
The integration tests only collect standard include directories. For a real project with thirdparty dependencies, cppsafe should be used with compile_commands.json: cppsafe -p <directory_of_compile_commands.json> file1 file2 --Wno-lifetime-null --Wno-lifetime-post Later I will add a wrapper and more document for easy use |
This is exactly what I care about. The problem is not about custom directories, but that cppsafe cannot use the standard include directories (on Mac). I am not sure about Linux. Even with compile_commands.json, the problem should still surface. |
Reproduced and confirmed. Using either the default compiler (Apple Clang 14) or Homebrew GCC 13, I still get error messages like:
I.e. cppsafe cannot find the compiler built-in header files. Everything is OK if I use a simple wrapper script that adds the include directories. |
I'm thinking about how to solve the problem. Cppsafe is released standalone, if you put it with llvm binaries, it can found c includes provided by clang (That's why clang-tidy cannot be released alone and must be bundled with llvm) cppsafe(just like other clang based tools, e.g. clang, clang-tidy) will infer c include directory as for compile_comands.json, maybe you can try: if(CMAKE_EXPORT_COMPILE_COMMANDS)
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
endif() put it in the bottom of your CMakeList.txt. to get full include paths. there is also a workaround for apple clang:
or
you can use for gcc, it seems that all clang-based tools inter a wrong path. simply embed maybe I should bundle |
copy cppsafe to |
Setting |
Fixed. Now the system header detection is incorporated in cppsafe itself. |
Fantastic! Thank you! |
Running cppsafe directly on a file caused error messages, but since the integration tests seems to be OK, I checked and found that you already have scripts that gather the include directories. Users need them, not just the tests.
So I suggest you provide a wrapper script that can gather the include directories. Otherwise a lot of people might be frustrated.
The text was updated successfully, but these errors were encountered: