Diagnostics of compiler output
Hello! What result of parsing compiler output should be? Should it create items in 'Problems' pane or only make links in plain output?
Thanks!
It should create entries in the Problems pane, as well as mark problems in source files. The compiler output will also be shown, and may become a link if Code can parse one.
Hmmm. I have "Information" entries ("Include file not found...") in Problems pane only. Showing the find dialog, entering "error:" string and Cmd+Clicking on error lines is the only suitable method for navigation within errors. May be I missed something in my configuraton.
Tested on OSX + clang.
Could I see some example compiler output? What have you set as your build directory setting? What compiler+ version are you using?
settings.json:
{ "cmake.buildDirectory": "${workspaceRoot}/../dpi-build" }
Compiler: Apple LLVM version 7.3.0 (clang-703.0.31) (installed with XCode command line tools) VSCode: 1.5.3 CMake Tools: 0.5.3
Output sample:
[ 98%] Building CXX object apps/Converter/CMakeFiles/dpi.dir/main.cpp.o In file included from /Users/ruslan.sorokin/Projects/Other/dpi/apps/Converter/ui/Tone.cpp:3: In file included from /Users/ruslan.sorokin/Projects/Other/dpi-build/apps/Converter/ui_tone.h:24: In file included from /Users/ruslan.sorokin/Projects/Other/dpi/coreui/levelswidget.h:6: /Users/ruslan.sorokin/Projects/Other/dpi/core/dpi_histogram.h:85:15: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare] if (i >= 0 && i < m_lut.size()) ~ ^ ~ In file included from /Users/ruslan.sorokin/Projects/Other/dpi/apps/Converter/ui/Balance.cpp:10: /Users/ruslan.sorokin/Projects/Other/dpi/core/dpi_histogram.h:85:15: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare] if (i >= 0 && i < m_lut.size()) ~ ^ ~
Note: All paths in output are clickable links.
Thanks!
Related problem: no diagnostics for fatal errors in GCC's output. Output is similar to the following:
/some/path/here:4:26: fatal error: some_header.h: No such file or directory
UPD: linking errors from ld aren't diagnosed too:
/some/path/here:101: undefined reference to `some_function'
Should I create separate issue for this?
Sorry to let this sit for a while. I've been trying to reproduce the issue myself and create some corresponding tests, but I haven't had much luck.
Thanks for the tip about fatal errors and linker errors. I'll see if I can get those knocked out as well.
Please, ask more details on output/settings if needed.
Try out the next update and see if the diagnostics show up properly now.
Errors are still shown only on output pane. Changed behavior: after finishing unsuccessful build yellow warning message from CMake Build Tools extension is shown on status bar.
Problems pane still have the warnings about about absent includes and it looks like that vscode c++ extension generate it itself.
Odd… I'll continue to investigate. I wrote tests that successfully parse exactly the output you gave above. I'm puzzled as to what may be going wrong on your system.
If anyone else is seeing this issue, please comment below with example output and platform information.
Note: I saw changes in yout last commit with GCC word in method name, I use Clang.
I did some tweaks to diagnostic parsing again in the 0.7.0 release. Could you verify the issue is still there?
Thank you! It works now! Still want to remove vscode's clang diagnostics about "missing" headers from here but this is not problem of CMakeTools.
Excellent! Thanks!
Update about linker output.
In the latest version (0.7.1) in case there are no compilation and linking errors warnings produce additional diagnostics misattributed to linker. For example for the following output I get one warning [GCC] unused variable ‘some_variable’ [-Wunused-variable] and 3 errors [Link] required from ...
[vscode] Executing cmake command: cmake --build /home/pa/work/some_project/bin/RelWithDebInfo --target all --config RelWithDebInfo -- -j 10
[1/10] Building CXX object CMakeFiles/some_project.dir/path/...module1.cpp.o
...
[9/10] Building CXX object CMakeFiles/some_project.dir/path/...module9.cpp.o
In file included from /home/pa/work/some_project/...some_header.h:4:0,
...,
from /home/pa/work/some_project/...module9.cpp:1:
/home/pa/work/some_project/...some_other_header.h: In instantiation of ...:
/home/pa/work/some_project/...module9.cpp:527:13: required from ...
/home/pa/work/some_project/...module9.cpp:801:9: required from ...
/home/pa/work/some_project/...module9.cpp:1207:74: required from here
/home/pa/work/some_project/...some_other_header.h:380:20: warning: unused variable ‘some_variable’ [-Wunused-variable]
size_t some_variable = ...;
^~~~~~~~~~
[10/10] Linking CXX executable some_project
[vscode] CMake exited with status 0
I guess the issue should be reopened. )