Skip to content

fixed #12045 - print error when using an option which has not been compiled in instead of treating it as non-existent or a no-op#5508

Merged
danmar merged 3 commits intocppcheck-opensource:mainfrom
firewave:cmd
Oct 21, 2023
Merged

fixed #12045 - print error when using an option which has not been compiled in instead of treating it as non-existent or a no-op#5508
danmar merged 3 commits intocppcheck-opensource:mainfrom
firewave:cmd

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

@firewave firewave commented Oct 4, 2023

Also disabled more internal code around those options and did some cleanups.

@firewave
Copy link
Copy Markdown
Collaborator Author

firewave commented Oct 4, 2023

Still needs the unit tests (to be adjusted) for all the options involved.

Update: And a ticket...

@firewave firewave changed the title print error when using an option which have not been compiled in instead of treating it as non-existent or a no-op [skip ci] print error when using an option which have not been compiled in instead of treating it as non-existent or a no-op Oct 6, 2023
@firewave firewave force-pushed the cmd branch 2 times, most recently from 8355d27 to 8ccb269 Compare October 6, 2023 15:43
@firewave firewave changed the title print error when using an option which have not been compiled in instead of treating it as non-existent or a no-op fixed #12045 - print error when using an option which have not been compiled in instead of treating it as non-existent or a no-op Oct 6, 2023
@firewave firewave marked this pull request as ready for review October 6, 2023 15:44
Comment thread cli/cmdlineparser.cpp
" Unknown type sizes\n"
" --plist-output=<path>\n"
" Generate Clang-plist output files in folder.\n";
" -l <load> Specifies that no new threads should be started if\n"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

hmm.. somehow it seems not ideal to display this option in the help output when it's not available at all. if we include it in the help output I suggest that we indicate that it is not available.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It is included in the manpage and the manual which are both static files.

The command-line should be treated like any API which is a fixed interface which will provide an error when something is not working/available.

Also some of this might be based on on checks in config.h which are based on the underlying system/compiler and might not even be controllable by the user which builds the binary (like not having process support on Windows).

We might be able to improve the documentation a bit but that should not be in the --help output which is just an overview and not an in-depth documentation. That's what the manpage is for.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes the manual is static as you say. But in this case we can be dynamic. How about writing a "NOT AVAILABLE" at least?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That would be quite subtle and re-introduce the usage of the preprocessor checks in the help which I also wanted to get rid of.

I guess we should use a struct to store information on each option and generate the help from that. That could also help with generating the manpage output so the information not duplicated. We could also add a note to the static documentation that the availability of that option depends on the platform or build options.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We could also add a note to the static documentation that the availability of that option depends on the platform or build options.

👍

@firewave firewave marked this pull request as draft October 12, 2023 17:10
@firewave firewave changed the title fixed #12045 - print error when using an option which have not been compiled in instead of treating it as non-existent or a no-op fixed #12045 - print error when using an option which has not been compiled in instead of treating it as non-existent or a no-op Oct 13, 2023
@firewave firewave marked this pull request as ready for review October 16, 2023 09:33
@danmar
Copy link
Copy Markdown
Collaborator

danmar commented Oct 21, 2023

I guess we can tweak it further in future PRs..

@danmar danmar merged commit 7086ffa into cppcheck-opensource:main Oct 21, 2023
@firewave firewave deleted the cmd branch October 21, 2023 09:07
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.

2 participants