fix_headers.sh (907B)
1 #!/bin/bash 2 # Copyright (c) the JPEG XL Project Authors. All rights reserved. 3 # 4 # Use of this source code is governed by a BSD-style 5 # license that can be found in the LICENSE file. 6 7 # Helper script to fix includes. Requires clang-tidy 18+. 8 # Might need jxl_{threads_}_exports.h copied to includes/jxl 9 # Also might require: 10 # `export CPLUS_INCLUDE_PATH=/usr/lib/llvm-16/lib/clang/16/include/` 11 12 SRC=$1 13 HERE=`pwd` 14 CLANG_TIDY_CONFIG="{\ 15 Checks: '-*,misc-include-cleaner,readability-avoid-const-params-in-decls,misc-unused-using-decls,readability-container-size-empty',\ 16 CheckOptions: {\ 17 'misc-include-cleaner.IgnoreHeaders': 'gtest/.*;gmock/.*;testing.h'\ 18 }\ 19 }" 20 21 `which clang-tidy` \ 22 -config="${CLANG_TIDY_CONFIG}" \ 23 -p build \ 24 -format-style=file \ 25 -fix-errors \ 26 --extra-arg=-I${HERE}/lib/include \ 27 $SRC 28 sed -i -r 's/#include "jxl\/(.+)"/#include <jxl\/\1>/g' $SRC 29 clang-format -i $SRC