forked from dashpay/dash
-
Notifications
You must be signed in to change notification settings - Fork 714
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Copyright (c) 2018-2021 The Bitcoin Core developers | ||
# Copyright (c) 2024 The PIVX Core developers | ||
# Distributed under the MIT software license, see the accompanying | ||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
# | ||
# Check include guards. | ||
|
||
export LC_ALL=C | ||
HEADER_ID_PREFIX="PIVX_" | ||
HEADER_ID_SUFFIX="_H" | ||
|
||
REGEXP_EXCLUDE_FILES_WITH_PREFIX="src/(chiabls/|crypto/ctaes/|crypto/sph_*|ctpl_stl.h|immer/|leveldb/|crc32c/|cxxtimer.h|secp256k1/|tinyformat.h|univalue/)" | ||
|
||
EXIT_CODE=0 | ||
for HEADER_FILE in $(git ls-files -- "*.h" | grep -vE "^${REGEXP_EXCLUDE_FILES_WITH_PREFIX}") | ||
do | ||
HEADER_ID_BASE=$(cut -f2- -d/ <<< "${HEADER_FILE}" | sed "s/\.h$//g" | tr / _ | tr - _ | tr "[:lower:]" "[:upper:]") | ||
HEADER_ID="${HEADER_ID_PREFIX}${HEADER_ID_BASE}${HEADER_ID_SUFFIX}" | ||
if [[ $(grep --count --extended-regexp "^#(ifndef|define|endif //) ${HEADER_ID}" "${HEADER_FILE}") != 3 ]]; then | ||
echo "${HEADER_FILE} seems to be missing the expected include guard:" | ||
echo " #ifndef ${HEADER_ID}" | ||
echo " #define ${HEADER_ID}" | ||
echo " ..." | ||
echo " #endif // ${HEADER_ID}" | ||
echo | ||
EXIT_CODE=1 | ||
fi | ||
done | ||
exit ${EXIT_CODE} |