Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygmagic « cygwin « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5589b26f6749472b226bb09dfd96565f60b11c2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh
file_magic=$1; shift
gcc=$1; shift
file=$1; shift
trap "rm -f /tmp/$$.magic" 0 1 2 15
cat <<EOF > $file_magic
/* autogenerated - do not edit */
#include "$file"
EOF
while [ -n "$1" ]; do
    define=$1; shift
    struct=$1; shift
    sum=`$gcc -E $file | sed -n "/^$struct/,/^};/p" | sed -e 's/[ 	]//g' -e '/^$/d' | sum | awk '{printf "0x%x", $1}'`
    echo "#define $define $sum"
    curr=`sed -n "s/^#[ 	]*define CURR_$define[ 	][ 	]*\([^ 	][^ 	]*\)/\1/p" $file`
    [ "$curr" == "$sum" ] || echo "*** WARNING WARNING WARNING WARNING WARNING ***
*** $file: magic number for $define changed old $curr != new $sum
*** WARNING WARNING WARNING WARNING WARNING ***" 1>&2
done >> $file_magic
exit 0