Home | History | Annotate | Line # | Download | only in gdb.stabs
      1   1.1  christos /* This testcase is part of GDB, the GNU debugger.
      2   1.1  christos 
      3  1.11  christos    Copyright 2010-2024 Free Software Foundation, Inc.
      4   1.1  christos 
      5   1.1  christos    Contributed by Pierre Muller.
      6   1.1  christos 
      7   1.1  christos    This program is free software; you can redistribute it and/or modify
      8   1.1  christos    it under the terms of the GNU General Public License as published by
      9   1.1  christos    the Free Software Foundation; either version 3 of the License, or
     10   1.1  christos    (at your option) any later version.
     11   1.1  christos 
     12   1.1  christos    This program is distributed in the hope that it will be useful,
     13   1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     14   1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15   1.1  christos    GNU General Public License for more details.
     16   1.1  christos 
     17   1.1  christos    You should have received a copy of the GNU General Public License
     18   1.1  christos    along with this program.  If not, see <http://www.gnu.org/licenses/>.
     19   1.1  christos 
     20   1.1  christos    Qualifiers of forward types are not resolved correctly with stabs.  */
     21   1.1  christos 
     22   1.1  christos struct dummy;
     23   1.1  christos 
     24   1.1  christos enum dummy_enum;
     25   1.1  christos 
     26   1.1  christos /* This function prevents the compiler from dropping local variables
     27   1.1  christos    we need for the test.  */
     28   1.1  christos void *hack (const struct dummy *t, const enum dummy_enum *e);
     29   1.1  christos 
     30   1.1  christos const void *
     31   1.1  christos test (const struct dummy *t)
     32   1.1  christos {
     33   1.1  christos   const struct dummy *tt;
     34   1.1  christos   enum dummy_enum *e;
     35   1.1  christos   tt = t;
     36   1.1  christos   return hack (t, e);
     37   1.1  christos }
     38   1.1  christos 
     39   1.1  christos void *
     40   1.1  christos test2 (struct dummy *t)
     41   1.1  christos {
     42   1.1  christos   struct dummy *tt;
     43   1.1  christos   const enum dummy_enum *e;
     44   1.1  christos   tt = t;
     45   1.1  christos   return hack (t, e);
     46   1.1  christos }
     47   1.1  christos 
     48   1.1  christos 
     49   1.1  christos struct dummy {
     50   1.1  christos  int x;
     51   1.1  christos  int y;
     52   1.1  christos  double b;
     53   1.1  christos } tag_dummy;
     54   1.1  christos 
     55   1.1  christos enum dummy_enum {
     56   1.1  christos   enum1,
     57   1.1  christos   enum2
     58   1.3  christos } tag_dummy_enum;
     59   1.1  christos 
     60   1.1  christos void *
     61   1.1  christos hack (const struct dummy *t, const enum dummy_enum *e)
     62   1.1  christos {
     63   1.1  christos   return (void *) t;
     64   1.1  christos }
     65   1.1  christos 
     66   1.1  christos int
     67   1.1  christos main ()
     68   1.1  christos {
     69   1.1  christos   struct dummy tt;
     70   1.1  christos   tt.x = 5;
     71   1.1  christos   tt.y = 25;
     72   1.1  christos   tt.b = 2.5;
     73   1.1  christos   test2 (&tt);
     74   1.1  christos   test (&tt);
     75   1.1  christos   return 0;
     76   1.1  christos }
     77