update for final rounds, clang-format related values
The use of `cindent(1)` and `indent(1)` by the IOCCC Judges
during final round processing has been deprecated in favor
of the `clang-format(1)` tool.
Removed rules in `1337.mk` related to `cindent(1)` and `indent(1)`.
Added `make clang-format` rule to `1337.mk`.
Added `${CLANG_FORMAT}` Makefile variable to `var.mk`.
Created `.clang-format` to hold the IOCCC style, a style that
is somewhat similar to the Linux Kernel style.
This commit is contained in:
1 parent
f0f464dee2
commit
76357fc5db
3 files changed
+97
-33
No files matched your search
@@ -0,0 +1,80 @@
|
|||||||
|
|
||||||
|
######################
|
||||||
|
# clang-format options
|
||||||
|
######################
|
||||||
|
|
||||||
|
# ####
|
||||||
|
# NOTE: The IOCCC style is somewhat similar to the Linux Kernel style
|
||||||
|
#
|
||||||
|
# See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
|
||||||
|
#
|
||||||
|
# NOTE: Linux Kernel style differences will be noted in comments below, with
|
||||||
|
# the Kernel style setting noted in a "Kernel style uses:" comment.
|
||||||
|
# ####
|
||||||
|
|
||||||
|
# A style complying with the LLVM coding standards
|
||||||
|
#
|
||||||
|
# See: https://llvm.org/docs/CodingStandards.html#include-style
|
||||||
|
#
|
||||||
|
BasedOnStyle: LLVM
|
||||||
|
|
||||||
|
# Never put short ifs on the same line
|
||||||
|
#
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
|
||||||
|
# Use the same indentation level as for the switch statement
|
||||||
|
#
|
||||||
|
IndentCaseLabels: false
|
||||||
|
|
||||||
|
# Always attach braces to surrounding context
|
||||||
|
#
|
||||||
|
BreakBeforeBraces: Linux
|
||||||
|
|
||||||
|
# The number of columns to use for indentation
|
||||||
|
#
|
||||||
|
# Kernel style uses: IndentWidth: 8
|
||||||
|
#
|
||||||
|
IndentWidth: 4
|
||||||
|
|
||||||
|
# Never use tab to indent
|
||||||
|
#
|
||||||
|
# Kernel style uses: UseTab: Always
|
||||||
|
#
|
||||||
|
UseTab: Never
|
||||||
|
|
||||||
|
# Align escaped newlines as far left as possible, using the last line of the
|
||||||
|
# preprocessor directive as the reference if it’s the longest.
|
||||||
|
#
|
||||||
|
# Kernel style uses: AlignEscapedNewlines: Right
|
||||||
|
#
|
||||||
|
AlignEscapedNewlines: LeftWithLastLine
|
||||||
|
|
||||||
|
# The column limit
|
||||||
|
#
|
||||||
|
# Kernel style uses: ColumnLimit: 80
|
||||||
|
#
|
||||||
|
ColumnLimit: 131
|
||||||
|
|
||||||
|
# The number of columns to use for indentation of preprocessor statements
|
||||||
|
#
|
||||||
|
# NOTE: When set to -1 (default) IndentWidth is used also for preprocessor statements.
|
||||||
|
#
|
||||||
|
# Kernel style uses: PPIndentWidth: -1
|
||||||
|
#
|
||||||
|
PPIndentWidth: 2
|
||||||
|
|
||||||
|
# Indents directives after the hash
|
||||||
|
#
|
||||||
|
# Kernel style uses: IndentPPDirectives: None
|
||||||
|
#
|
||||||
|
IndentPPDirectives: AfterHash
|
||||||
|
|
||||||
|
# Insert braces after control statements (if, else, for, do, and while) in
|
||||||
|
#
|
||||||
|
# Kernel style uses: InsertBraces: false
|
||||||
|
#
|
||||||
|
# WARNING: Setting this option to true could lead to incorrect code formatting due to clang-format’s
|
||||||
|
# lack of complete semantic information. As such, extra care should be taken to review code
|
||||||
|
# changes made by this option!
|
||||||
|
#
|
||||||
|
InsertBraces: true
|
||||||
@@ -3,44 +3,27 @@
|
|||||||
# extended utility rules
|
# extended utility rules
|
||||||
########################
|
########################
|
||||||
|
|
||||||
.PHONY: indent_clean indent_clobber install
|
|
||||||
|
|
||||||
# you may be able to misunderstand the source by reading indent.c
|
|
||||||
#
|
|
||||||
indent.c: ${PROG}.c
|
|
||||||
@if which "${GINDENT}" >/dev/null 2>&1; then \
|
|
||||||
echo ${RM} -f $@; \
|
|
||||||
${RM} -f $@; \
|
|
||||||
echo "${GINDENT} < $< > $@"; \
|
|
||||||
${GINDENT} < $< > $@; \
|
|
||||||
elif which "${INDENT}" >/dev/null 2>&1; then \
|
|
||||||
echo ${RM} -f $@; \
|
|
||||||
${RM} -f $@; \
|
|
||||||
echo "${INDENT} < $< > $@"; \
|
|
||||||
${INDENT} < $< > $@; \
|
|
||||||
else \
|
|
||||||
echo "no indent tool found, ident $< yourself, sorry"; \
|
|
||||||
echo "exit 17"; \
|
|
||||||
exit 17; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
indent_clean: clean
|
|
||||||
@-if [ -f indent.c ]; then \
|
|
||||||
echo ${RM} -f indent.c; \
|
|
||||||
${RM} -f indent.c; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
indent_clobber: indent_clean clobber
|
|
||||||
@-if [ -e sandwich ]; then \
|
|
||||||
${RM} -f sandwich; \
|
|
||||||
echo 'ate sandwich'; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
@echo "Dr. Spock says that is not logical!"
|
@echo "Dr. Spock says that is not logical!"
|
||||||
@${TRUE}
|
@${TRUE}
|
||||||
|
|
||||||
|
|
||||||
|
######################
|
||||||
|
# clang-format options
|
||||||
|
######################
|
||||||
|
|
||||||
|
.PHONY: clang-format
|
||||||
|
|
||||||
|
# NOTE: The IOCCC Judges set CLANG_FORMAT_STYLE according to the ".clang-format" file.
|
||||||
|
#
|
||||||
|
# https://github.com/ioccc-src/winner/blob/master/.clang-format
|
||||||
|
#
|
||||||
|
# NOTE: Please don't add "// clang-format off" to your code: that is both annoying, and is easily disabled.
|
||||||
|
#
|
||||||
|
clang-format: ${PROG}.c
|
||||||
|
${CLANG_FORMAT} -style=file ${PROG}.c
|
||||||
|
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
# make a difference #
|
# make a difference #
|
||||||
#####################
|
#####################
|
||||||
|
|||||||
Reference in new issue
Block a user