This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add clang-format config to contrib folder
- From: Markus Trippelsdorf <markus at trippelsdorf dot de>
- To: Martin LiÅka <mliska at suse dot cz>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, sebpop at gmail dot com
- Date: Wed, 18 Nov 2015 15:37:51 +0100
- Subject: Re: [PATCH] Add clang-format config to contrib folder
- Authentication-results: sourceware.org; auth=none
- References: <564C86E2 dot 8020609 at suse dot cz>
On 2015.11.18 at 15:10 +0100, Martin LiÅka 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 for doing this. It works fine except one problem: You should
delete "SortIncludes: false" from the contrib/clang-format file, because
it is the default for custom styles and doesn't work in .clang-format
(it is a command line option instead):
markus@x4 gcc % clang-format -style=file gcc-main.c
YAML:47:15: error: unknown key 'SortIncludes'
Otherwise it looks good to me.
--
Markus