Re: clang formating

2020-11-13 Thread Martin Braun
Most IDEs have clang-format support built in and can tell you what's wrong
(like a word processor spellchecker). I use vim + ALE, for example. VS Code
also has plugins.

--M

On Wed, Nov 11, 2020 at 11:25 AM Volker Schroer  wrote:

> Hi,
>
> I just made a pr and got the message that the pr formatting check
> failed. But looking at the output I don't understand, what's wrong.
>
> Even more I'd like to know how I can do the formatting check locally.
> The coding guide in the wiki is empty.
>
> Thanks in advance
>
> -- Volker
>
>
>
>
>
>


Re: clang formating

2020-11-11 Thread Gisle Vanem




Den 11.11.2020 13.28, skrev Johannes Demel:

Hi Gisle,

`file` is not a placeholder but the literal argument. `--style=file` tells `clang-format` to search for a 
`.clang-format` file in the current and parent folders.


Oh. But deleting the '%GR_ROOT/.clang-format' and doing a:
  clang-format.exe -style=file -i file_descriptor_sink_impl.cc

in '%GR_ROOT/gr-blocks/lib', works too. So it traverses multiple
directories under my %GR_ROOT? Adding a '--verbose' gives no
extra clue what this tool does and where it finds '.clang-format'.

--
--gv



Re: clang formating

2020-11-11 Thread Johannes Demel

Hi Gisle,

`file` is not a placeholder but the literal argument. `--style=file` 
tells `clang-format` to search for a `.clang-format` file in the current 
and parent folders.


Cheers
Johannes

On 11.11.20 13:19, Gisle Vanem wrote:

Johannes Demel wrote:


unless the clang-format behavior changed, the function call should be:

clang-format --style=file -i path/to/file.cc

The `--style=file` option tells clang-format to search for a 
`.clang-format` file.


Does not work on Windows (using clang-format v10.0.0).
In a .bat-file I have:
   clang-format.exe -style=%GR_ROOT%/.clang-format -i %*

No matter how style is; '--style' or '-style', it
says 'Invalid value for -style'.

Only these values works:
   LLVM, Google, Chromium, Mozilla, WebKit.
which all are equally ugly.





Re: clang formating

2020-11-11 Thread Gisle Vanem

Johannes Demel wrote:


unless the clang-format behavior changed, the function call should be:

clang-format --style=file -i path/to/file.cc

The `--style=file` option tells clang-format to search for a `.clang-format` 
file.


Does not work on Windows (using clang-format v10.0.0).
In a .bat-file I have:
  clang-format.exe -style=%GR_ROOT%/.clang-format -i %*

No matter how style is; '--style' or '-style', it
says 'Invalid value for -style'.

Only these values works:
  LLVM, Google, Chromium, Mozilla, WebKit.
which all are equally ugly.

--
--gv



Re: clang formating

2020-11-11 Thread Ron Economos
It's apparently not documented, but it works without --style-file as 
long as a .clang-format file exists in a directory at or above your 
current directory. You can test it with:


clang-format --dump-config

Ron

On 11/11/20 02:53, Johannes Demel wrote:

Hi,

unless the clang-format behavior changed, the function call should be:

clang-format --style=file -i path/to/file.cc

The `--style=file` option tells clang-format to search for a 
`.clang-format` file.


Cheers
Johannes

On 11.11.20 11:47, Ron Economos wrote:
I forgot to mention, you have to run clang-format-10 in tree. It gets 
the formatting rules from the file .clang-format in the top level 
directory.


Ron

On 11/11/20 02:41, Ron Economos wrote:

On Ubuntu 20.04:

sudo apt-get install clang-format-10

Then update your changed files.

clang-format-10 -i sourcefile.cc

The -i formats the file in place. Otherwise, output is to stdout.

Ron

On 11/11/20 02:20, Volker Schroer wrote:

Hi,

I just made a pr and got the message that the pr formatting check
failed. But looking at the output I don't understand, what's wrong.

Even more I'd like to know how I can do the formatting check locally.
The coding guide in the wiki is empty.

Thanks in advance

-- Volker















Re: clang formating

2020-11-11 Thread Johannes Demel

Hi,

unless the clang-format behavior changed, the function call should be:

clang-format --style=file -i path/to/file.cc

The `--style=file` option tells clang-format to search for a 
`.clang-format` file.


Cheers
Johannes

On 11.11.20 11:47, Ron Economos wrote:
I forgot to mention, you have to run clang-format-10 in tree. It gets 
the formatting rules from the file .clang-format in the top level 
directory.


Ron

On 11/11/20 02:41, Ron Economos wrote:

On Ubuntu 20.04:

sudo apt-get install clang-format-10

Then update your changed files.

clang-format-10 -i sourcefile.cc

The -i formats the file in place. Otherwise, output is to stdout.

Ron

On 11/11/20 02:20, Volker Schroer wrote:

Hi,

I just made a pr and got the message that the pr formatting check
failed. But looking at the output I don't understand, what's wrong.

Even more I'd like to know how I can do the formatting check locally.
The coding guide in the wiki is empty.

Thanks in advance

-- Volker













Re: clang formating

2020-11-11 Thread Ron Economos
I forgot to mention, you have to run clang-format-10 in tree. It gets 
the formatting rules from the file .clang-format in the top level directory.


Ron

On 11/11/20 02:41, Ron Economos wrote:

On Ubuntu 20.04:

sudo apt-get install clang-format-10

Then update your changed files.

clang-format-10 -i sourcefile.cc

The -i formats the file in place. Otherwise, output is to stdout.

Ron

On 11/11/20 02:20, Volker Schroer wrote:

Hi,

I just made a pr and got the message that the pr formatting check
failed. But looking at the output I don't understand, what's wrong.

Even more I'd like to know how I can do the formatting check locally.
The coding guide in the wiki is empty.

Thanks in advance

-- Volker











Re: clang formating

2020-11-11 Thread Ron Economos

On Ubuntu 20.04:

sudo apt-get install clang-format-10

Then update your changed files.

clang-format-10 -i sourcefile.cc

The -i formats the file in place. Otherwise, output is to stdout.

Ron

On 11/11/20 02:20, Volker Schroer wrote:

Hi,

I just made a pr and got the message that the pr formatting check
failed. But looking at the output I don't understand, what's wrong.

Even more I'd like to know how I can do the formatting check locally.
The coding guide in the wiki is empty.

Thanks in advance

-- Volker









clang formating

2020-11-11 Thread Volker Schroer

Hi,

I just made a pr and got the message that the pr formatting check
failed. But looking at the output I don't understand, what's wrong.

Even more I'd like to know how I can do the formatting check locally.
The coding guide in the wiki is empty.

Thanks in advance

-- Volker