Skip to content

Fix #454: Accept __has_include for GNU C standards #456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ludviggunne
Copy link
Contributor

No description provided.

std::list<std::string> defines;
std::set<std::string> undefined;
std::list<std::string> includePaths;
std::list<std::string> includes;
std::string std;
bool gnu;
Copy link
Owner

Choose a reason for hiding this comment

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

not a very strong opinion but if gnu is a method instead then std and gnu can't mismatch. i.e.:

    bool gnu() const {
         return std.rfind("gnu",0) == 0;
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cppcheck removes the "gnu" when creating the DUI:

    // TODO: use mSettings.standards.stdValue instead
    if (lang == Standards::Language::CPP) {
        dui.std = mSettings.standards.getCPP();
    ...

I'm not sure why mSettings.standards.stdValue is not used and is only a TODO here, but currently I think we need to have the gnu boolean, since cppcheck would turn for example gnu++11 in to c++11.

Copy link
Collaborator

@firewave firewave Jul 2, 2025

Choose a reason for hiding this comment

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

I'm not sure why mSettings.standards.stdValue is not used and is only a TODO here

Because I do not want to change stuff without having a test case and try to make dedicated fixes instead of drive-by ones - so I keep dropping TODOs in the code. And I keep getting distracted by too much other stuff...

Copy link
Collaborator

Choose a reason for hiding this comment

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

simplecpp should set __STRICT_ANSI__=1 if a non-gnu standard is provided. With that in-place we can write a test that makes sure that Cppcheck passes on the proper standards string.

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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy