diff --git a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GLDErrorParserTests.java b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GLDErrorParserTests.java index 599de3c4d5c..277a293137e 100644 --- a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GLDErrorParserTests.java +++ b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GLDErrorParserTests.java @@ -38,12 +38,13 @@ public class GLDErrorParserTests extends GenericErrorParserTests { new String[] { "make -k all", "gcc -o hallo.o main.c libfoo.a", "main.c(.text+0x14): undefined reference to `foo()'", "main.o(.rodata+0x14): undefined reference to `something'", + "(.text.myfunc+0x42): undefined reference to `bar'", "make: Target `all' not remade because of errors.", }, - 2, // errors + 3, // errors 0, // warnings 0, // Infos - new String[] { "main.c", "main.o" }, - new String[] { "undefined reference to `foo()'", "undefined reference to `something'" }, + new String[] { "main.c", "main.o", "project" }, new String[] { "undefined reference to `foo()'", + "undefined reference to `something'", "undefined reference to `bar'" }, new String[] { GLD_ERROR_PARSER_ID }); } @@ -53,12 +54,13 @@ public class GLDErrorParserTests extends GenericErrorParserTests { new String[] { "make -k all", "gcc -o hallo.o main.c libfoo.a", "main.c:(.text+0x14): undefined reference to `foo()'", "main.o:(.rodata+0x14): undefined reference to `something'", + "(.text.myfunc+0x42): undefined reference to `bar'", "make: Target `all' not remade because of errors.", }, - 2, // errors + 3, // errors 0, // warnings 0, // Infos - new String[] { "main.c", "main.o" }, - new String[] { "undefined reference to `foo()'", "undefined reference to `something'" }, + new String[] { "main.c", "main.o", "project" }, new String[] { "undefined reference to `foo()'", + "undefined reference to `something'", "undefined reference to `bar'" }, new String[] { GLD_ERROR_PARSER_ID }); } @@ -104,4 +106,32 @@ public class GLDErrorParserTests extends GenericErrorParserTests { "cannot find -ljpeg", }, new String[] { GLD_ERROR_PARSER_ID }); } + + public void testLinkerMessages_bug495661() throws IOException { + runParserTest( + // new style: colons before sections + new String[] { "make all ", + // @formatter:off + "Building file: ../src/a.cpp", + "Invoking: GCC C++ Compiler", + "g++ -std=c++0x -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF\"src/a.d\" -MT\"src/a.o\" -o \"src/a.o\" \"../src/a.cpp\"", + "Finished building: ../src/a.cpp", + " ", + "Building target: parser", + "Invoking: GCC C++ Linker", + "g++ -o \"a\" ./src/a.o ", + "/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: ./src/a.o: in function `TLS wrapper function for A::max_compatdb_time':", + "a.cpp:(.text._ZTWN1A17max_compatdb_timeE[_ZTWN1A17max_compatdb_timeE]+0x21): undefined reference to `A::max_compatdb_time'", + "collect2: error: ld returned 1 exit status", + "make: *** [makefile:47: parser] Error 1", + "\"make all\" terminated with exit code 2. Build might be incomplete.", }, + // @formatter:on + 2, // errors + 0, // warnings + 0, // Infos + new String[] { "a.cpp", "project" }, + new String[] { "./src/a.o: in function `TLS wrapper function for A::max_compatdb_time':", + "undefined reference to `A::max_compatdb_time'" }, + new String[] { GLD_ERROR_PARSER_ID }); + } } diff --git a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GenericErrorParserTests.java b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GenericErrorParserTests.java index d7f3eeba67b..48e9054ecd7 100644 --- a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GenericErrorParserTests.java +++ b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GenericErrorParserTests.java @@ -140,9 +140,13 @@ public abstract class GenericErrorParserTests extends TestCase { if (expectedFileNames != null) { assertEquals(expectedFileNames.length, markerGenerator.uniqFiles.size()); for (int i = 0; i < expectedFileNames.length; i++) { - // Keep in mind that uniqFiles get alphabetically sorted - IPath path = ((IFile) markerGenerator.uniqFiles.get(i)).getLocation(); - assertEquals(expectedFileNames[i], path.lastSegment()); + IResource resource = markerGenerator.uniqFiles.get(i); + // Markers for errors without source file has resource of type IProject + if (!(resource instanceof IProject)) { + assertTrue(resource instanceof IFile); + // Keep in mind that uniqFiles get alphabetically sorted + assertEquals(expectedFileNames[i], resource.getLocation().lastSegment()); + } } } diff --git a/core/org.eclipse.cdt.core/plugin.properties b/core/org.eclipse.cdt.core/plugin.properties index 39cddf9c21b..4de10e9378a 100755 --- a/core/org.eclipse.cdt.core/plugin.properties +++ b/core/org.eclipse.cdt.core/plugin.properties @@ -68,10 +68,10 @@ CDTGNUCErrorParser.regex.GenericWarning=(.*?):(\\d+):(\\d+:)?\\s*(([Ww]arning)|( CDTGNUCErrorParser.regex.OtherError=(.*?):(\\d+):(\\d+:)? (.*) CDTGNULinkerErrorParser.name=GNU Linker Error Parser -CDTGNULinkerErrorParser.regex.InFunction=(.*?):?(\\(\\.\\w+\\+.*\\))?:\\s*(In function [`'"](.*)['"]:) +CDTGNULinkerErrorParser.regex.InFunction=(.*?):?(\\(\\.[^\\s+]+\\+.*\\))?:\\s*(In function [`'"](.*)['"]:) CDTGNULinkerErrorParser.regex.WarningDangerousFunction=(.*?):(\\d+):(\\d+:)? ([Ww]arning:)?\\s*(the use of [`'"](.*)['"] is dangerous, better use [`'"](.*)['"].*) -CDTGNULinkerErrorParser.regex.TextWarning=(.*?):?\\(\\.\\w+\\+.*\\): [Ww]arning:? (.*) -CDTGNULinkerErrorParser.regex.TextError=(.*?):?\\(\\.\\w+\\+.*\\): (.*) +CDTGNULinkerErrorParser.regex.TextWarning=(.*?):?\\(\\.[^\\s+]+\\+.*\\): [Ww]arning:? (.*) +CDTGNULinkerErrorParser.regex.TextError=(.*?):?\\(\\.[^\\s+]+\\+.*\\): (.*) CDTGNULinkerErrorParser.regex.ldWarning=(.*[/\\\\])?ld(\\.exe)?: [Ww]arning:? (.*) CDTGNULinkerErrorParser.regex.ldError=(.*[/\\\\])?ld(\\.exe)?: (.*)