wrapper.exp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # Copyright (C) 2004, 2007 Free Software Foundation, Inc.
  2. # This program is free software; you can redistribute it and/or modify
  3. # it under the terms of the GNU General Public License as published by
  4. # the Free Software Foundation; either version 3 of the License, or
  5. # (at your option) any later version.
  6. #
  7. # This program is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. # GNU General Public License for more details.
  11. #
  12. # You should have received a copy of the GNU General Public License
  13. # along with GCC; see the file COPYING3. If not see
  14. # <http://www.gnu.org/licenses/>.
  15. # This file contains GCC-specifics for status wrappers for test programs.
  16. # ${tool}_maybe_build_wrapper -- Build wrapper object if the target
  17. # needs it. FILENAME is the path to the wrapper file. If there are
  18. # additional arguments, they are command-line options to provide to
  19. # the compiler when compiling FILENAME.
  20. proc ${tool}_maybe_build_wrapper { filename args } {
  21. global gluefile wrap_flags
  22. if { [target_info needs_status_wrapper] != "" \
  23. && [target_info needs_status_wrapper] != "0" \
  24. && ![info exists gluefile] } {
  25. set saved_wrap_compile_flags [target_info wrap_compile_flags]
  26. set flags [join $args " "]
  27. # The wrapper code may contain code that gcc objects on. This
  28. # became true for dejagnu-1.4.4. The set of warnings and code
  29. # that gcc objects on may change, so just make sure -w is always
  30. # passed to turn off all warnings.
  31. set_currtarget_info wrap_compile_flags \
  32. "$saved_wrap_compile_flags -w $flags"
  33. set result [build_wrapper $filename]
  34. set_currtarget_info wrap_compile_flags "$saved_wrap_compile_flags"
  35. if { $result != "" } {
  36. set gluefile [lindex $result 0]
  37. set wrap_flags [lindex $result 1]
  38. }
  39. }
  40. }