Skip to content

Commit

Permalink
Meta: Check that "#include <LibM/math.h>" is not being used
Browse files Browse the repository at this point in the history
  • Loading branch information
linusg authored and awesomekling committed Aug 12, 2020
1 parent 7072806 commit b1e8807
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Meta/check-style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <LibM/math.h>" is not being used
LIBM_MATH_H_INCLUDE_PATTERN='#include <LibM/math.h>'
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")
Expand Down Expand Up @@ -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 <LibM/math.h>\" should be replaced with just \"#include <math.h>\" in these files: ${LIBM_MATH_H_INCLUDE_ERRORS[*]}"
exit_status=1
fi
exit "$exit_status"

0 comments on commit b1e8807

Please sign in to comment.