2014-10-10 09:05:12 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2017-04-20 12:14:40 +02:00
|
|
|
# Copyright 2017 Kaspar Schleiser <kaspar@schleiser.de>
|
2015-09-27 18:58:30 +02:00
|
|
|
# Copyright 2014 Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
|
2014-11-28 18:03:07 +01:00
|
|
|
# Copyright 2014 DangNhat Pham-Huu <51002279@hcmut.edu.vn>
|
|
|
|
#
|
|
|
|
# This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
# General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
# directory for more details.
|
|
|
|
|
2018-06-05 17:06:11 +02:00
|
|
|
: "${RIOTBASE:=$(cd $(dirname $0)/../../../; pwd)}"
|
|
|
|
cd $RIOTBASE
|
|
|
|
|
|
|
|
: "${RIOTTOOLS:=${RIOTBASE}/dist/tools}"
|
2018-03-22 17:21:09 +01:00
|
|
|
. "${RIOTTOOLS}"/ci/changed_files.sh
|
2014-10-10 09:05:12 +02:00
|
|
|
|
|
|
|
# prepare
|
|
|
|
ROOT=$(git rev-parse --show-toplevel)
|
|
|
|
EXIT_CODE=0
|
|
|
|
|
2017-04-20 12:14:40 +02:00
|
|
|
FILES=$(FILEREGEX='\.h$' changed_files)
|
2014-11-25 15:42:39 +01:00
|
|
|
|
2014-10-10 09:05:12 +02:00
|
|
|
# check files
|
|
|
|
for FILE in ${FILES}; do
|
2014-11-25 15:42:39 +01:00
|
|
|
if cat "${ROOT}/${FILE}" \
|
2014-10-10 09:05:12 +02:00
|
|
|
| sed -e 's/$/ /' \
|
|
|
|
| tr -d '\r\n' \
|
|
|
|
| sed -e 's/ */ /g' \
|
2016-12-27 08:53:09 +01:00
|
|
|
| grep -v -q '#ifdef __cplusplus extern "C" {'; \
|
2014-10-10 09:05:12 +02:00
|
|
|
then
|
|
|
|
EXIT_CODE=1
|
|
|
|
echo "file does not have a C++ compatible header: '${FILE}'"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
exit ${EXIT_CODE}
|