diff --git a/.clang-format b/.clang-format index 5beee0b633bf1dce7bfdc2da8e73cf4f5b4d0f24..1dfc93149900b575183d38e7728713ba55945ec2 100644 --- a/.clang-format +++ b/.clang-format @@ -1,5 +1,5 @@ --- -# This configuration requires clang-format version 15 exactly. +# This configuration requires clang-format version 18 exactly. BasedOnStyle: Mozilla AlignOperands: false AllowShortFunctionsOnASingleLine: InlineOnly diff --git a/.gitattributes b/.gitattributes index 1ae02445f182779c67d65a0032d089682b6e47aa..82a11df4b4a95ce8434f4a331383e741e419fe6e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,7 +4,7 @@ .hooks* export-ignore # Custom attribute to mark sources as using the kwsys C code style. -[attr]kwsys-c-style whitespace=tab-in-indent format.clang-format=15 +[attr]kwsys-c-style whitespace=tab-in-indent format.clang-format=18 /GitSetup export-ignore /*.sh export-ignore eol=lf diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index d62afa5751f8277bb87519fd89a5697806eba6a5..e9c58a3802a34b8d48e51e8cf616ff2c9365af0c 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -27,7 +27,7 @@ copies of KWSys within dependent projects can be updated to get the changes. Code Style ========== -We use `clang-format`_ version **15** to define our style for C++ code in +We use `clang-format`_ version **18** to define our style for C++ code in the KWSys source tree. See the `.clang-format`_ configuration file for our style settings. Use the `clang-format.bash`_ script to format source code. It automatically runs ``clang-format`` on the set of source files diff --git a/clang-format.bash b/clang-format.bash index 2561a895483e6f9dc7fb3ea8db304c09a335b035..167371f290d2e4e673ec1be2f37e6872fd4f282c 100755 --- a/clang-format.bash +++ b/clang-format.bash @@ -1,6 +1,6 @@ #!/usr/bin/env bash #============================================================================= -# Copyright 2015-2017 Kitware, Inc. +# Copyright 2015-2025 Kitware, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -78,7 +78,7 @@ test "$#" = 0 || die "$usage" # Find a default tool. tools=' - clang-format-15 + clang-format-18 clang-format ' if test "x$clang_format" = "x"; then @@ -96,8 +96,8 @@ if ! type -p "$clang_format" >/dev/null; then exit 1 fi -if ! "$clang_format" --version | grep 'clang-format version 15' >/dev/null 2>/dev/null; then - echo "clang-format version 15 is required (exactly)" +if ! "$clang_format" --version | grep 'clang-format version 18' >/dev/null 2>/dev/null; then + echo "clang-format version 18 is required (exactly)" exit 1 fi @@ -117,7 +117,7 @@ list_files() { # Select sources with our attribute. git check-attr --stdin format.clang-format | - sed -n '/: format\.clang-format: \(set\|15\)$/ {s/:[^:]*:[^:]*$//p}' + sed -n '/: format\.clang-format: \(set\|18\)$/ {s/:[^:]*:[^:]*$//p}' } # Transform configured sources to protect @SYMBOLS@.