PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

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