fix #13021: cmdline: validate option --std#6740
fix #13021: cmdline: validate option --std#6740danmar merged 5 commits intocppcheck-opensource:mainfrom
Conversation
|
Err, no. This adds additional knowledge to the code. Leveraging the existing logic would be to bail out when the result of the The next step would be to leverage the logic from simplecpp in those calls. Maybe moving the |
hmm no.. if user writes "c++26" then getCPP() will return CPPLatest. |
Ok sorry, must have misunderstood. I don't think it would be enough to check the return value of getC/getCPP since CPPLatest == CPP26 (--std=c++26 would get rejected). Maybe I should add back the bool reference approach from the last attempt? |
|
but assuming that EDIT: To clarify this leverages both |
Sounds good, I'll do that. |
Ah - right. I haven't changed that yet that the latest enum has a different meaning. Or did I try that already and did not want to do it for some reason? I guess that's why I did not fix that TODO yet since it as a ripple effect - as usual.
Also thought about the roundtrip approach but the other seemed cleaner. But that won't work either because |
then tell me why.
|
Sorry - I missed the comparison in the if-condition. But that is essentially the code we have in those |
|
I have a draft that just runs the getC/getCPP on the mSettings.standards instance, which I think is pretty clean. Just have to run through the tests. |
|
Using the |
Yes this is true, changed it. |
|
Is the next step to expose a standards enum in simplecpp? Is there a specific reason why cppstd_t and cstd_t are kept separate? |
Maybe!??!?
Apple and Oranges. It makes things awkward when coming from the outside - but looking from the inside out it makes a lot of sense. It is possible this has to be looked into when we have we have proper testing of the handling in the project imports and when merging I think I just realized an issue with this change. Currently |
Good catch.. yes we want to allow that and if user writes that then the cpp standard should be set to c++11 and the c standard should be set to c23. |
|
FYI I opened #6742 which adds some adjustments, tests and TODOs for things we will encountered in the next step. |
danmar
left a comment
There was a problem hiding this comment.
If CI is happy I believe we can merge this.
|
@ludviggunne if you feel this can be merged then convert it to a regular Pr (clicking on the "Ready for review" button). For me it looks OK now. |
|
LGTM. Thanks for your contribution and baring with the all feedback. |
|
No worries, it was just nice to get a slightly broader insight in to the project. |
Some of it ain't pretty...yet. |
|
This broke the forwarding of It will implicitly fixed with https://trac.cppcheck.net/ticket/13129. That's why I sometimes push back hard on even the simplest looking fixes because some parts still lack even basic test coverage and are quite fragile. Fortunately |
No description provided.