about summary refs log tree commit diff
path: root/.clang-format
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright dates with scripts/update-copyrightsJoseph Myers2023-01-061-1/+1
|
* Add .clang-format style fileNoah Goldstein2022-04-111-0/+156
Went with version >= 11.0 since it covers most of the major features and should be pretty universally accessibly. There are some issues: 1. indention of preprocessor directives: Unfortunately there doesn't appear to be a switch for a seperate 'IndentWidth' for preprocessor directives vs. normal code so we are stuck either not indenting the directives or over-indenting them. i.e: Desired: ``` #ifndef A # define B #endif ``` Options: ``` #ifndef A # define B /* Two spaces instead of one. */ #endif #ifndef C #define D /* No spaces. */ #endif ``` Chose to over-indent as it generally seems easier to script halving all pre-processor indentations than counting the nested depth and indenting from scratch. 2. concatenation of lines missing semi-colons: Throughout glibc there are macros used to setup aliasing that are outside of functions and don't end in semi-colons i.e: ``` libc_hidden_def (__pthread_self) weak_alias (__pthread_self, pthread_self) ``` clang-format reformats lines like these to: ``` libc_hidden_def (__pthread_self) weak_alias (__pthread_self, pthread_self) ``` which is generally undesirable. Other than those two big concerns there are certainly some questions diffs but for the most part it creates a easy to read and consistent style. Reviewed-by: Carlos O'Donell <carlos@redhat.com>