Bug #2004

ide: Problem with "note:" being red because there is "error" in the identifier

Added by Miroslav Fidler 15 days ago. Updated 9 days ago.

Status:NewStart date:11/28/2019
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-Spent time:-
Target version:-

uppsrc_ide.diff Magnifier - Patch for uppsrc/ide (since 13733 revision) (710 Bytes) Sender Ghost, 12/04/2019 03:31 AM

TheIDE_screenshot_20191204.png - Screenshot for TheIDE with applied patch (261 KB) Sender Ghost, 12/04/2019 04:18 AM

History

#1 Updated by Sender Ghost 13 days 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 13 days 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 13 days 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 13 days 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 13 days 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 13 days 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 9 days ago

Attached patch for mentioned checks, just in case.

#8 Updated by Sender Ghost 9 days ago

Attached screenshot for TheIDE (with applied patch) after build of examples/AddressBook package for gtk3 branch.

Also available in: Atom PDF