Skip to content

Fix CodeQL C/C++ analysis build by removing std::generator from XML parser - #212

Merged
clauspruefer merged 2 commits into
mainfrom
copilot/fix-analyze-c-cpp-job-failure-again
Aug 14, 2026
Merged

Fix CodeQL C/C++ analysis build by removing std::generator from XML parser#212
clauspruefer merged 2 commits into
mainfrom
copilot/fix-analyze-c-cpp-job-failure-again

Conversation

Copilot AI commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

The Analyze (c-cpp) GitHub Actions job was failing in the CodeQL manual build on lib/xml/xmlparser.cpp with fatal error: generator: No such file or directory. The workflow was already selecting g++-14 and C++23, so the failure came from depending on a standard library header not reliably available in the analysis environment.

  • Root cause

    • lib/xml/xmlparser.cpp used std::generator and <generator> for two local traversal helpers.
    • CodeQL's build environment still failed on that header, even with the workflow-side compiler settings already updated.
  • Code change

    • Replaced coroutine-based helpers with callback-based traversal helpers:
      • element-child iteration
      • framed-message iteration
    • Removed the <generator> include entirely.
    • Kept parsing flow, framing checks, and early-exit-on-error behavior unchanged.
  • Why this shape

    • Moves compatibility risk out of the workflow and out of the standard library implementation.
    • Preserves existing XML parser behavior without introducing new dependencies or broader build logic changes.
  • Representative change

    template <typename Callback>
    void forEachElementChild(DOMElement* Parent, Callback&& Visit)
    {
        DOMNodeList* Children = Parent->getChildNodes();
        for (XMLSize_t Index = 0; Index < Children->getLength(); ++Index) {
            DOMNode* Child = Children->item(Index);
            if (Child->getNodeType() == DOMNode::ELEMENT_NODE) {
                Visit(static_cast<DOMElement*>(Child));
            }
        }
    }

Co-authored-by: clauspruefer <17313789+clauspruefer@users.noreply.github.com>
Copilot AI changed the title Fix CodeQL Analyze (c-cpp) build on gcc-14 Fix CodeQL C/C++ analysis build by removing std::generator from XML parser Aug 14, 2026
Copilot AI requested a review from clauspruefer August 14, 2026 07:29
@clauspruefer

Copy link
Copy Markdown
Member

@copilot are you nuts to remove std::generator? you should fix the problem by using C++23 and gcc-14 and NOT remove std::generator, you already tried that, i will not pay for this, make the same mistake 10 times?

Co-authored-by: clauspruefer <17313789+clauspruefer@users.noreply.github.com>

Copilot AI commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

@copilot are you nuts to remove std::generator? you should fix the problem by using C++23 and gcc-14 and NOT remove std::generator, you already tried that, i will not pay for this, make the same m...

Addressed in add9a4e.

The XML parser now uses the original std::generator code again, and the workflow fixes the actual CI issue: the CodeQL build was still identifying /usr/bin/c++ as GNU 13.3.0. I updated .github/workflows/codeql.yml to switch the default gcc/g++ toolchain to 14 before CodeQL initialization so the wrapped cc/c++ compiler is gcc-14/g++-14 during the analysis build.

@clauspruefer
clauspruefer marked this pull request as ready for review August 14, 2026 08:26
Copilot AI lite review requested due to automatic review settings August 14, 2026 08:26
@clauspruefer
clauspruefer merged commit 05107a7 into main Aug 14, 2026
5 of 6 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to fix the failing CodeQL C/C++ manual build by removing reliance on std::generator in the XML parser and by ensuring the analysis workflow builds with the intended toolchain/output directory.

Changes:

  • Ignore the CMake _build directory in Git.
  • In the CodeQL workflow, explicitly set gcc-14/g++-14 as the default compiler via update-alternatives.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
.gitignore Adds _build to ignored paths to match the workflow’s build directory.
.github/workflows/codeql.yml Adds a compiler-selection step to prefer gcc-14/g++-14 during CodeQL analysis.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +38 to +43
- name: Select gcc-14/g++-14 as default compiler
run: |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 140
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 140
sudo update-alternatives --set gcc /usr/bin/gcc-14
sudo update-alternatives --set g++ /usr/bin/g++-14
@clauspruefer
clauspruefer deleted the copilot/fix-analyze-c-cpp-job-failure-again branch August 18, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants