]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.dwarf2/dw2-fixed-point.c
Add support for printing value of DWARF-based fixed-point type objects
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / dw2-fixed-point.c
1 /* Copyright 2016-2020 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 FP2_Type is delta 0.01 digits 14;
27 FP2_Var : FP2_Type := -0.01; */
28 int32_t pck__fp2_var = -1;
29
30 /* Simulate an Ada variable declared inside package Pck as follow:
31 type FP3_Type is delta 0.1 range 0.0 .. 1.0 with Small => 0.1/3.0;
32 FP3_Var : FP3_Type := 0.1; */
33 int8_t pck__fp3_var = 3;
34
35 /* Simulate an Ada variable declared inside package Pck as follow:
36 type FP1_Type is delta 0.1 range -1.0 .. +1.0;
37 FP1_Var : FP1_Type := 1.0; */
38 int8_t pck__fp1_range_var = 16;
39
40 int
41 main (void)
42 {
43 pck__fp1_var++;
44 pck__fp2_var++;
45 pck__fp3_var++;
46 pck__fp1_range_var++;
47
48 return 0;
49 }