Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorTorbjörn Svensson2020-03-12 18:20:06 +0000
committerJonah Graham2020-04-01 19:36:25 +0000
commit36de92cc77ca2937b2361317cf95ddddf8e8443e (patch)
tree41a4a28ac9c56684768605f1085577695dab7b95 /core
parent0c464f651e7d16a66e4226730e5a93f2862a882b (diff)
downloadorg.eclipse.cdt-36de92cc77ca2937b2361317cf95ddddf8e8443e.tar.gz
org.eclipse.cdt-36de92cc77ca2937b2361317cf95ddddf8e8443e.tar.xz
org.eclipse.cdt-36de92cc77ca2937b2361317cf95ddddf8e8443e.zip
Bug 495661 - Period is a valid symbol in a section name
When using -ffunction-section, each function is placed in it's own section name. For example the main() function would be placed in .text.main, so the pattern looking for undefined references needs to allow the extra dot there. Since C++ will use other symbols than what's included in \w, lets allow everything except a + sign and whitespace. Change-Id: I66d9ee7d8cbc0a405e60d7cdeb43c38b30107245 Signed-off-by: Torbjörn Svensson <azoff@svenskalinuxforeningen.se>
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GLDErrorParserTests.java42
-rw-r--r--core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GenericErrorParserTests.java10
-rwxr-xr-xcore/org.eclipse.cdt.core/plugin.properties6
3 files changed, 46 insertions, 12 deletions
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)?: (.*)

Back to the top