1. 08 Kas, 2017 2 kayıt (commit)
    • Stephan Bergmann's avatar
      Retrofit "KeepEmptyLinesAtTheStartOfBlocks: false" into .clang-format · b536e103
      Stephan Bergmann yazdı
      ...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: https://gerrit.libreoffice.org/44450Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
      Tested-by: 's avatarJenkins <ci@libreoffice.org>
      Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
      b536e103
    • Stephan Bergmann's avatar
      Suppress loplugin:unnecessaryoverride... · a6309a3c
      Stephan Bergmann yazdı
      ...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: https://gerrit.libreoffice.org/44418Tested-by: 's avatarJenkins <ci@libreoffice.org>
      Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
      a6309a3c
  2. 04 Kas, 2017 1 kayıt (commit)
  3. 03 Kas, 2017 1 kayıt (commit)
    • Miklos Vajna's avatar
      Enforce coding style with clang-format for new code · 98f5f4d3
      Miklos Vajna yazdı
      - The actual blacklist has to be generated with
        solenv/clang-format/generate-style-blacklist.sh in a separate commit.
      
      - .clang-format is from
        <https://lists.freedesktop.org/archives/libreoffice/2014-August/062802.html>,
        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: https://gerrit.libreoffice.org/43736Tested-by: 's avatarJenkins <ci@libreoffice.org>
      Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
      98f5f4d3