/src/elfutils/libdw/dwarf_default_lower_bound.c
Line | Count | Source |
1 | | /* Get the default subrange lower bound for a given language. |
2 | | Copyright (C) 2016 Red Hat, Inc. |
3 | | This file is part of elfutils. |
4 | | |
5 | | This file is free software; you can redistribute it and/or modify |
6 | | it under the terms of either |
7 | | |
8 | | * the GNU Lesser General Public License as published by the Free |
9 | | Software Foundation; either version 3 of the License, or (at |
10 | | your option) any later version |
11 | | |
12 | | or |
13 | | |
14 | | * the GNU General Public License as published by the Free |
15 | | Software Foundation; either version 2 of the License, or (at |
16 | | your option) any later version |
17 | | |
18 | | or both in parallel, as here. |
19 | | |
20 | | elfutils is distributed in the hope that it will be useful, but |
21 | | WITHOUT ANY WARRANTY; without even the implied warranty of |
22 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
23 | | General Public License for more details. |
24 | | |
25 | | You should have received copies of the GNU General Public License and |
26 | | the GNU Lesser General Public License along with this program. If |
27 | | not, see <http://www.gnu.org/licenses/>. */ |
28 | | |
29 | | #ifdef HAVE_CONFIG_H |
30 | | # include <config.h> |
31 | | #endif |
32 | | |
33 | | #include <dwarf.h> |
34 | | #include "libdwP.h" |
35 | | |
36 | | /* Determine default lower bound from language, as per the DWARF5 |
37 | | "Subrange Type Entries" table. */ |
38 | | int |
39 | | dwarf_default_lower_bound (int lang, Dwarf_Sword *result) |
40 | 0 | { |
41 | 0 | switch (lang) |
42 | 0 | { |
43 | 0 | case DW_LANG_C: |
44 | 0 | case DW_LANG_C89: |
45 | 0 | case DW_LANG_C99: |
46 | 0 | case DW_LANG_C11: |
47 | 0 | case DW_LANG_C_plus_plus: |
48 | 0 | case DW_LANG_C_plus_plus_03: |
49 | 0 | case DW_LANG_C_plus_plus_11: |
50 | 0 | case DW_LANG_C_plus_plus_14: |
51 | 0 | case DW_LANG_ObjC: |
52 | 0 | case DW_LANG_ObjC_plus_plus: |
53 | 0 | case DW_LANG_Java: |
54 | 0 | case DW_LANG_D: |
55 | 0 | case DW_LANG_Python: |
56 | 0 | case DW_LANG_UPC: |
57 | 0 | case DW_LANG_OpenCL: |
58 | 0 | case DW_LANG_Go: |
59 | 0 | case DW_LANG_Haskell: |
60 | 0 | case DW_LANG_OCaml: |
61 | 0 | case DW_LANG_Rust: |
62 | 0 | case DW_LANG_Swift: |
63 | 0 | case DW_LANG_Dylan: |
64 | 0 | case DW_LANG_RenderScript: |
65 | 0 | case DW_LANG_BLISS: |
66 | 0 | *result = 0; |
67 | 0 | return 0; |
68 | | |
69 | 0 | case DW_LANG_Ada83: |
70 | 0 | case DW_LANG_Ada95: |
71 | 0 | case DW_LANG_Cobol74: |
72 | 0 | case DW_LANG_Cobol85: |
73 | 0 | case DW_LANG_Fortran77: |
74 | 0 | case DW_LANG_Fortran90: |
75 | 0 | case DW_LANG_Fortran95: |
76 | 0 | case DW_LANG_Fortran03: |
77 | 0 | case DW_LANG_Fortran08: |
78 | 0 | case DW_LANG_Pascal83: |
79 | 0 | case DW_LANG_Modula2: |
80 | 0 | case DW_LANG_Modula3: |
81 | 0 | case DW_LANG_PLI: |
82 | 0 | case DW_LANG_Julia: |
83 | 0 | *result = 1; |
84 | 0 | return 0; |
85 | | |
86 | 0 | default: |
87 | 0 | __libdw_seterrno (DWARF_E_UNKNOWN_LANGUAGE); |
88 | 0 | return -1; |
89 | 0 | } |
90 | 0 | } |
91 | | INTDEF (dwarf_default_lower_bound) |