summaryrefslogtreecommitdiff
path: root/scripts/gen-s-parser.py
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2019-04-26 14:42:40 -0700
committerGitHub <noreply@github.com>2019-04-26 14:42:40 -0700
commit87636dccd404a340d75acb1d96301581343f29ca (patch)
treef56ec2ea8e166e5d02018cf7adc1c960dbeba55d /scripts/gen-s-parser.py
parent34dd4c7893056e13cc9174db988d03e438a6af3d (diff)
downloadbinaryen-87636dccd404a340d75acb1d96301581343f29ca.tar.gz
binaryen-87636dccd404a340d75acb1d96301581343f29ca.tar.bz2
binaryen-87636dccd404a340d75acb1d96301581343f29ca.zip
Add clang-format-diff hook (#2057)
This adds a commit hook to Travis CI that errors out if incoming PRs' diffs are not clang-formatted. Turns out clang-format is also capable of formatting JavaScript, but we haven't agreed on a style for JS yet, this PR disables JavaScript formatting for now. This also adds clang-format exempt header/footer to a generated source file.
Diffstat (limited to 'scripts/gen-s-parser.py')
-rwxr-xr-xscripts/gen-s-parser.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/gen-s-parser.py b/scripts/gen-s-parser.py
index 04f10c471..262c0aeaf 100755
--- a/scripts/gen-s-parser.py
+++ b/scripts/gen-s-parser.py
@@ -533,6 +533,11 @@ def instruction_parser():
def print_header():
print("// DO NOT EDIT! This file generated by scripts/gen-s-parser.py\n")
+ print("// clang-format off\n")
+
+
+def print_footer():
+ print("\n// clang-format on")
def generate_with_guard(generator, guard):
@@ -549,6 +554,7 @@ def main():
sys.exit(1)
print_header()
generate_with_guard(instruction_parser, "INSTRUCTION_PARSER")
+ print_footer()
if __name__ == "__main__":