diff options
4 files changed, 125 insertions, 32 deletions
diff --git a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GCCErrorParserTests.java b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GCCErrorParserTests.java index 80607f4a2cf..431e96e1cfc 100644 --- a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GCCErrorParserTests.java +++ b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/errorparsers/tests/GCCErrorParserTests.java @@ -50,17 +50,24 @@ public class GCCErrorParserTests extends GenericErrorParserTests { public static final String[] GCC_ERROR_STREAM3_DESCRIPTIONS = {"ISO C++", "are ambiguous", "worst conversion", "conversion for the latter"}; - public static final String[] GCC_ERROR_STREAM4 = {"C:/QNX630/workspace/System/inc/RPNEvaluator.hpp: In member function `", + public static final String[] GCC_ERROR_STREAM4 = { + "C:/QNX630/workspace/System/inc/RPNEvaluator.hpp: In member function `", " NumericType RPNEvaluator<NumericType>::evaluate(const char*) [with ", " NumericType = int8]':", "C:/QNX630/workspace/System/src/CommonScriptClasses.cpp:609: instantiated from here", "C:/QNX630/workspace/System/inc/RPNEvaluator.hpp:370: error: ISO C++ says that `", " char& String::operator[](unsigned int)' and `operator[]' are ambiguous even ", - " though the worst conversion for the former is better than the worst ", " conversion for the latter"}; + " though the worst conversion for the former is better than the worst ", + " conversion for the latter", + }; public static final int GCC_ERROR_STREAM4_WARNINGS = 0; public static final int GCC_ERROR_STREAM4_ERRORS = 1; public static final String[] GCC_ERROR_STREAM4_FILENAMES = {"RPNEvaluator.hpp"}; - public static final String[] GCC_ERROR_STREAM4_DESCRIPTIONS = {"ISO C++", "are ambiguous", "worst conversion for", - "conversion for the latter"}; + public static final String[] GCC_ERROR_STREAM4_DESCRIPTIONS = { + "ISO C++", + "are ambiguous", + "worst conversion for", + "conversion for the latter" + }; public static final String[] GCC_ERROR_STREAM5 = { "make -k all", @@ -72,7 +79,8 @@ public class GCCErrorParserTests extends GenericErrorParserTests { "main.c:6: error: parse error before \"return\"", "main.c:7:2: warning: no newline at end of file", "make: *** [hallo.o] Error 1", - "make: Target `all' not remade because of errors." }; + "make: Target `all' not remade because of errors." + }; public static final int GCC_ERROR_STREAM5_WARNINGS = 1; public static final int GCC_ERROR_STREAM5_ERRORS = 2; public static final String[] GCC_ERROR_STREAM5_FILENAMES = {"main.c"}; @@ -138,5 +146,82 @@ public class GCCErrorParserTests extends GenericErrorParserTests { ); } + public void testGccErrorMessages_C90Comments_bug193982() throws IOException { + runParserTest( + new String[] { + "Myfile.c:66:3: warning: C++ style comments are not allowed in ISO C90", + "Myfile.c:66:3: warning: (this will be reported only once per input file)", + }, + 0, // errors + 1, // warnings + new String[] {"Myfile.c"}, + new String[] {"C++ style comments are not allowed in ISO C90"}, + new String[] {GCC_ERROR_PARSER_ID} + ); + } + + public void testGccErrorMessages_ConflictingTypes() throws IOException { + runParserTest( + new String[] { + "bar.h:42: error: conflicting types for 'jmp_buf'", + "foo.c:12: warning: conflicting types for built-in function `memset'", + }, + 1, // errors + 1, // warnings + new String[] {"bar.h", "foo.c"}, + new String[] { + "conflicting types for 'jmp_buf'", + "conflicting types for built-in function `memset'", + }, + new String[] {GCC_ERROR_PARSER_ID} + ); + } + + public void testGccErrorMessages_InstantiatedFromHere() throws IOException { + runParserTest( + new String[] { + "C:/QNX630/workspace/System/src/CommonScriptClasses.cpp:609: instantiated from here", + }, + 0, // errors + 0, // warnings + 1, // infos + new String[] {"CommonScriptClasses.cpp"}, + new String[] {"instantiated from here"}, + new String[] {GCC_ERROR_PARSER_ID} + ); + } + + public void testGccErrorMessages_Infos() throws IOException { + runParserTest( + new String[] { + "foo.c:5: note: Offset of packed bit-field 'b' has changed in GCC 4.4", + "bar.c:7: Info: foo undeclared, assumed to return int", + }, + 0, // errors + 0, // warnings + 2, // infos + new String[] {"bar.c", "foo.c"}, + new String[] { + "Offset of packed bit-field 'b' has changed in GCC 4.4", + "foo undeclared, assumed to return int", + }, + new String[] {GCC_ERROR_PARSER_ID} + ); + } + + public void testGccErrorMessages_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'", + }, + 0, // errors + 1, // warnings + new String[] {"mktemp.c"}, + new String[] {"the use of 'mktemp' is dangerous, better use 'mkstemp'",}, + new String[] {GCC_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 cf27a20fb32..724ebcf8366 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 @@ -17,6 +17,7 @@ import java.io.OutputStream; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.List; import junit.framework.TestCase; @@ -144,9 +145,9 @@ public abstract class GenericErrorParserTests extends TestCase { } if (expectedDescriptions != null) { - assertNotNull(markerGenerator.lastDescription); + assertNotNull(markerGenerator.descriptions); for (int i = 0; i < expectedDescriptions.length; i++) { - assertEquals(expectedDescriptions[i],markerGenerator.lastDescription); + assertEquals(expectedDescriptions[i],markerGenerator.descriptions.get(i)); } } } @@ -194,7 +195,7 @@ public abstract class GenericErrorParserTests extends TestCase { public int numInfos; public int numMarkers; public ArrayList uniqFiles; - public String lastDescription; + public List<String> descriptions; private Comparator fFileNameComparator; public void addMarker(IResource file, int lineNumber, String errorDesc, int severity, String errorVar) { @@ -220,7 +221,7 @@ public abstract class GenericErrorParserTests extends TestCase { numInfos++; } - lastDescription = problemMarkerInfo.description; + descriptions.add(problemMarkerInfo.description); numMarkers++; } @@ -230,6 +231,7 @@ public abstract class GenericErrorParserTests extends TestCase { numWarnings = 0; numInfos = 0; uniqFiles = new ArrayList(0); + descriptions = new ArrayList<String>(0); fFileNameComparator = new FileNameComparator(); } } diff --git a/core/org.eclipse.cdt.core/plugin.properties b/core/org.eclipse.cdt.core/plugin.properties index bc3fa6e1796..61989a47521 100644 --- a/core/org.eclipse.cdt.core/plugin.properties +++ b/core/org.eclipse.cdt.core/plugin.properties @@ -49,21 +49,24 @@ CDTGNUAssemblerErrorParser.name=CDT GNU Assembler Error Parser CDTGNULinkerErrorParser.name=CDT GNU Linker Error Parser CDTWorkingDirLocator.name=CDT CWD Locator CDTGNUMakeErrorParser.name=CDT GNU Make Error Parser 7.0 -CDTVisualCErrorParser.name=CDT Visual C Error Parser 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 -CDTGNUMakeErrorParser.regex.ReportedOnlyOnce=.*\\(Each undeclared identifier is reported only once.* -CDTGNUMakeErrorParser.regex.ForEachFunctionItAppearsIn=.*for each function it appears in.\\).* -CDTGNUMakeErrorParser.regex.InstantiatedFrom=.*instantiated from .* -CDTGNUMakeErrorParser.regex.GenericNote=.* note:.* -CDTGNUMakeErrorParser.regex.ParseErrorBefore=(.*?):([0-9]+):([0-9]+:)? (parse error before.*[`'"](.*)'"].*) -CDTGNUMakeErrorParser.regex.ErrorUndeclared=(.*?):([0-9]+):([0-9]+:)? [Ee]rror: ([`'"](.*)['"] undeclared .*) -CDTGNUMakeErrorParser.regex.GenericError=(.*?):([0-9]+):([0-9]+:)?\\s*(([Ee]rror)|(ERROR)): (.*) -CDTGNUMakeErrorParser.regex.DefinedButNotUsed=(.*?):([0-9]+):([0-9]+:)? [Ww]arning: ([`'"](.*)['"] defined but not used.*) -CDTGNUMakeErrorParser.regex.ConflictingTypesFor=(.*?):([0-9]+):([0-9]+:)? [Ww]arning: (conflicting types for .*[`'"](.*)['"].*) -CDTGNUMakeErrorParser.regex.GenericWarning=(.*?):([0-9]+):([0-9]+:)?\\s*(([Ww]arning)|(WARNING)): (.*) -CDTGNUMakeErrorParser.regex.OtherError=(.*?):([0-9]+):([0-9]+:)? (.*) +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 diff --git a/core/org.eclipse.cdt.core/plugin.xml b/core/org.eclipse.cdt.core/plugin.xml index ce726841761..05ed1a97e89 100644 --- a/core/org.eclipse.cdt.core/plugin.xml +++ b/core/org.eclipse.cdt.core/plugin.xml @@ -157,17 +157,20 @@ class="org.eclipse.cdt.core.errorparsers.RegexErrorParser" id="org.eclipse.cdt.core.GCCErrorParser" name="%CDTGNUCErrorParser.name"> - <pattern description-expr="" eat-processed-line="true" file-expr="" line-expr="" regex="%CDTGNUMakeErrorParser.regex.ReportedOnlyOnce" severity="Ignore"/> - <pattern description-expr="" eat-processed-line="true" file-expr="" line-expr="" regex="%CDTGNUMakeErrorParser.regex.ForEachFunctionItAppearsIn" severity="Ignore"/> - <pattern description-expr="" eat-processed-line="true" file-expr="" line-expr="" regex="%CDTGNUMakeErrorParser.regex.InstantiatedFrom" severity="Ignore"/> - <pattern description-expr="" eat-processed-line="true" file-expr="" line-expr="" regex="%CDTGNUMakeErrorParser.regex.GenericNote" severity="Ignore"/> - <pattern description-expr="$4" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUMakeErrorParser.regex.ParseErrorBefore" severity="Error" variable-expr="$5"/> - <pattern description-expr="$4" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUMakeErrorParser.regex.ErrorUndeclared" severity="Error" variable-expr="$5"/> - <pattern description-expr="$7" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUMakeErrorParser.regex.GenericError" severity="Error"/> - <pattern description-expr="$4" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUMakeErrorParser.regex.DefinedButNotUsed" severity="Warning" variable-expr="$5"/> - <pattern description-expr="$4" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUMakeErrorParser.regex.ConflictingTypesFor" severity="Warning" variable-expr="$5"/> - <pattern description-expr="$7" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUMakeErrorParser.regex.GenericWarning" severity="Warning"/> - <pattern description-expr="$4" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUMakeErrorParser.regex.OtherError" severity="Error"/> + <pattern description-expr="" eat-processed-line="true" file-expr="" line-expr="" regex="%CDTGNUCErrorParser.regex.ReportedOnlyOnce" severity="Ignore"/> + <pattern description-expr="" eat-processed-line="true" file-expr="" line-expr="" regex="%CDTGNUCErrorParser.regex.ForEachFunctionItAppearsIn" severity="Ignore"/> + <pattern description-expr="" eat-processed-line="true" file-expr="" line-expr="" regex="%CDTGNUCErrorParser.regex.ReportedOnlyOncePerInputFile" severity="Ignore"/> + <pattern description-expr="$4" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUCErrorParser.regex.ErrorUndeclared" severity="Error" variable-expr="$5"/> + <pattern description-expr="$4" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUCErrorParser.regex.ErrorConflictingTypesFor" severity="Error" variable-expr="$5"/> + <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="$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"/> + <pattern description-expr="$9" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUCErrorParser.regex.GenericInfo" severity="Info"/> + <pattern description-expr="$4" eat-processed-line="true" file-expr="$1" line-expr="$2" regex="%CDTGNUCErrorParser.regex.OtherError" severity="Error"/> </errorparser> </extension> <extension |