Home | History | Annotate | Line # | Download | only in tools
      1 #!/bin/sh
      2 
      3 # Check the mparam.h files. This script is useful as not all mparam.h
      4 # files may be tested by our tests.
      5 
      6 # Copyright 2011-2023 Free Software Foundation, Inc.
      7 # This script is free software; the Free Software Foundation
      8 # gives unlimited permission to copy and/or distribute it,
      9 # with or without modifications, as long as this notice is preserved.
     10 
     11 # This program is distributed in the hope that it will be useful,
     12 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
     13 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
     14 # PARTICULAR PURPOSE.
     15 
     16 # Note: This script must be run from a writable directory (an executable
     17 # check_mparam will be created in it). Moreover, the source tree that is
     18 # checked is the one that contains this script, not the one corresponding
     19 # to the current working directory (the rule for the other scripts in
     20 # the tools directory may be different).
     21 
     22 set -e
     23 
     24 dir=$(dirname "$0")
     25 files=$(cd "$dir/.." && find src/*/ -name mparam.h)
     26 err=0
     27 
     28 for i in $files
     29 do
     30   #output=`echo "#include \"$i\"" | gcc -o /dev/null -c -xc - 2>&1`
     31   #if [ -n "$output" ]; then
     32   #  printf "Error for file '%s':\n%s\n" "$i" "$output"
     33   #  err=1
     34   #fi
     35   rm -f check_mparam
     36   ${CC:-cc} "-DMPARAM=\"../$i\"" -o check_mparam "$dir"/check_mparam.c
     37   ./check_mparam
     38 done
     39 
     40 rm -f check_mparam
     41 
     42 exit $err
     43