From 5bd86b50b58ffcad48416df6fa6b411e92c4636e Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 10 Jan 2020 08:32:56 -0500 Subject: codetool: post-processor for clang-format This code transformer makes a couple of changes that we want for our source code, and can be expanded to handle more. --- scripts/maint/codetool.py | 174 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100755 scripts/maint/codetool.py (limited to 'scripts/maint') diff --git a/scripts/maint/codetool.py b/scripts/maint/codetool.py new file mode 100755 index 0000000000..6336e6843b --- /dev/null +++ b/scripts/maint/codetool.py @@ -0,0 +1,174 @@ +#!/usr/bin/env python3 +# Copyright (c) 2020, The Tor Project, Inc. +# See LICENSE for licensing information. + +""" + This program uses a set of plugable filters to inspect and transform + our C code. +""" + +import os +import re +import sys + +class Filter: + """A Filter transforms a string containing a C program.""" + def __init__(self): + pass + + def transform(self, s): + return s + +class CompoundFilt(Filter): + """A CompoundFilt runs another set of filters, in sequence.""" + def __init__(self, items=()): + super().__init__() + self._filters = list(items) + + def add(self, filt): + self._filters.append(filt) + return self + + def transform(self, s): + for f in self._filters: + s = f.transform(s) + + return s + +class SplitError(Exception): + """Exception: raised if split_comments() can't understand a C file.""" + pass + +def split_comments(s): + r"""Iterate over the C code in 's', and yield a sequence of (code, + comment) pairs. Each pair will contain either a nonempty piece + of code, a nonempty comment, or both. + + >>> list(split_comments("hello // world\n")) + [('hello ', '// world'), ('\n', '')] + + >>> list(split_comments("a /* b cd */ efg // hi")) + [('a ', '/* b cd */'), (' efg ', '// hi')] + """ + + # Matches a block of code without any comments. + PAT_CODE = re.compile(r'''^(?: [^/"']+ | + "(?:[^\\"]+|\\.)*" | + '(?:[^\\']+|\\.)*' | + /[^/*] + )*''', re.VERBOSE|re.DOTALL) + + # Matches a C99 "//" comment. + PAT_C99_COMMENT = re.compile(r'^//.*$', re.MULTILINE) + + # Matches a C "/* */" comment. + PAT_C_COMMENT = re.compile(r'^/\*(?:[^*]|\*+[^*/])*\*+/', re.DOTALL) + + while True: + # Find some non-comment code at the start of the string. + m = PAT_CODE.match(s) + + # If we found some code here, save it and advance the string. + # Otherwise set 'code' to "". + if m: + code = m.group(0) + s = s[m.end():] + else: + code = "" + + # Now we have a comment, or the end of the string. Find out which + # one, and how long it is. + if s.startswith("//"): + m = PAT_C99_COMMENT.match(s) + else: + m = PAT_C_COMMENT.match(s) + + # If we got a comment, save it and advance the string. Otherwise + # set 'comment' to "". + if m: + comment = m.group(0) + s = s[m.end():] + else: + comment = "" + + # If we found no code and no comment, we should be at the end of + # the string... + if code == "" and comment == "": + if s: + # But in case we *aren't* at the end of the string, raise + # an error. + raise SplitError() + # ... all is well, we're done scanning the code. + return + + yield (code, comment) + +class IgnoreCommentsFilt(Filter): + """Wrapper: applies another filter to C code only, excluding comments. + """ + def __init__(self, filt): + super().__init__() + self._filt = filt + + def transform(self, s): + result = [] + for code, comment in split_comments(s): + result.append(self._filt.transform(code)) + result.append(comment) + return "".join(result) + + +class RegexFilt(Filter): + """A regex filter applies a regular expression to some C code.""" + def __init__(self, pat, replacement, flags=0): + super().__init__() + self._pat = re.compile(pat, flags) + self._replacement = replacement + + def transform(self, s): + s, _ = self._pat.subn(self._replacement, s) + return s + +def revise(fname, filt): + """Run 'filt' on the contents of the file in 'fname'. If any + changes are made, then replace the file with its new contents. + Otherwise, leave the file alone. + """ + contents = open(fname, 'r').read() + result = filt.transform(contents) + if result == contents: + return + + tmpname = "{}_codetool_tmp".format(fname) + try: + with open(tmpname, 'w') as f: + f.write(result) + os.rename(tmpname, fname) + except: + os.unlink(tmpname) + raise + +############################## +# Filtering rules. +############################## + +# Make sure that there is a newline after the first comma in a MOCK_IMPL() +BREAK_MOCK_IMPL = RegexFilt( + r'^MOCK_IMPL\(([^,]+),\s*(\S+)', + r'MOCK_IMPL(\1,\n\2', + re.MULTILINE) + +# Make sure there is no newline between } and a loop iteration terminator. +RESTORE_SMARTLIST_END = RegexFilt( + r'}\s*(SMARTLIST|DIGESTMAP|DIGEST256MAP|STRMAP|MAP)_FOREACH_END\s*\(', + r'} \1_FOREACH_END (', + re.MULTILINE) + +F = CompoundFilt() +F.add(IgnoreCommentsFilt(CompoundFilt([ + RESTORE_SMARTLIST_END, + BREAK_MOCK_IMPL]))) + +if __name__ == '__main__': + for fname in sys.argv[1:]: + revise(fname, F) -- cgit v1.2.3-54-g00ecf From 573ab70bfe4c6239a3fffda89b1a95e4e7ca10aa Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 16 Dec 2019 10:58:32 -0500 Subject: Temporary clang-format configuration and script. The format is the same as in my previous efforts here. The script is a little tricky, since it invokes both clang-format and codetool, and it makes sure that files do not have a changed mtime unless there is actually some change in the file. --- .clang-format | 166 ++++++++++++++++++++++++++++++++++++++++++ scripts/maint/clang-format.sh | 34 +++++++++ 2 files changed, 200 insertions(+) create mode 100644 .clang-format create mode 100755 scripts/maint/clang-format.sh (limited to 'scripts/maint') diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000..31b76a0025 --- /dev/null +++ b/.clang-format @@ -0,0 +1,166 @@ +--- +Language: Cpp +# Out of all supported styles, LLVM seems closest to our own. +BasedOnStyle: LLVM + +################ +# +# Deviations from LLVM's style. +# +################ + +# We prefer an indentation width of 4 columns; LLVM likes 2. +## OVERRIDE FOR COMPARISON +IndentWidth: 2 + +## OVERRIDE FOR COMPARISON +## for now i'm not sorting includes, since that makes every file get touched. +SortIncludes: false + +# We prefer 79; llvm likes 80. +ColumnLimit: 79 + +# Where do we want to put backslashes on multiline macros? Our choices are +# "as far left as possible", "as far right as possible", and "make no changes." +# LLVM defaults to right, but we don't dig that. +AlignEscapedNewlines: Left + +# When we see a bunch of things in a row with comments after them, should we +# try to align those comments? Doing so makes some of our code pretty ugly. +AlignTrailingComments: false + +# We use a function declaration style much closer to BSD KNF than to LLVM's. +# We say: +# int foo(int x); +# int +# foo(int x) +# { +# ... +# } +# whereas llvm prefers: +# int foo(int x); +# int foo(int x) { +# ... +# } +# or even: +# int foo(int x) { ... } +# +BreakBeforeBraces: Custom +BraceWrapping: + AfterFunction: true +AllowShortFunctionsOnASingleLine: None +AlwaysBreakAfterReturnType: AllDefinitions + +# We don't like blocks to start with an empty line. +# +KeepEmptyLinesAtTheStartOfBlocks: false + +################ +# +# Tor-specific magic +# +################ + +# +# These comments are magical, and should not be changed. +# +CommentPragmas: 'LCOV_EXCL|COVERITY' + +# +# Remove duplicate empty lines. +# +MaxEmptyLinesToKeep: 1 + +# +# Indent preprocessor directives, for clarity. +# +IndentPPDirectives: AfterHash + +# +# These introduce an iteration, and work a bit like a for loop. +# +# Note that we can NOT include ones that don't work like "for". For example, +# if the body is an argument to the macro, we can't list it here. +# +ForEachMacros: + - MAP_FOREACH + - MAP_FOREACH_MODIFY + - TOR_SIMPLEQ_FOREACH + - TOR_SIMPLEQ_FOREACH_SAFE + - TOR_SLIST_FOREACH + - TOR_SLIST_FOREACH_SAFE + - TOR_LIST_FOREACH + - TOR_LIST_FOREACH_SAFE + - TOR_TAILQ_FOREACH + - TOR_TAILQ_FOREACH_SAFE + - TOR_TAILQ_FOREACH_REVERSE + - TOR_TAILQ_FOREACH_REVERSE_SAFE + - TOR_CIRCLEQ_FOREACH + - TOR_CIRCLEQ_FOREACH_SAFE + - TOR_CIRCLEQ_FOREACH_REVERSE + - TOR_CIRCLEQ_FOREACH_REVERSE_SAFE + - HT_FOREACH + - SMARTLIST_FOREACH_BEGIN + - DIGESTMAP_FOREACH + - DIGESTMAP_FOREACH_MODIFY + - DIGEST256MAP_FOREACH + - DIGEST256MAP_FOREACH_MODIFY + - SDMAP_FOREACH + - RIMAP_FOREACH + - EIMAP_FOREACH + +# +# Omitting: +# +# - SMARTLIST_FOREACH, since the body of the loop is an argument. + +# +# This explains how to sort our headers. +# +# This is more complex than it truly should be, but I've edited this till +# compilation still mostly passes. +# +# I'm disabling this, however, since it's a distraction from the other +# formatting issues. See SortIncludes above. +# +IncludeCategories: + - Regex: '^"orconfig.h' + Priority: -30 + - Regex: '^"ext/' + Priority: -18 + - Regex: '^"lib/' + Priority: -10 + - Regex: '^"core/or/or.h' + Priority: -5 + - Regex: '^"core/' + Priority: 5 + - Regex: '^"feature/' + Priority: 10 + - Regex: '^"app/' + Priority: 20 + +# +# These macros should always cause indentation, as though they were { and }. +# +# Do NOT put macros here unless you want an extra level of indentation between +# them whenever they appear. +# +MacroBlockBegin: "^STMT_BEGIN|TT_STMT_BEGIN$" +MacroBlockEnd: "^STMT_END|TT_STMT_END$" + +# +# These macros don't need to have semicolons afterwards. +# +StatementMacros: + - HT_PROTOTYPE + - HT_GENERATE + - HT_GENERATE2 + +# +# These macros are interpreted as types. +# (Not supported in my clang-format) +# +# TypenameMacros: +# - "STACK_OF" + +... diff --git a/scripts/maint/clang-format.sh b/scripts/maint/clang-format.sh new file mode 100755 index 0000000000..86430b9b26 --- /dev/null +++ b/scripts/maint/clang-format.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# Copyright 2020, The Tor Project, Inc. +# See LICENSE for licensing information. + +# This script runs "clang-format" and "codetool" in sequence over each of +# our source files, and replaces the original file only if it has changed. +# +# We can't just use clang-format -i, since we also want to use codetool to +# reformat a few things back to how we want them, and we want avoid changing +# the mtime on files that didn't actually change. + +set -e + +cd "$(dirname "$0")/../../src/" + +# Shellcheck complains that a for loop over find's output is unreliable, +# since there might be special characters in the output. But we happen +# to know that none of our C files have special characters or spaces in +# their names, so this is safe. +# +# shellcheck disable=SC2044 +for fname in $(find lib core feature app test tools -name '[^.]*.[ch]'); do + tmpfname="${fname}.clang_fmt.tmp" + rm -f "${tmpfname}" + clang-format --style=file "${fname}" > "${tmpfname}" + ../scripts/maint/codetool.py "${tmpfname}" + if cmp "${fname}" "${tmpfname}" >/dev/null 2>&1; then + echo "No change in ${fname}" + rm -f "${tmpfname}" + else + echo "Change in ${fname}" + mv "${tmpfname}" "${fname}" + fi +done -- cgit v1.2.3-54-g00ecf From f1d371bf32d33cee95df1b13daa43686f81d94ef Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 17 Dec 2019 13:58:01 -0500 Subject: checkSpace: remove the nosplabel test. --- scripts/maint/checkSpace.pl | 6 +++--- scripts/maint/checkspace_tests/expected.txt | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'scripts/maint') diff --git a/scripts/maint/checkSpace.pl b/scripts/maint/checkSpace.pl index f4e6f733c8..96a256968a 100755 --- a/scripts/maint/checkSpace.pl +++ b/scripts/maint/checkSpace.pl @@ -58,9 +58,9 @@ for my $fn (@ARGV) { } ## Warn about labels that don't have a space in front of them # (We indent every label at least one space) - if (/^[a-zA-Z_][a-zA-Z_0-9]*:/) { - msg "nosplabel:$fn:$.\n"; - } + #if (/^[a-zA-Z_][a-zA-Z_0-9]*:/) { + # msg "nosplabel:$fn:$.\n"; + #} ## Warn about trailing whitespace. # (We don't allow whitespace at the end of the line; make your # editor highlight it for you so you can stop adding it in.) diff --git a/scripts/maint/checkspace_tests/expected.txt b/scripts/maint/checkspace_tests/expected.txt index 935b750ef9..38595ed373 100644 --- a/scripts/maint/checkspace_tests/expected.txt +++ b/scripts/maint/checkspace_tests/expected.txt @@ -5,7 +5,6 @@ tp fn():./dubious.c:15 Wide:./dubious.c:17 TAB:./dubious.c:24 - nosplabel:./dubious.c:26 CR:./dubious.c:30 Space@EOL:./dubious.c:32 non-K&R {:./dubious.c:39 -- cgit v1.2.3-54-g00ecf From 15819cde6163e43ac86d1be078a7b6b4e3ed7a02 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 9 Jan 2020 16:21:17 -0500 Subject: checkSpace.pl: allow {{, ){, and ({. --- scripts/maint/checkSpace.pl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'scripts/maint') diff --git a/scripts/maint/checkSpace.pl b/scripts/maint/checkSpace.pl index 96a256968a..af81db8d53 100755 --- a/scripts/maint/checkSpace.pl +++ b/scripts/maint/checkSpace.pl @@ -156,9 +156,8 @@ for my $fn (@ARGV) { # msg "//:$fn:$.\n"; s!//.*!!; } - ## Warn about unquoted braces preceded by non-space. - # (No character except a space should come before a {) - if (/([^\s'])\{/) { + ## Warn about unquoted braces preceded by unexpected character. + if (/([^\s'\)\(\{])\{/) { msg "$1\{:$fn:$.\n"; } ## Warn about double semi-colons at the end of a line. -- cgit v1.2.3-54-g00ecf From 1f1d943999bd0ade5153074bb90ee9a40440825f Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 10 Jan 2020 08:04:28 -0500 Subject: checkspace: allow spaces in cpp directives. --- scripts/maint/checkSpace.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts/maint') diff --git a/scripts/maint/checkSpace.pl b/scripts/maint/checkSpace.pl index af81db8d53..3080fafd3e 100755 --- a/scripts/maint/checkSpace.pl +++ b/scripts/maint/checkSpace.pl @@ -128,12 +128,12 @@ for my $fn (@ARGV) { if ($isheader) { if ($seenguard == 0) { - if (/ifndef\s+(\S+)/) { + if (/^\s*\#\s*ifndef\s+(\S+)/) { ++$seenguard; $guardname = $1; } } elsif ($seenguard == 1) { - if (/^\#define (\S+)/) { + if (/^\s*\#\s*define (\S+)/) { ++$seenguard; if ($1 ne $guardname) { msg "GUARD:$fn:$.: Header guard macro mismatch.\n"; -- cgit v1.2.3-54-g00ecf From bfa760738521715f8c858de7584fd08cd90cb538 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 10 Jan 2020 08:31:35 -0500 Subject: checkSpace.pl: Use a data structure for a list of non-function names --- scripts/maint/checkSpace.pl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'scripts/maint') diff --git a/scripts/maint/checkSpace.pl b/scripts/maint/checkSpace.pl index 3080fafd3e..cc77d8d5be 100755 --- a/scripts/maint/checkSpace.pl +++ b/scripts/maint/checkSpace.pl @@ -23,6 +23,12 @@ if ($ARGV[0] =~ /^-/) { $C = ($lang eq '-C'); } +# hashmap of things where we allow spaces between them and (. +our %allow_space_after= map {$_, 1} qw{ + if while for switch return int unsigned elsif WINAPI + void __attribute__ op size_t double uint64_t workqueue_reply_t bool +}; + our %basenames = (); our %guardnames = (); @@ -177,12 +183,7 @@ for my $fn (@ARGV) { # (Don't put a space between the name of a function and its # arguments.) if (/(\w+)\s\(([A-Z]*)/) { - if ($1 ne "if" and $1 ne "while" and $1 ne "for" and - $1 ne "switch" and $1 ne "return" and $1 ne "int" and - $1 ne "elsif" and $1 ne "WINAPI" and $2 ne "WINAPI" and - $1 ne "void" and $1 ne "__attribute__" and $1 ne "op" and - $1 ne "size_t" and $1 ne "double" and $1 ne "uint64_t" and - $1 ne "workqueue_reply_t" and $1 ne "bool") { + if (! $allow_space_after{$1} && $2 ne 'WINAPI') { msg "fn ():$fn:$.\n"; } } -- cgit v1.2.3-54-g00ecf From 8d6f27cea58627e08e7872c785456235122e060b Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 10 Jan 2020 08:32:15 -0500 Subject: checkSpace.pl: Allow space between iteration macros and (). Clang-format wants to put these in, and they do make sense for consistency. Also allow more types. --- scripts/maint/checkSpace.pl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'scripts/maint') diff --git a/scripts/maint/checkSpace.pl b/scripts/maint/checkSpace.pl index cc77d8d5be..a5480d5ba4 100755 --- a/scripts/maint/checkSpace.pl +++ b/scripts/maint/checkSpace.pl @@ -26,7 +26,20 @@ if ($ARGV[0] =~ /^-/) { # hashmap of things where we allow spaces between them and (. our %allow_space_after= map {$_, 1} qw{ if while for switch return int unsigned elsif WINAPI - void __attribute__ op size_t double uint64_t workqueue_reply_t bool + void __attribute__ op size_t double uint64_t + bool ssize_t + workqueue_reply_t hs_desc_decode_status_t + PRStatus + SMARTLIST_FOREACH_BEGIN SMARTLIST_FOREACH_END + HT_FOREACH + DIGESTMAP_FOREACH_MODIFY DIGESTMAP_FOREACH + DIGEST256MAP_FOREACH_MODIFY DIGEST256MAP_FOREACH + STRMAP_FOREACH_MODIFY STRMAP_FOREACH + SDMAP_FOREACH EIMAP_FOREACH RIMAP_FOREACH + MAP_FOREACH_MODIFY MAP_FOREACH + TOR_SIMPLEQ_FOREACH TOR_SIMPLEQ_FOREACH_SAFE + TOR_LIST_FOREACH TOR_LIST_FOREACH_SAFE + TOR_SLIST_FOREACH TOR_SLIST_FOREACH_SAFE }; our %basenames = (); -- cgit v1.2.3-54-g00ecf From c8fae6b5c8c76089da37c169defbc63a53300a3f Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 10 Jan 2020 09:25:04 -0500 Subject: checkSpace: don't treat an unindented label as starting a function. --- scripts/maint/checkSpace.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/maint') diff --git a/scripts/maint/checkSpace.pl b/scripts/maint/checkSpace.pl index a5480d5ba4..bf1c69e00a 100755 --- a/scripts/maint/checkSpace.pl +++ b/scripts/maint/checkSpace.pl @@ -207,7 +207,7 @@ for my $fn (@ARGV) { if ($in_func_head || ($fn !~ /\.h$/ && /^[a-zA-Z0-9_]/ && ! /^(?:const |static )*(?:typedef|struct|union)[^\(]*$/ && - ! /= *\{$/ && ! /;$/)) { + ! /= *\{$/ && ! /;$/) && ! /^[a-zA-Z0-9_]+\s*:/) { if (/.\{$/){ msg "fn() {:$fn:$.\n"; $in_func_head = 0; -- cgit v1.2.3-54-g00ecf From f39ba52029c946304cc5a67fa93ca9aab10b2941 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 10 Jan 2020 15:32:34 -0500 Subject: checkSpace: be more careful about bad function headers. Previously we would forbid macro indentations like this: FOO({ int x; }) But clang-format sometimes generates those. --- scripts/maint/checkSpace.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/maint') diff --git a/scripts/maint/checkSpace.pl b/scripts/maint/checkSpace.pl index bf1c69e00a..27615f910c 100755 --- a/scripts/maint/checkSpace.pl +++ b/scripts/maint/checkSpace.pl @@ -208,7 +208,7 @@ for my $fn (@ARGV) { ($fn !~ /\.h$/ && /^[a-zA-Z0-9_]/ && ! /^(?:const |static )*(?:typedef|struct|union)[^\(]*$/ && ! /= *\{$/ && ! /;$/) && ! /^[a-zA-Z0-9_]+\s*:/) { - if (/.\{$/){ + if (/[^,\s]\s*\{$/){ msg "fn() {:$fn:$.\n"; $in_func_head = 0; } elsif (/^\S[^\(]* +\**[a-zA-Z0-9_]+\(/) { -- cgit v1.2.3-54-g00ecf From 5fa62fffee1972093798ed356884ef331dcd4ecc Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 6 Feb 2020 16:24:36 -0500 Subject: checkSpace: permit wide lines for LCOV_EXCL We're telling clang-format that a line with LCOV_EXCL must not be split -- that's fine, but we shouldn't complain when it indents it. --- scripts/maint/checkSpace.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/maint') diff --git a/scripts/maint/checkSpace.pl b/scripts/maint/checkSpace.pl index 27615f910c..857ce6f6f1 100755 --- a/scripts/maint/checkSpace.pl +++ b/scripts/maint/checkSpace.pl @@ -130,7 +130,7 @@ for my $fn (@ARGV) { ## Terminals are still 80 columns wide in my world. I refuse to ## accept double-line lines. # (Don't make lines wider than 80 characters, including newline.) - if (/^.{80}/) { + if (/^.{80}/ and not /LCOV_EXCL/) { msg "Wide:$fn:$.\n"; } ### Juju to skip over comments and strings, since the tests -- cgit v1.2.3-54-g00ecf From b5ccdd978ea138cde92b3513c9d653ba18b8b463 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 12 Feb 2020 18:52:35 -0500 Subject: Add a dire warning about not reformatting the whole codebase yet. --- .clang-format | 5 +++++ scripts/maint/clang-format.sh | 7 +++++++ scripts/maint/codetool.py | 8 ++++++++ 3 files changed, 20 insertions(+) (limited to 'scripts/maint') diff --git a/.clang-format b/.clang-format index e688ce7df5..7be73e0612 100644 --- a/.clang-format +++ b/.clang-format @@ -1,3 +1,8 @@ +# DO NOT COMMIT OR MERGE CODE THAT IS RUN THROUGH THIS TOOL YET. +# +# WE ARE STILL DISCUSSING OUR DESIRED STYLE AND ITERATING ON IT. +# (12 Feb 2020) + --- Language: Cpp # Out of all supported styles, LLVM seems closest to our own. diff --git a/scripts/maint/clang-format.sh b/scripts/maint/clang-format.sh index 86430b9b26..59832117b4 100755 --- a/scripts/maint/clang-format.sh +++ b/scripts/maint/clang-format.sh @@ -2,6 +2,13 @@ # Copyright 2020, The Tor Project, Inc. # See LICENSE for licensing information. +# +# DO NOT COMMIT OR MERGE CODE THAT IS RUN THROUGH THIS TOOL YET. +# +# WE ARE STILL DISCUSSING OUR DESIRED STYLE AND ITERATING ON IT. +# (12 Feb 2020) +# + # This script runs "clang-format" and "codetool" in sequence over each of # our source files, and replaces the original file only if it has changed. # diff --git a/scripts/maint/codetool.py b/scripts/maint/codetool.py index 6336e6843b..725712c0cc 100755 --- a/scripts/maint/codetool.py +++ b/scripts/maint/codetool.py @@ -2,6 +2,14 @@ # Copyright (c) 2020, The Tor Project, Inc. # See LICENSE for licensing information. +# +# DO NOT COMMIT OR MERGE CODE THAT IS RUN THROUGH THIS TOOL YET. +# +# WE ARE STILL DISCUSSING OUR DESIRED STYLE AND ITERATING ON IT, +# ALONG WITH THE TOOLS THAT ACHIEVE IT. +# (12 Feb 2020) +# + """ This program uses a set of plugable filters to inspect and transform our C code. -- cgit v1.2.3-54-g00ecf