Skip to content
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

Enable clang-tidy bugprone-argument-comment and fix violations #22903

Merged
merged 1 commit into from
Sep 9, 2021

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Sep 6, 2021

Named arguments can be dangerous when they are wrong, because they are not enforced by the compiler. Currently there are only minor typos, no actual bugs.

Fix the typos and add the .clang-tidy file to make it easier to find them in the future.

@maflcko
Copy link
Member Author

maflcko commented Sep 6, 2021

To test on Ubuntu:

apt install clang-tidy bear clang
./autogen.sh && ./configure --with-incompatible-bdb CC=clang CXX=clang++
make clean && bear make -j $(nproc)     # For bear 2.x
make clean && bear -- make -j $(nproc)  # For bear 3.x
( cd ./src/ && run-clang-tidy  -j $(nproc) )

@kiminuo
Copy link
Contributor

kiminuo commented Sep 6, 2021

Is it possibly instead of:

make clean && bear make -j $(nproc)
->
make clean && bear -- make -j $(nproc)

?

(https://github.com/rizsotto/Bear#how-to-use)

edit: I think there are two more instances where the parameter names are not entirely correct:

@DrahtBot
Copy link
Contributor

DrahtBot commented Sep 7, 2021

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #22019 (wallet: Introduce SelectionResult for encapsulating a coin selection solution by achow101)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@maflcko
Copy link
Member Author

maflcko commented Sep 7, 2021

@kiminuo

No, that doesn't work for me:

bear: Internal error.
Traceback (most recent call last):
  File "/usr/local/bin/bear", line 265, in wrapper
    return function(*args, **kwargs)
  File "/usr/local/bin/bear", line 291, in intercept_build
    exit_code, current = capture(args, category)
  File "/usr/local/bin/bear", line 315, in capture
    exit_code = run_build(args.build, env=environment)
  File "/usr/local/bin/bear", line 189, in run_build
    exit_code = subprocess.call(command, *args, **kwargs)
  File "/usr/lib64/python3.9/subprocess.py", line 349, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib64/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib64/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '--'
bear: Please run this command again and turn on verbose mode (add '-vvvv' as argument).

@kiminuo
Copy link
Contributor

kiminuo commented Sep 7, 2021

My bear version is bear 3.0.8 and I have Ubuntu 21.04. Anyway, bear make -j $(nproc) does not work for me, only bear -- make -j $(nproc). Maybe there was a breaking change in bear command. I don't know.

edit: Yes, https://github.com/rizsotto/Bear/pull/388/files

@maflcko
Copy link
Member Author

maflcko commented Sep 7, 2021

@kiminuo Thanks, updated comment

@maflcko
Copy link
Member Author

maflcko commented Sep 7, 2021

edit: I think there are two more instances where the parameter names are not entirely correct:

Thanks, fixed

@practicalswift
Copy link
Contributor

practicalswift commented Sep 8, 2021

Concept ACK

Could add this specific clang-tidy check as part of the CI lint pass to reduce the risk of introduction of bugprone argument comments going forward?

@maflcko
Copy link
Member Author

maflcko commented Sep 8, 2021

Could add this specific clang-tidy check as part of the CI lint pass to reduce the risk of introduction of bugprone argument comments going forward?

Seems like something that should be done in a separate pull request to keep the discussion here focussed on adding the flag and fixing the violations.

@practicalswift
Copy link
Contributor

cr ACK fa57fa1

Could add this specific clang-tidy check as part of the CI lint pass to reduce the risk of introduction of bugprone argument comments going forward?

Seems like something that should be done in a separate pull request to keep the discussion here focussed on adding the flag and fixing the violations.

Makes sense! I'd gladly review such PR FWIW :)

Copy link
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

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

ACK fa57fa1

@fanquake fanquake merged commit da67b75 into bitcoin:master Sep 9, 2021
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Sep 11, 2021
@maflcko maflcko deleted the 2109-tidyNamedArgs branch September 14, 2021 13:34
@bitcoin bitcoin locked and limited conversation to collaborators Oct 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants