You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@arrow.apache.org by Li Jin <ic...@gmail.com> on 2022/05/10 18:19:17 UTC

[C++] Code style and lint question

Hello!

I am trying to fix C++ code style & lint for my PR.

Currently I am running  "archery lint --cpplint --clang-format --clang-tidy
--fix" and encountered 2 issues:

1. File
/home/icexelloss/workspace/arrow/cpp/src/arrow/compute/exec/concurrent_bounded_queue.h
failed C++/CLI lint check: Uses <mutex>
Line 21: #include <mutex>

What does this error mean? (I saw other file include <mutex> as well and
not didn't find anything on google)

2. Archery seems to to be stuck at this step:
[0/1] cd /tmp/arrow-lint-tk1n010w/cpp-build &&
/home/icexelloss/venv/arrow-dev/bin/python3.10
/home/icexelloss/workspace/arrow/cpp/build-support/run_clang_tidy.py
--clang_tidy_binary /...ons.txt --source_dir
/home/icexelloss/workspace/arrow/cpp/src --source_dir
/home/icexelloss/workspace/arrow/cpp/examples --source_dir
/home/icexelloss/workspace/arrow/cpp/tools --quiet

It has been in that state for a quite a while now (over 30min).

Any suggestions on how I should debug this? (Attached log in case)

Thanks!
Li

Re: [C++] Code style and lint question

Posted by Li Jin <ic...@gmail.com>.
Thanks Weston. This resolved issue 1 for me.

As for issue 2, I am now running
"ninja format lint clang-tidy lint_cpp_cli"

and it seems to still take a while (over 30min now), and the console shows
"
[2/4] cd /home/icexelloss/workspace/arrow/cpp/build && /usr/bin/python3.10
/home/icexelloss/workspace/arrow/cpp/build-support/run_clang_format.py
--clang_format_binary /usr/bin/clang-f...t --source_dir
/home/icexelloss/workspace/arrow/cpp/src --source_dir
/home/icexelloss/workspace/arrow/cpp/examples --source_dir
/home/icexelloss/workspace/arrow/cpp/tools --fix --quiet
[3/4] cd /home/icexelloss/workspace/arrow/cpp/build && /usr/bin/python3.10
/home/icexelloss/workspace/arrow/cpp/build-support/run_cpplint.py
--cpplint_binary /home/icexelloss/workspace...ons.txt --source_dir
/home/icexelloss/workspace/arrow/cpp/src --source_dir
/home/icexelloss/workspace/arrow/cpp/examples --source_dir
/home/icexelloss/workspace/arrow/cpp/tools --quiet
"

I wonder if these generally just take a long time or did I do something
wrong?

Thanks,
Li

On Tue, May 10, 2022 at 3:29 PM Weston Pace <we...@gmail.com> wrote:

> 1. You are not allowed to include <mutex> in any public header file.
> It has something to do with Windows (I forget the details).  If you
> can move all use of mutex into the implementation that works.
> Sometimes we have to use the pimpl pattern to make this happen.
> Another alternative is to include "arrow/util/mutex.h" and use
> arrow::Mutex which wraps std::mutex.
>
> 2. I ran into this myself when I tried to use clang-tidy recently.  I
> never did get it to finish and I haven't figured out the root cause.
> To run lint I usually just run "ninja lint" in my build directory.
> Maybe someone else knows more.
>
> On Tue, May 10, 2022 at 8:19 AM Li Jin <ic...@gmail.com> wrote:
> >
> > Hello!
> >
> > I am trying to fix C++ code style & lint for my PR.
> >
> > Currently I am running  "archery lint --cpplint --clang-format
> --clang-tidy --fix" and encountered 2 issues:
> >
> > 1. File
> /home/icexelloss/workspace/arrow/cpp/src/arrow/compute/exec/concurrent_bounded_queue.h
> failed C++/CLI lint check: Uses <mutex>
> > Line 21: #include <mutex>
> >
> > What does this error mean? (I saw other file include <mutex> as well and
> not didn't find anything on google)
> >
> > 2. Archery seems to to be stuck at this step:
> > [0/1] cd /tmp/arrow-lint-tk1n010w/cpp-build &&
> /home/icexelloss/venv/arrow-dev/bin/python3.10
> /home/icexelloss/workspace/arrow/cpp/build-support/run_clang_tidy.py
> --clang_tidy_binary /...ons.txt --source_dir
> /home/icexelloss/workspace/arrow/cpp/src --source_dir
> /home/icexelloss/workspace/arrow/cpp/examples --source_dir
> /home/icexelloss/workspace/arrow/cpp/tools --quiet
> >
> > It has been in that state for a quite a while now (over 30min).
> >
> > Any suggestions on how I should debug this? (Attached log in case)
> >
> > Thanks!
> > Li
>

Re: [C++] Code style and lint question

Posted by Weston Pace <we...@gmail.com>.
1. You are not allowed to include <mutex> in any public header file.
It has something to do with Windows (I forget the details).  If you
can move all use of mutex into the implementation that works.
Sometimes we have to use the pimpl pattern to make this happen.
Another alternative is to include "arrow/util/mutex.h" and use
arrow::Mutex which wraps std::mutex.

2. I ran into this myself when I tried to use clang-tidy recently.  I
never did get it to finish and I haven't figured out the root cause.
To run lint I usually just run "ninja lint" in my build directory.
Maybe someone else knows more.

On Tue, May 10, 2022 at 8:19 AM Li Jin <ic...@gmail.com> wrote:
>
> Hello!
>
> I am trying to fix C++ code style & lint for my PR.
>
> Currently I am running  "archery lint --cpplint --clang-format --clang-tidy --fix" and encountered 2 issues:
>
> 1. File /home/icexelloss/workspace/arrow/cpp/src/arrow/compute/exec/concurrent_bounded_queue.h failed C++/CLI lint check: Uses <mutex>
> Line 21: #include <mutex>
>
> What does this error mean? (I saw other file include <mutex> as well and not didn't find anything on google)
>
> 2. Archery seems to to be stuck at this step:
> [0/1] cd /tmp/arrow-lint-tk1n010w/cpp-build && /home/icexelloss/venv/arrow-dev/bin/python3.10 /home/icexelloss/workspace/arrow/cpp/build-support/run_clang_tidy.py --clang_tidy_binary /...ons.txt --source_dir /home/icexelloss/workspace/arrow/cpp/src --source_dir /home/icexelloss/workspace/arrow/cpp/examples --source_dir /home/icexelloss/workspace/arrow/cpp/tools --quiet
>
> It has been in that state for a quite a while now (over 30min).
>
> Any suggestions on how I should debug this? (Attached log in case)
>
> Thanks!
> Li