blob: 8378c63a1e09f1550b8b471ffad20453e30da8c1 [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 Rutland0cf264b2019-02-11 13:20:35 +000017asm-generic/atomic-instrumented.h
18asm-generic/atomic-long.h
19linux/atomic-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