Skip to content

Conversation

@akash-manna-sky
Copy link
Contributor

@akash-manna-sky akash-manna-sky commented Oct 7, 2025

JENKINS-73509

GCC parser does not handle cc1/cc1plus warnings

Testing done

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@akash-manna-sky akash-manna-sky marked this pull request as ready for review October 8, 2025 08:51
@uhafner uhafner marked this pull request as draft October 16, 2025 20:44
@uhafner uhafner added the enhancement Enhancement of existing functionality label Nov 5, 2025
Copy link
Member

@uhafner uhafner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks almost good now, thanks for your patience...

@Override
protected Optional<Issue> createIssue(final Matcher matcher, final LookaheadStream lookahead,
final IssueBuilder builder) {
// Extract named groups from the regex match
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not comment things that are expressed as code.

Suggested change
// Extract named groups from the regex match

String severityLevel = matcher.group("severity"); // warning, error, or note
String messageContent = matcher.group("message"); // The actual message text

// Validate that all required fields are present
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Validate that all required fields are present

Comment on lines 80 to 102
/**
* Maps the severity string from compiler output to a Severity enum value.
*
* Mapping:
* - "warning" → WARNING_NORMAL
* - "error" → WARNING_HIGH
* - "note" → WARNING_LOW
* - default → WARNING_NORMAL
*
* @param severityString the severity string from the compiler output
* (warning/error/note)
* @return the corresponding Severity enum value for issue classification
*/
private Severity mapSeverity(final String severityString) {
if (equalsIgnoreCase(severityString, "warning")) {
return Severity.WARNING_NORMAL;
} else if (equalsIgnoreCase(severityString, "error")) {
return Severity.WARNING_HIGH;
} else if (equalsIgnoreCase(severityString, "note")) {
return Severity.WARNING_LOW;
}
return Severity.WARNING_NORMAL; // Default fallback
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace with Severity.guessSeverity

Comment on lines 110 to 114
private boolean isCc1MessageContinuation(final LookaheadStream lookahead) {
var peek = lookahead.peekNext();
if (peek.length() < 3) {
return false;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we reuse the same method from the Gcc4Parser?

*/
private static final String GCC_CC1_WARNING_PATTERN = "^(?:In .+?:\\s*)?" // Optional context prefix (e.g., "In member function:")
+ "(?<compiler>cc1(?:plus)?):\\s*" // Compiler name: cc1 or cc1plus
+ "(?<severity>warning|error|note):\\s*" // Severity level
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you override, this will speed up the parser:


    @Override
    protected boolean isLineInteresting(final String line) {
        return line.contains("warning") || line.contains("error") || line.contains("note");
    }

@uhafner uhafner marked this pull request as ready for review November 5, 2025 11:50
@akash-manna-sky
Copy link
Contributor Author

Hello @uhafner I have implemented all suggested changes. Please review the changes.

@uhafner uhafner merged commit a2d46e9 into jenkinsci:main Nov 5, 2025
32 checks passed
@uhafner
Copy link
Member

uhafner commented Nov 5, 2025

Thanks! I squashed your commits, please make sure that you write meaningful messages the next time...

@akash-manna-sky
Copy link
Contributor Author

Thanks! I’ll make sure to write clear and meaningful commit messages next time.

@akash-manna-sky akash-manna-sky deleted the JENKINS-73509 branch November 5, 2025 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhancement of existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants