1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 10:16:03 +02:00

bug 248669: [Error Parser] gnu c/c++ error parser treats a warning as error

Tuning up GLDErrorParser
This commit is contained in:
Andrew Gvozdev 2010-02-05 03:46:44 +00:00
parent 98a002bca4
commit cd1a6a4ed4
3 changed files with 117 additions and 61 deletions

View file

@ -22,39 +22,6 @@ import junit.framework.TestSuite;
*/
public class GLDErrorParserTests extends GenericErrorParserTests {
// old style: no colons before sections
public static final String[] GLD_ERROR_STREAM0 = {
"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'",
"make: Target `all' not remade because of errors." };
public static final int GLD_ERROR_STREAM0_WARNINGS = 0;
public static final int GLD_ERROR_STREAM0_ERRORS = 2;
public static final String[] GLD_ERROR_STREAM0_FILENAMES = {"main.c","main.o"};
// new style: colons before sections
public static final String[] GLD_ERROR_STREAM1 = {
"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'",
"make: Target `all' not remade because of errors." };
public static final int GLD_ERROR_STREAM1_WARNINGS = 0;
public static final int GLD_ERROR_STREAM1_ERRORS = 2;
public static final String[] GLD_ERROR_STREAM1_FILENAMES = {"main.c","main.o"};
public static final String[] GLD_ERROR_STREAM2 = {
"make -k all",
"gcc -o hallo.o main.c libfoo.a",
"libfoo.a(foo.o): In function `foo':",
"foo.c:(.text+0x7): undefined reference to `bar'",
"make: Target `all' not remade because of errors." };
public static final int GLD_ERROR_STREAM2_WARNINGS = 0;
public static final int GLD_ERROR_STREAM2_ERRORS = 1;
public static final String[] GLD_ERROR_STREAM2_FILENAMES = {"foo.c"};
public GLDErrorParserTests() {
super();
}
@ -65,15 +32,84 @@ public class GLDErrorParserTests extends GenericErrorParserTests {
}
public void testLinkerMessages0() throws IOException {
runParserTest(GLD_ERROR_STREAM0, GLD_ERROR_STREAM0_ERRORS, GLD_ERROR_STREAM0_WARNINGS, GLD_ERROR_STREAM0_FILENAMES,
null, new String[]{GLD_ERROR_PARSER_ID});
runParserTest(
// old style: no colons before sections
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'",
"make: Target `all' not remade because of errors.",
},
2, // errors
0, // warnings
0, // Infos
new String[] {"main.c","main.o"},
new String[] {
"undefined reference to `foo()'",
"undefined reference to `something'"
},
new String[]{GLD_ERROR_PARSER_ID}
);
}
public void testLinkerMessages1() throws IOException {
runParserTest(GLD_ERROR_STREAM1, GLD_ERROR_STREAM1_ERRORS, GLD_ERROR_STREAM1_WARNINGS, GLD_ERROR_STREAM1_FILENAMES,
null, new String[]{GLD_ERROR_PARSER_ID});
runParserTest(
// new style: colons before sections
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'",
"make: Target `all' not remade because of errors.",
},
2, // errors
0, // warnings
0, // Infos
new String[] {"main.c","main.o"},
new String[] {
"undefined reference to `foo()'",
"undefined reference to `something'"
},
new String[]{GLD_ERROR_PARSER_ID}
);
}
public void testLinkerMessages2() throws IOException {
runParserTest(GLD_ERROR_STREAM2, GLD_ERROR_STREAM2_ERRORS, GLD_ERROR_STREAM2_WARNINGS, GLD_ERROR_STREAM2_FILENAMES,
null, new String[]{GLD_ERROR_PARSER_ID});
runParserTest(
new String[] {
"make -k all",
"gcc -o hallo.o main.c libfoo.a",
"libfoo.a(foo.o): In function `foo':",
"foo.c:(.text+0x7): undefined reference to `bar'",
"make: Target `all' not remade because of errors.",
},
1, // errors
0, // warnings
0, // Infos
new String[] {"foo.c"},
new String[] {"undefined reference to `bar'"},
new String[] {GLD_ERROR_PARSER_ID}
);
}
public void testLinkerMessages_DangerousFunction_bug248669() throws IOException {
runParserTest(
new String[] {
"mktemp.o(.text+0x19): In function 'main':",
"mktemp.c:15: the use of 'mktemp' is dangerous, better use 'mkstemp'",
"1.o: In function `main':",
"1.c:(.text+0x19): warning: the use of `mktemp' is dangerous, better use `mkstemp'",
},
0, // errors
2, // warnings
0, // Infos
new String[] {"1.c", "mktemp.c"},
new String[] {
"the use of 'mktemp' is dangerous, better use 'mkstemp'",
"the use of `mktemp' is dangerous, better use `mkstemp'",
},
new String[] {GLD_ERROR_PARSER_ID}
);
}
}

