check-header-lists.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/sh
  2. # Check the set of headers with conformtest expectations for a given standard.
  3. # Copyright (C) 2014-2019 Free Software Foundation, Inc.
  4. # This file is part of the GNU C Library.
  5. # The GNU C Library is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU Lesser General Public
  7. # License as published by the Free Software Foundation; either
  8. # version 2.1 of the License, or (at your option) any later version.
  9. # The GNU C Library is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. # Lesser General Public License for more details.
  13. # You should have received a copy of the GNU Lesser General Public
  14. # License along with the GNU C Library; if not, see
  15. # <http://www.gnu.org/licenses/>.
  16. set -e
  17. std=$1
  18. CC=$2
  19. expected_list=$3
  20. all_data_files=$4
  21. new_list=
  22. for f in $all_data_files; do
  23. h=${f#data/}
  24. h=${h%-data}
  25. exp=$($CC -D$std -x c -E $f | sed -e '/^#/d' -e '/^[ ]*$/d')
  26. if [ "$exp" ]; then
  27. new_list="$new_list $h"
  28. fi
  29. done
  30. echo "Headers with expectations for $std: $new_list"
  31. echo "Expected list: $expected_list"
  32. rc=0
  33. for h in $expected_list; do
  34. case " $new_list " in
  35. (*" $h "*)
  36. ;;
  37. (*)
  38. echo "Missing expectations for $h."
  39. rc=1
  40. ;;
  41. esac
  42. done
  43. for h in $new_list; do
  44. case " $expected_list " in
  45. (*" $h "*)
  46. ;;
  47. (*)
  48. echo "Spurious expectations for $h."
  49. rc=1
  50. ;;
  51. esac
  52. done
  53. exit $rc