From 9fdcbd982e16d296f62bc676db84caeb51477b85 Mon Sep 17 00:00:00 2001 From: Bart <11445373+bthomee@users.noreply.github.com> Date: Tue, 3 Feb 2026 14:58:55 -0500 Subject: [PATCH] Add checking script --- .github/scripts/rename/include.sh | 27 +++++++++++++++++++++ .github/workflows/reusable-check-rename.yml | 2 ++ src/test/protocol/Issue_test.cpp | 8 ------ 3 files changed, 29 insertions(+), 8 deletions(-) create mode 100755 .github/scripts/rename/include.sh diff --git a/.github/scripts/rename/include.sh b/.github/scripts/rename/include.sh new file mode 100755 index 0000000000..58c0e27b7c --- /dev/null +++ b/.github/scripts/rename/include.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Exit the script as soon as an error occurs. +set -e + +# This script checks whether there are no new include guards introduced by a new +# PR, as header files should use "#pragma once" instead. The script assumes any +# include guards will use "XRPL_" as prefix. +# Usage: .github/scripts/rename/pragma.sh + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +DIRECTORY=$1 +echo "Processing directory: ${DIRECTORY}" +if [ ! -d "${DIRECTORY}" ]; then + echo "Error: Directory '${DIRECTORY}' does not exist." + exit 1 +fi + +find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" \) | while read -r FILE; do + echo "Processing file: ${FILE}" + grep '#ifndef XRPL_' "${FILE}" && echo "Please replace all include guards by #pragma once." && exit 1 +done +echo "Checking complete." diff --git a/.github/workflows/reusable-check-rename.yml b/.github/workflows/reusable-check-rename.yml index af55084405..a73ac49b7d 100644 --- a/.github/workflows/reusable-check-rename.yml +++ b/.github/workflows/reusable-check-rename.yml @@ -31,6 +31,8 @@ jobs: run: .github/scripts/rename/namespace.sh . - name: Check config name run: .github/scripts/rename/config.sh . + - name: Check include guards + run: .github/scripts/rename/include.sh . - name: Check for differences env: MESSAGE: | diff --git a/src/test/protocol/Issue_test.cpp b/src/test/protocol/Issue_test.cpp index 661a8c912b..2321da4a6e 100644 --- a/src/test/protocol/Issue_test.cpp +++ b/src/test/protocol/Issue_test.cpp @@ -17,14 +17,6 @@ #define STL_SET_HAS_EMPLACE 0 #endif -#ifndef XRPL_ASSETS_ENABLE_STD_HASH -#if BEAST_MAC || BEAST_IOS -#define XRPL_ASSETS_ENABLE_STD_HASH 0 -#else -#define XRPL_ASSETS_ENABLE_STD_HASH 1 -#endif -#endif - namespace xrpl { class Issue_test : public beast::unit_test::suite