1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00
RIOT/cpu/sam0_common/include/vendor/fix_headers.sh

30 lines
1.1 KiB
Bash
Raw Normal View History

#!/bin/sh
# This function removes type qualifiers from anonymous padding fields in bit
# fields for compatibility with clang++.
strip_type_qualifiers_from_bit_fields() {
echo "Searching for header files with bogus type qualifiers"
offenders="$(grep -Erl '__I [u]*int[0-9]*_t[ \t]*:[0-9]*;')"
for file in $offenders; do
echo "Sanitizing $file for type qualifiers in padding"
sed -i "$file" -e 's/__I \([u]*int[0-9]*_t[\t ]*:[0-9]*;\)/\1 /g'
done
}
# This functions removes a bogus `LITTLE_ENDIAN` define which conflicts with
# <endian.h> and tinyDTLS notion of it. Luckily, that define is not used
# anywhere in the vendor header files, so we can just drop it.
remove_bogus_endian_define() {
echo "Searching for header files with bogus LITTLE_ENDIAN define"
offenders="$(grep -rl '^#define LITTLE_ENDIAN')"
for file in $offenders; do
echo "Removing bogus LITTLE_ENDIAN define from $file"
sed -i "$file" -e '/^#define LITTLE_ENDIAN/d'
done
}
strip_type_qualifiers_from_bit_fields
remove_bogus_endian_define