Before you create a new issue
- Is it really a cxx-plugin issue ... yes
- Please read the [Wiki] ... check: relevant pages are on includeDirectories, troubleshooting, detect and fix, jsonCompilationDatabase
- Please [turn debug info on] ... check
- Please check if there is not already a [bug report] ... check
Describe the bug
- A source file includes
<exception>.
- A include folder named exception exists along the search list:
- e.g. include/exception/MyException.hpp
- class MyException typically also includes
<exception>, which may account for some occurrences of the error if the header is in cxx.sources
- Sonar finds the folder, instead of e.g. /usr/include/c++/11/exception .
- error message is like
ERROR preprocessor: .../include/exception (Is a directory) ...
- This screenshot shows grepping over 4 sonar-scanner logs
grep -Hne 'Is a directory' 202*
- The first run (20240608-073726) has both
sonar.cxx.jsonCompilationDatabase=build/compile_commands.json and sonar.cxx.includeDirectories=include configured. The log shows the error two times.
- The second run (20240608-075350) has both lines commented out, eliminating the error. This is not a workaround for any real-world project. It demonstrates that
<exception> is found just like the compiler does it.
- The third run re-introduces the problem with compilation database only, producing one error
- The third run re-introduces the problem with cxx.includeDirectories only, producing two errors
To Reproduce
Steps to reproduce the behavior:
- See the small example attached example.tar.gz
Expected behavior
Since the compiler is able to work it out, cxx's preprocessor should too: a directory should not match when looking for a header file.
Desktop (please complete the following information):
- OS: Ubuntu 22.04
- SonarQube version: 9.9.5
- cxx plugin version: 2.1.1.488
- sonar-scanner version: 6.0.0.4432
Before you create a new issue
Describe the bug
<exception>.<exception>, which may account for some occurrences of the error if the header is in cxx.sourcesERROR preprocessor: .../include/exception (Is a directory) ...grep -Hne 'Is a directory' 202*sonar.cxx.jsonCompilationDatabase=build/compile_commands.jsonandsonar.cxx.includeDirectories=includeconfigured. The log shows the error two times.<exception>is found just like the compiler does it.To Reproduce
Steps to reproduce the behavior:
Expected behavior
Since the compiler is able to work it out, cxx's preprocessor should too: a directory should not match when looking for a header file.
Desktop (please complete the following information):