From 33b0cff2f32691dbb4d6279cf9afbb087c74d4d0 Mon Sep 17 00:00:00 2001 From: Scott Kostyshak Date: Fri, 3 May 2013 01:41:43 -0400 Subject: [PATCH] header_check.sh: allow exclusion of common headers Continuing to address #6305 --- development/tools/header_check.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/development/tools/header_check.sh b/development/tools/header_check.sh index f80fa72612..88fec324b9 100644 --- a/development/tools/header_check.sh +++ b/development/tools/header_check.sh @@ -28,6 +28,10 @@ LOG_FILE="$(basename $0).log" # For all headers: # PATTERN='^#include' +# Exclude common headers with regex +# (e.g. 'debug.h' will exclude 'support/debug.h') +EXCLUDE='\(debug.h\|cstdio\)' + function BUILD_FN () { # This is not a clean make. @@ -48,10 +52,12 @@ do grep "${PATTERN}" "${FILE_}" | \ while read INCLUDE do - cp "${FILE_COPY}" "${FILE_}" \ - || { echo "ERROR: restore copy failed" >&2; exit 1; } - sed -i "s@${INCLUDE}@@" "${FILE_}" - ( BUILD_FN ) &>/dev/null && echo "${FILE_}::${INCLUDE}" >> "${LOG_FILE}" + if echo "${INCLUDE}" | grep -q -v "${EXCLUDE}"; then + cp "${FILE_COPY}" "${FILE_}" \ + || { echo "ERROR: restore copy failed" >&2; exit 1; } + sed -i "s@${INCLUDE}@@" "${FILE_}" + ( BUILD_FN ) &>/dev/null && echo "${FILE_}::${INCLUDE}" >> "${LOG_FILE}" + fi done cp "${FILE_COPY}" "${FILE_}" done -- 2.39.2