From b1e8807bc526b729817957136a7434ac572a951e Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Wed, 12 Aug 2020 13:49:49 +0200 Subject: [PATCH] Meta: Check that "#include " is not being used --- Meta/check-style.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Meta/check-style.sh b/Meta/check-style.sh index 55d5c7bf813aa9..c20553a85d6197 100755 --- a/Meta/check-style.sh +++ b/Meta/check-style.sh @@ -17,11 +17,18 @@ MISSING_PRAGMA_ONCE_ERRORS=() GOOD_PRAGMA_ONCE_PATTERN=$'(^|\\S\n\n)#pragma once(\n\n\\S.|$)' BAD_PRAGMA_ONCE_ERRORS=() +# We check that "#include " is not being used +LIBM_MATH_H_INCLUDE_PATTERN='#include ' +LIBM_MATH_H_INCLUDE_ERRORS=() + while IFS= read -r f; do file_content="$(< "$f")" if [[ ! "$file_content" =~ $LICENSE_HEADER_PATTERN ]]; then MISSING_LICENSE_HEADER_ERRORS+=("$f") fi + if [[ "$file_content" =~ $LIBM_MATH_H_INCLUDE_PATTERN ]]; then + LIBM_MATH_H_INCLUDE_ERRORS+=("$f") + fi if [[ "$f" =~ \.h$ ]]; then if [[ ! "$file_content" =~ $PRAGMA_ONCE_PATTERN ]]; then MISSING_PRAGMA_ONCE_ERRORS+=("$f") @@ -54,4 +61,8 @@ if (( ${#BAD_PRAGMA_ONCE_ERRORS[@]} )); then echo "\"#pragma once\" should have a blank line before and after in these files: ${BAD_PRAGMA_ONCE_ERRORS[*]}" exit_status=1 fi +if (( ${#LIBM_MATH_H_INCLUDE_ERRORS[@]} )); then + echo "\"#include \" should be replaced with just \"#include \" in these files: ${LIBM_MATH_H_INCLUDE_ERRORS[*]}" + exit_status=1 +fi exit "$exit_status"