path: root/.clang-format
AgeCommit message (Collapse)AuthorFilesLines
2019-11-14clang-format: don't fix up namespace commentsMiklos Vajna1-0/+1
Out clang-format-5.0.0 has this default, i.e. running solenv/clang-format/reformat-formatted-files after this change results in no changes. However, clang-format from git has that enabled by default for our config, so prepare for that unwanted change now. (5.0.0 gives no "unknown configuration key" errors for "FixNamespaceComments".) [ Still touch a formatted file to make sure CI tests the new config before it goes in. ] Change-Id: Ic4500e067cfb2dc10dc1f452598e8932771b31c9 Reviewed-on: Tested-by: Jenkins Reviewed-by: Miklos Vajna <>
2017-11-08Retrofit "KeepEmptyLinesAtTheStartOfBlocks: false" into .clang-formatStephan Bergmann1-0/+1
...even if that can cause reformatting of already formatted code. The problem I came across is that without this something like > namespace { > > void f1(); > > void f2(); > > } (which is quite a common style in the current code base) would be changed to > namespace > { > > void f1(); > > void f2(); > } instead of > namespace > { > void f1(); > > void f2(); > } and I found no other clang-format style option that would result in the presence or absence of an empty line be identical at the start and end of the namespace block. vmiklos asked to reformat the existing new (i.e., non-blacklisted) files at the same time, so this commit includes that. Some of those new files had not been formatted at all, so this commit includes their full reformatting changes. Change-Id: I54daf0c11098d07d02c802104cf7f56372e61f7c Reviewed-on: Reviewed-by: Thorsten Behrens <> Tested-by: Jenkins <> Reviewed-by: Stephan Bergmann <>
2017-11-08Suppress loplugin:unnecessaryoverride...Stephan Bergmann1-0/+1
...when a class derives from multiple (non-virtual) instances of one base class, and the override disambiguates which of those instances' member to call. That was the case with SwXTextDocument::queryAdapter (sw/source/uibase/uno/unotxdoc.cxx), where SwXTextDocument derives from cppu::OWeakObject through both SwXTextDocumentBaseClass and SfxBaseModel, but calling queryAdapter through a pointer to SwXTextDocumentBaseClass apparently needs to call OWeakObject::queryAdapter on the second, SfxBaseModel-inherited OWeakObject base instance, or else CppunitTest_sw_macros_test fails. Who knows what other instances of similar non-unnecessary overrides have been removed with the help of broken loplugin:unnecessaryoverride, for which there were no tests that started to fail... Turns out .clang-format lacked "ReflowComments: false" to not break the special "// expected-error {{...}}" etc. comments in compilerplugins/clang/test/. Also, use a better location to report loplugin:unnecessaryoverride, to keep clang-format and loplugin:unnecessaryoverride from fighting over how to split lines and where to put the comment in compilerplugins/clang/test/unnecessaryoverride.cxx. Change-Id: I3b24df24369db12f8ec1080d6c9f7b70ff561a16 Reviewed-on: Tested-by: Jenkins <> Reviewed-by: Stephan Bergmann <>
2017-11-04clang-format: Increase column limit to 100Samuel Mehrbrodt1-1/+1
As discussed in IRC. This matches the values in TEMPLATE.SOURCECODE.HEADER Change-Id: I7e7bf5df0b011a54c8dddde5366e73e14068ef7d Reviewed-on: Tested-by: Jenkins <> Reviewed-by: Miklos Vajna <>
2017-11-03Enforce coding style with clang-format for new codeMiklos Vajna1-0/+44
- The actual blacklist has to be generated with solenv/clang-format/ in a separate commit. - .clang-format is from <>, except: - the commented out lines are removed - Standard is Cpp11 instead of Cpp03 - explicitly avoid sorting includes (requested during ESC meeting 2017-10-11) - no indentation inside namespaces (lots of existing code in sc wants this) - The git hooks prints a diff when the style is violated, along with a command to fix up the violation automatically. It also enforces style only in new files and ignores all files listed in the blacklist. - To avoid introducing one more hard-to-setup build dependency for new developers, help them two ways: - if clang-format is not installed, provide pre-built binaries for Linux/Windows/macOS - download/install of these binaries are printed as cmdline instructions, similar to how we have our own 'make' on Windows - As per ESC call 2017-11-02, currently don't do any checks if clang-format is not installed (as a first step). Change-Id: Iaa139c396337e8734aa1853305d808438260c41a Reviewed-on: Tested-by: Jenkins <> Reviewed-by: Miklos Vajna <>