xref: /netbsd-src/external/gpl3/gdb/dist/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.c (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
1 /* Copyright 2016-2023 Free Software Foundation, Inc.
2 
3    This file is part of GDB.
4 
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9 
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17 
18 #include <stdint.h>
19 
20 /* Simulate an Ada variable declared inside package Pck as follow:
21       type FP1_Type is delta 0.1 range -1.0 .. +1.0;
22       FP1_Var : FP1_Type := 0.25;  */
23 int8_t pck__fp1_var = 4;
24 
25 /* Simulate an Ada variable declared inside package Pck as follow:
26       type FP1_Type is delta 0.1 range -1.0 .. +1.0;
27       FP1_Var2 : FP1_Type := 0.50;
28    Basically, the same as FP1_Var, but with a different value.  */
29 int8_t pck__fp1_var2 = 8;
30 
31 /* Simulate an Ada variable declared inside package Pck as follow:
32       type FP2_Type is delta 0.01 digits 14;
33       FP2_Var : FP2_Type := -0.01;  */
34 int32_t pck__fp2_var = -1;
35 
36 /* Simulate an Ada variable declared inside package Pck as follow:
37       type FP3_Type is delta 0.1 range 0.0 .. 1.0 with Small => 0.1/3.0;
38       FP3_Var : FP3_Type := 0.1;  */
39 int8_t pck__fp3_var = 3;
40 
41 /* Simulate an Ada variable declared inside package Pck as follow:
42       type FP1_Type is delta 0.1 range -1.0 .. +1.0;
43       FP1_Var : FP1_Type := 1.0;  */
44 int8_t pck__fp1_range_var = 16;
45 
46 int
47 main (void)
48 {
49   pck__fp1_var++;
50   pck__fp1_var2++;
51   pck__fp2_var++;
52   pck__fp3_var++;
53   pck__fp1_range_var++;
54 
55   return 0;
56 }
57