/test/language/assertion/test_dead_code01.e

http://github.com/tybor/Liberty · Specman e · 69 lines · 37 code · 5 blank · 27 comment · 2 complexity · b73daea49e5a3ba6243062ff14204d94 MD5 · raw file

  1. -- This file is part of SmartEiffel The GNU Eiffel Compiler Tools and Libraries.
  2. -- See the Copyright notice at the end of this file.
  3. --
  4. class TEST_DEAD_CODE01
  5. -- Bug report from Philippe Ribet
  6. -- Unused attribute has not to be in generated structure
  7. -- This code will always fail with debug on! (So never try to make it
  8. -- run with -debug ;-)
  9. create {}
  10. make
  11. feature {}
  12. make
  13. local
  14. addr1: POINTER; local_debug: STRING; addr2: POINTER; addr3: POINTER; aux: AUX_DEAD_CODE01
  15. exit_code: INTEGER
  16. do
  17. debug
  18. local_debug := "Local debug information"
  19. debug_info := "Debug attribute"
  20. end
  21. addr1 := get_address($addr1)
  22. addr2 := get_address($addr2)
  23. addr3 := get_address($addr3)
  24. create aux.make
  25. -- debug_info attribute is not in the structure of the object
  26. if object_size /= aux.object_size then
  27. std_error.put_string("Error in class ")
  28. std_error.put_string(generator)
  29. std_error.put_string(": debug_info attribute should not be included in the structure of the object.%N")
  30. exit_code := exit_code + 1
  31. end
  32. -- local_debug local variable is not declared
  33. if addr1.hash_code - addr2.hash_code /= addr2.hash_code - addr3.hash_code then
  34. std_error.put_string("Error in class ")
  35. std_error.put_string(generator)
  36. std_error.put_string(": local_debug local variable should not be declared in the generated C code.%N")
  37. exit_code := exit_code + 2
  38. end
  39. die_with_code(exit_code)
  40. end
  41. debug_info: STRING
  42. get_address (p: POINTER): POINTER
  43. do
  44. Result := p
  45. end
  46. end -- class TEST_DEAD_CODE01
  47. --
  48. -- ------------------------------------------------------------------------------------------------------------------------------
  49. -- Copyright notice below. Please read.
  50. --
  51. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  52. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  53. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  54. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  55. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  56. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  57. --
  58. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  59. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  60. --
  61. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  62. --
  63. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  64. -- ------------------------------------------------------------------------------------------------------------------------------