View file

@ -45,29 +45,35 @@ MachOParser64.name=Mach-O 64 Parser
SOMParser.name=HP-UX SOM Parser
CDTGNUCErrorParser.name=CDT GNU C/C++ Error Parser
CDTGNUAssemblerErrorParser.name=CDT GNU Assembler Error Parser
CDTGNUCErrorParser.regex.ReportedOnlyOnce=(.*?):(\\d+):(\\d+:)? .*\\(Each undeclared identifier is reported only once.*
CDTGNUCErrorParser.regex.ForEachFunctionItAppearsIn=(.*?):(\\d+):(\\d+:)? .*for each function it appears in.\\).*
CDTGNUCErrorParser.regex.ReportedOnlyOncePerInputFile=(.*?):(\\d+):(\\d+:)? .*this will be reported only once per input file.*
CDTGNUCErrorParser.regex.InstantiatedFromHere=(.*?):(\\d+):(\\d+:)?\\s*(.*instantiated from here.*)
CDTGNUCErrorParser.regex.GenericInfo=(.*?):(\\d+):(\\d+:)?\\s*(([Nn]ote)|(NOTE)|([Ii]nfo)|(INFO)): (.*)
CDTGNUCErrorParser.regex.ParseErrorBefore=(.*?):(\\d+):(\\d+:)? (parse error before.*[`'"](.*)['"].*)
CDTGNUCErrorParser.regex.ErrorUndeclared=(.*?):(\\d+):(\\d+:)? [Ee]rror: ([`'"](.*)['"] undeclared .*)
CDTGNUCErrorParser.regex.ErrorConflictingTypesFor=(.*?):(\\d+):(\\d+:)? [Ee]rror: (conflicting types for .*[`'"](.*)['"].*)
CDTGNUCErrorParser.regex.GenericError=(.*?):(\\d+):(\\d+:)?\\s*(([Ee]rror)|(ERROR)): (.*)
CDTGNUCErrorParser.regex.DefinedButNotUsed=(.*?):(\\d+):(\\d+:)? [Ww]arning: ([`'"](.*)['"] defined but not used.*)
CDTGNUCErrorParser.regex.WarningConflictingTypesFor=(.*?):(\\d+):(\\d+:)? [Ww]arning: (conflicting types for .*[`'"](.*)['"].*)
CDTGNUCErrorParser.regex.GenericWarning=(.*?):(\\d+):(\\d+:)?\\s*(([Ww]arning)|(WARNING)): (.*)
CDTGNUCErrorParser.regex.OtherError=(.*?):(\\d+):(\\d+:)? (.*)
CDTGNULinkerErrorParser.name=CDT GNU Linker Error Parser
CDTGNULinkerErrorParser.regex.InFunction=(.*?):?(\\(\\.\\w+\\+.*\\))?:\\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.ldWarning=ld(\\.exe)?: [Ww]arning:? (.*)
CDTGNULinkerErrorParser.regex.ldError=ld(\\.exe)?: (.*)
CDTGNUAssemblerErrorParser.name=CDT GNU Assembler Error Parser
CDTWorkingDirLocator.name=CDT CWD Locator
CDTGNUMakeErrorParser.name=CDT GNU Make Error Parser 7.0
CDTGNUMakeErrorParser.name.deprecated=CDT GNU Make Error Parser 6.0 (Deprecated)
CDTVisualCErrorParser.name=CDT Visual C Error Parser
CDTRegexErrorParser.name=CDT Regular Expression Error Parser
CDTGNUCErrorParser.regex.ReportedOnlyOnce=(.*?):([0-9]+):([0-9]+:)? .*\\(Each undeclared identifier is reported only once.*
CDTGNUCErrorParser.regex.ForEachFunctionItAppearsIn=(.*?):([0-9]+):([0-9]+:)? .*for each function it appears in.\\).*
CDTGNUCErrorParser.regex.ReportedOnlyOncePerInputFile=(.*?):([0-9]+):([0-9]+:)? .*this will be reported only once per input file.*
CDTGNUCErrorParser.regex.InstantiatedFromHere=(.*?):([0-9]+):([0-9]+:)?\\s*(.*instantiated from here.*)
CDTGNUCErrorParser.regex.GenericInfo=(.*?):([0-9]+):([0-9]+:)?\\s*(([Nn]ote)|(NOTE)|([Ii]nfo)|(INFO)): (.*)
CDTGNUCErrorParser.regex.ParseErrorBefore=(.*?):([0-9]+):([0-9]+:)? (parse error before.*[`'"](.*)['"].*)
CDTGNUCErrorParser.regex.ErrorUndeclared=(.*?):([0-9]+):([0-9]+:)? [Ee]rror: ([`'"](.*)['"] undeclared .*)
CDTGNUCErrorParser.regex.ErrorConflictingTypesFor=(.*?):([0-9]+):([0-9]+:)? [Ee]rror: (conflicting types for .*[`'"](.*)['"].*)
CDTGNUCErrorParser.regex.GenericError=(.*?):([0-9]+):([0-9]+:)?\\s*(([Ee]rror)|(ERROR)): (.*)
CDTGNUCErrorParser.regex.DefinedButNotUsed=(.*?):([0-9]+):([0-9]+:)? [Ww]arning: ([`'"](.*)['"] defined but not used.*)
CDTGNUCErrorParser.regex.WarningConflictingTypesFor=(.*?):([0-9]+):([0-9]+:)? [Ww]arning: (conflicting types for .*[`'"](.*)['"].*)
CDTGNUCErrorParser.regex.WarningDangerousFunction=(.*?):([0-9]+):([0-9]+:)? ([Ww]arning:)?\\s*(the use of [`'"](.*)['"] is dangerous, better use [`'"](.*)['"].*)
CDTGNUCErrorParser.regex.GenericWarning=(.*?):([0-9]+):([0-9]+:)?\\s*(([Ww]arning)|(WARNING)): (.*)
CDTGNUCErrorParser.regex.OtherError=(.*?):([0-9]+):([0-9]+:)? (.*)
PathEntryContainerInitializer=Path Entry Container Initializer
fileTypeMapping.AssemblyLanguage=Assembly

View file

@ -165,7 +165,7 @@
<pattern description-expr="$4" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUCErrorParser.regex.ParseErrorBefore" severity="Error" variable-expr="$5"/>
<pattern description-expr="$4" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUCErrorParser.regex.DefinedButNotUsed" severity="Warning" variable-expr="$5"/>
<pattern description-expr="$4" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUCErrorParser.regex.WarningConflictingTypesFor" severity="Warning" variable-expr="$5"/>
<pattern description-expr="$5" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUCErrorParser.regex.WarningDangerousFunction" severity="Warning" variable-expr="$6"/>
<pattern description-expr="$5" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNULinkerErrorParser.regex.WarningDangerousFunction" severity="Warning" variable-expr="$6"/>
<pattern description-expr="$4" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUCErrorParser.regex.InstantiatedFromHere" severity="Info"/>
<pattern description-expr="$7" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUCErrorParser.regex.GenericError" severity="Error"/>
<pattern description-expr="$7" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUCErrorParser.regex.GenericWarning" severity="Warning"/>
@ -192,32 +192,46 @@
id="org.eclipse.cdt.core.GLDErrorParser"
name="%CDTGNULinkerErrorParser.name">
<pattern
description-expr="$2"
description-expr="$3"
eat-processed-line="true"
file-expr="$1"
line-expr=""
regex="(.*)\(\.text\+.*\): [Ww]arning:? (.*)"
regex="%CDTGNULinkerErrorParser.regex.InFunction"
severity="Ignore"/>
<pattern
description-expr="$5"
eat-processed-line="true"
file-expr="$1"
line-expr="$2"
regex="%CDTGNULinkerErrorParser.regex.WarningDangerousFunction"
severity="Warning"/>
<pattern
description-expr="$2"
eat-processed-line="true"
file-expr="$1"
line-expr=""
regex="(.*?):?\(\.\w+\+.*\): (.*)"
regex="%CDTGNULinkerErrorParser.regex.TextWarning"
severity="Warning"/>
<pattern
description-expr="$2"
eat-processed-line="true"
file-expr="$1"
line-expr=""
regex="%CDTGNULinkerErrorParser.regex.TextError"
severity="Error"/>
<pattern
description-expr="$2"
eat-processed-line="true"
file-expr=""
line-expr=""
regex="ld(\.exe)?: [Ww]arning:? (.*)"
regex="%CDTGNULinkerErrorParser.regex.ldWarning"
severity="Warning"/>
<pattern
description-expr="$2"
eat-processed-line="true"
file-expr=""
line-expr=""
regex="ld(\.exe)?: (.*)"
regex="%CDTGNULinkerErrorParser.regex.ldError"
severity="Error"/>
</errorparser>
</extension>