Module Name: src
Committed By: wiz
Date: Fri Aug 23 09:06:37 UTC 2024
Modified Files:
src/distrib/sets/lists/base: mi
src/share/misc: Makefile
Added Files:
src/share/misc: dot.clang-format
Log Message:
Add basic clang-format configuration file for NetBSD sources.
To generate a diff of this commit:
cvs rdiff -u -r1.1348 -r1.1349 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.40 -r1.41 src/share/misc/Makefile
cvs rdiff -u -r0 -r1.1 src/share/misc/dot.clang-format
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1348 src/distrib/sets/lists/base/mi:1.1349
--- src/distrib/sets/lists/base/mi:1.1348 Sun Aug 18 04:02:58 2024
+++ src/distrib/sets/lists/base/mi Fri Aug 23 09:06:37 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1348 2024/08/18 04:02:58 rin Exp $
+# $NetBSD: mi,v 1.1349 2024/08/23 09:06:37 wiz Exp $
#
# Note: Don't delete entries from here - mark them as "obsolete" instead,
# unless otherwise stated below.
@@ -5057,6 +5057,7 @@
./usr/share/misc/acronyms.comp base-reference-share share
./usr/share/misc/ascii base-reference-share share
./usr/share/misc/bsd-family-tree base-reference-share share
+./usr/share/misc/dot.clang-format base-reference-share share
./usr/share/misc/getopt base-obsolete obsolete
./usr/share/misc/magic base-obsolete obsolete
./usr/share/misc/magic.mgc base-magic-share share
Index: src/share/misc/Makefile
diff -u src/share/misc/Makefile:1.40 src/share/misc/Makefile:1.41
--- src/share/misc/Makefile:1.40 Sun Apr 30 22:32:51 2023
+++ src/share/misc/Makefile Fri Aug 23 09:06:37 2024
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.40 2023/04/30 22:32:51 nikita Exp $
+# $NetBSD: Makefile,v 1.41 2024/08/23 09:06:37 wiz Exp $
# @(#)Makefile 8.1 (Berkeley) 6/8/93
FILES= NetBSD.el acronyms acronyms-o acronyms.comp airport ascii \
birthtoken bsd-family-tree \
- country domains operator \
+ country domains dot.clang-format operator \
eqnchar flowers indent.pro inter.phone language man.template \
mdoc.template na.phone na.postal style zipcodes
FILESDIR=${BINDIR}/misc
Added files:
Index: src/share/misc/dot.clang-format
diff -u /dev/null src/share/misc/dot.clang-format:1.1
--- /dev/null Fri Aug 23 09:06:37 2024
+++ src/share/misc/dot.clang-format Fri Aug 23 09:06:37 2024
@@ -0,0 +1,45 @@
+# $NetBSD: dot.clang-format,v 1.1 2024/08/23 09:06:37 wiz Exp $
+#
+# This is a base for using clang-format with NetBSD sources.
+#
+# /usr/share/misc/style has more details, some of which cannot be
+# captured here.
+#
+# To use it, rename it to .clang-format and put it in the directory
+# you're editing, or call clang-format with the --style argument:
+#
+# clang-format --style=file:/usr/share/misc/dot.clang-format [...] file.c
+#
+# 80 characters line length
+ColumnLimit: 80
+# if comments get too long, fmt them.
+ReflowComments: true
+# default indentation level
+IndentWidth: 8
+# also for struct initializers
+BracedInitializerIndentWidth: 8
+# prefer using tabs to spaces when indenting
+UseTab: ForContinuationAndIndentation
+# indent 1 space more per #if-level
+PPIndentWidth: 1
+# and put the space after the hash but before the keyword (i.e., "# if")
+IndentPPDirectives: AfterHash
+# backslashes at end-of-line are aligned, but as far left as possible
+AlignEscapedNewlines: Left
+# not supported in clang-format 18, would include the last line (without backslash) in the offset consideration
+#AlignEscapedNewlines: LeftWithLastLine
+#
+# if function arguments get too long, start new line indented by 4
+AlignAfterOpenBracket: DontAlign
+ContinuationIndentWidth: 4
+# but keep first parameters on the first line
+AllowAllParametersOfDeclarationOnNextLine: False
+AllowAllArgumentsOnNextLine: false
+# for struct's etc. use 8 characters indent as well
+ConstructorInitializerIndentWidth: 8
+# attach "{", except for functions
+BreakBeforeBraces: WebKit
+# for functions, add newline after return type
+AlwaysBreakAfterReturnType: TopLevelDefinitions
+# align structure elements to the right
+AlignArrayOfStructures: Right