[PATCH] Add clang-format config to contrib folder

Martin Liška mliska@suse.cz
Thu Nov 19 10:40:00 GMT 2015

On 11/19/2015 12:09 AM, Sebastian Pop wrote:
> Martin, thanks for getting this patch out.  I like the patch.
> Jeff, clang-format has scripts that allow formatting only the lines
> touched by a patch.
> It also has a script to integrate with git:
> https://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/git-clang-format
> We could use those scripts in a commit hook to automatically enforce
> correct formatting of new patches.
> Sebastian


Thanks for pointing out the script touching just modified lines,
I mentioned the script in the clang-format file.

Sending v2 that I'm going to install.


> On Wed, Nov 18, 2015 at 8:10 AM, Martin Liška <mliska@suse.cz> wrote:
>> Hello.
>> Following patch adds a clang-format config file that should respect the GNU coding standards.
>> As the file is not part of build process, I hope the patch can be applied even though
>> we've just skipped to stage3? The patch adds a hunk to Makefile which can create symlink
>> to the root directory of the GCC compiler. The clang-format automatically loads style from
>> the configuration file.
>> clang-format (version 3.8) provides rich variety of configuration options that can
>> ensure the GNU coding style.
>> Limitations:
>> + placement of opening brace of an initializer can't be requested
>> + sometimes, '(' is the trailing symbol at the end of a line, which can look weird
>> As we've been continuously converting our source base to C++, the clang-format should
>> provide better results than a collection of regular expressions (check_GNU_style.sh).
>> As a reference file I attach gcc/tree-ssa-uninit.c file.
>> Feel free to comment the suggested configuration file.
>> Thanks,
>> Martin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-clang-format-config-to-contrib-folder-v2.patch
Type: text/x-patch
Size: 5002 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20151119/9a79d90d/attachment.bin>

More information about the Gcc-patches mailing list