Skip to content
Snippets Groups Projects
Commit a42b7759 authored by Brad King's avatar Brad King
Browse files

clang-format.bash: update to clang-format-18

The `.clang-format` configuration needs no changes to make the
version 18 format close to what version 15 produced before.
parent 4a126278
No related branches found
No related tags found
1 merge request!319Revise C++ coding style using clang-format-18 with "east const"
--- ---
# This configuration requires clang-format version 15 exactly. # This configuration requires clang-format version 18 exactly.
BasedOnStyle: Mozilla BasedOnStyle: Mozilla
AlignOperands: false AlignOperands: false
AllowShortFunctionsOnASingleLine: InlineOnly AllowShortFunctionsOnASingleLine: InlineOnly
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
.hooks* export-ignore .hooks* export-ignore
# Custom attribute to mark sources as using the kwsys C code style. # 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 /GitSetup export-ignore
/*.sh export-ignore eol=lf /*.sh export-ignore eol=lf
......
...@@ -27,7 +27,7 @@ copies of KWSys within dependent projects can be updated to get the changes. ...@@ -27,7 +27,7 @@ copies of KWSys within dependent projects can be updated to get the changes.
Code Style 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 the KWSys source tree. See the `.clang-format`_ configuration file for
our style settings. Use the `clang-format.bash`_ script to format source our style settings. Use the `clang-format.bash`_ script to format source
code. It automatically runs ``clang-format`` on the set of source files code. It automatically runs ``clang-format`` on the set of source files
......
#!/usr/bin/env bash #!/usr/bin/env bash
#============================================================================= #=============================================================================
# Copyright 2015-2017 Kitware, Inc. # Copyright 2015-2025 Kitware, Inc.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
...@@ -78,7 +78,7 @@ test "$#" = 0 || die "$usage" ...@@ -78,7 +78,7 @@ test "$#" = 0 || die "$usage"
# Find a default tool. # Find a default tool.
tools=' tools='
clang-format-15 clang-format-18
clang-format clang-format
' '
if test "x$clang_format" = "x"; then if test "x$clang_format" = "x"; then
...@@ -96,8 +96,8 @@ if ! type -p "$clang_format" >/dev/null; then ...@@ -96,8 +96,8 @@ if ! type -p "$clang_format" >/dev/null; then
exit 1 exit 1
fi fi
if ! "$clang_format" --version | grep 'clang-format version 15' >/dev/null 2>/dev/null; then if ! "$clang_format" --version | grep 'clang-format version 18' >/dev/null 2>/dev/null; then
echo "clang-format version 15 is required (exactly)" echo "clang-format version 18 is required (exactly)"
exit 1 exit 1
fi fi
...@@ -117,7 +117,7 @@ list_files() { ...@@ -117,7 +117,7 @@ list_files() {
# Select sources with our attribute. # Select sources with our attribute.
git check-attr --stdin format.clang-format | 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@. # Transform configured sources to protect @SYMBOLS@.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment