Bug #2004
ide: Problem with "note:" being red because there is "error" in the identifier
| Status: | Approved | Start date: | 11/28/2019 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% | |
| Category: | - | Spent time: | - | |
| Target version: | - |
History
#1 Updated by Sender Ghost about 6 years ago
Some testcase for Ide::FindLineError method:
ClearErrorsPane();
//String line = "/usr/local/include/gtk-3.0/gdk/gdkmain.h:70:32: note: 'gdk_error_trap_push' declared here";
String line = Format("%s:1:1: note: 'gdk_error_trap_push' declared here", GetFirstFile());
ConsoleLine(line);
SetBottom(BERRORS);
which possible to place at the end of Ide::SetMain method.
Current f.kind equals to 1 (as for error case), while its value maybe as 3 (by default).
#2 Updated by Sender Ghost about 6 years ago
Another testcase, based on current implementation of Ide::FindLineError method:
#include <Core/Core.h>
int CheckLine(const String& ln)
{
int kind = 3;
if(ln.Find("warning") >= 0)
kind = 2;
else {
int q = ln.Find("error");
if(q >= 0 && (q == 0 || !IsAlpha(ln[q - 1])) && (q + 5 >= ln.GetCount() || !IsAlpha(ln[q - 1])))
kind = 1;
}
return kind;
}
CONSOLE_APP_MAIN
{
#define CHECKLINE(line, kind) ASSERT(CheckLine(line) == kind);
CHECKLINE("/path/to/file:1:1: error: expected expression", 1);
CHECKLINE("/usr/local/include/X11/X.h:139:9: warning: 'CurrentTime' macro redefined", 2);
CHECKLINE("/usr/local/include/gtk-3.0/gdk/gdkmain.h:70:32: note: 'gdk_error_trap_push' declared here", 3);
}#3 Updated by Sender Ghost about 6 years ago
Sender Ghost wrote:
Another testcase, based on current implementation of Ide::FindLineError method:
[...]
Need to add:
using namespace Upp;
#4 Updated by Sender Ghost about 6 years ago
Also possible to add following cases to check:
CHECKLINE("/path/to/warning:1:1: error: expected expression", 1);
CHECKLINE("/path/to/error:1:1: warning: implicit conversion turns floating-point number into integer: 'double' to 'bool' [-Wfloat-conversion]", 2);
CHECKLINE("c:\\path\\to\\file.cpp(10): warning C4710: 'std::exception_ptr std::exception_ptr::_Current_exception(void) throw()': function not inlined", 2);
CHECKLINE(" c:\\program files (x86)\\microsoft visual studio 14.0\\vc\\include\\exception(299): note: see declaration of 'std::exception_ptr::_Current_exception'", 3);
#5 Updated by Sender Ghost about 6 years ago
or with ".cpp" extension:
CHECKLINE("/path/to/warning.cpp:1:1: error: expected expression", 1);
CHECKLINE("/path/to/error.cpp:1:1: warning: implicit conversion turns floating-point number into integer: 'double' to 'bool' [-Wfloat-conversion]", 2);
#6 Updated by Sender Ghost about 6 years ago
Possible algorithm for C/C++ errors/warnings (Clang, GCC, MSVC):
if(ln.Find(": warning") >= 0)
f.kind = 2;
else if(ln.Find(": error") >= 0)
f.kind = 1;
else
f.kind = 3;
But for other compilers this maybe different, I guess, based on current more generic implementation.
#7 Updated by Sender Ghost almost 6 years ago
- File uppsrc_ide.diff
added
Attached patch for mentioned checks, just in case.
#8 Updated by Sender Ghost almost 6 years ago
- File TheIDE_screenshot_20191204.png added
Attached screenshot for TheIDE (with applied patch) after build of examples/AddressBook package for gtk3 branch.
#9 Updated by Miroslav Fidler almost 6 years ago
- Status changed from New to Approved