blob: 0e7bab3eb0d11b808301187258e7d12b7ee2050f [file] [log] [blame]
Mark Rutland8d325882018-09-04 11:48:29 +01001#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3#
4# Check if atomic headers are up-to-date
5
6ATOMICDIR=$(dirname $0)
7ATOMICTBL=${ATOMICDIR}/atomics.tbl
8LINUXDIR=${ATOMICDIR}/../..
9
Mark Rutland0cf264b2019-02-11 13:20:35 +000010echo '' | sha1sum - > /dev/null 2>&1
11if [ $? -ne 0 ]; then
12 printf "sha1sum not available, skipping atomic header checks.\n"
13 exit 0
14fi
15
Mark Rutland8d325882018-09-04 11:48:29 +010016cat <<EOF |
Mark Rutlande3d18ce2021-07-13 11:52:51 +010017linux/atomic/atomic-instrumented.h
18linux/atomic/atomic-long.h
19linux/atomic/atomic-arch-fallback.h
Mark Rutland8d325882018-09-04 11:48:29 +010020EOF
Mark Rutland0cf264b2019-02-11 13:20:35 +000021while read header; do
22 OLDSUM="$(tail -n 1 ${LINUXDIR}/include/${header})"
23 OLDSUM="${OLDSUM#// }"
24
Michael Forneyebf8d822019-06-17 22:33:06 -070025 NEWSUM="$(sed '$d' ${LINUXDIR}/include/${header} | sha1sum)"
Mark Rutland0cf264b2019-02-11 13:20:35 +000026 NEWSUM="${NEWSUM%% *}"
27
28 if [ "${OLDSUM}" != "${NEWSUM}" ]; then
29 printf "warning: generated include/${header} has been modified.\n"
Mark Rutland8d325882018-09-04 11:48:29 +010030 fi
31done
Mark Rutland0cf264b2019-02-11 13:20:35 +000032
33exit 0