Fix typo in chnagelog entry
[official-gcc.git] / gcc / fortran / iso-c-binding.def
blob99c7e0cacbae5c8c009bd84104985d96d403d5bc
1 /* Copyright (C) 2006, 2007, 2008, 2010, 2011, 2012
2 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 /* This file contains the definition of the types provided by the
21 Fortran 2003 ISO_C_BINDING intrinsic module. */
23 #ifndef NAMED_INTCST
24 # define NAMED_INTCST(a,b,c,d)
25 #endif
27 #ifndef NAMED_REALCST
28 # define NAMED_REALCST(a,b,c,d)
29 #endif
31 #ifndef NAMED_CMPXCST
32 # define NAMED_CMPXCST(a,b,c,d)
33 #endif
35 #ifndef NAMED_LOGCST
36 # define NAMED_LOGCST(a,b,c)
37 #endif
39 #ifndef NAMED_CHARKNDCST
40 # define NAMED_CHARKNDCST(a,b,c)
41 #endif
43 #ifndef NAMED_FUNCTION
44 # define NAMED_FUNCTION(a,b,c,d)
45 #endif
47 /* The arguments to NAMED_*CST are:
48 -- an internal name
49 -- the symbol name in the module, as seen by Fortran code
50 -- the value it has, for use in trans-types.c
51 -- the standard that supports this type */
53 NAMED_INTCST (ISOCBINDING_INT, "c_int", gfc_c_int_kind, GFC_STD_F2003)
54 NAMED_INTCST (ISOCBINDING_SHORT, "c_short", \
55 get_int_kind_from_node (short_integer_type_node), GFC_STD_F2003)
56 NAMED_INTCST (ISOCBINDING_LONG, "c_long", \
57 get_int_kind_from_node (long_integer_type_node), GFC_STD_F2003)
58 NAMED_INTCST (ISOCBINDING_LONG_LONG, "c_long_long", \
59 get_int_kind_from_node (long_long_integer_type_node), GFC_STD_F2003)
61 NAMED_INTCST (ISOCBINDING_INTMAX_T, "c_intmax_t", \
62 get_int_kind_from_name (INTMAX_TYPE), GFC_STD_F2003)
63 NAMED_INTCST (ISOCBINDING_INTPTR_T, "c_intptr_t", \
64 get_int_kind_from_name (INTPTR_TYPE), GFC_STD_F2003)
65 NAMED_INTCST (ISOCBINDING_PTRDIFF_T, "c_ptrdiff_t", \
66 get_int_kind_from_name (PTRDIFF_TYPE), GFC_STD_F2008_TS)
67 NAMED_INTCST (ISOCBINDING_SIZE_T, "c_size_t", \
68 gfc_index_integer_kind, GFC_STD_F2003)
69 NAMED_INTCST (ISOCBINDING_SIGNED_CHAR, "c_signed_char", \
70 get_int_kind_from_node (signed_char_type_node), GFC_STD_F2003)
72 NAMED_INTCST (ISOCBINDING_INT8_T, "c_int8_t", \
73 get_int_kind_from_name (INT8_TYPE), GFC_STD_F2003)
74 NAMED_INTCST (ISOCBINDING_INT16_T, "c_int16_t", \
75 get_int_kind_from_name (INT16_TYPE), GFC_STD_F2003)
76 NAMED_INTCST (ISOCBINDING_INT32_T, "c_int32_t", \
77 get_int_kind_from_name (INT32_TYPE), GFC_STD_F2003)
78 NAMED_INTCST (ISOCBINDING_INT64_T, "c_int64_t", \
79 get_int_kind_from_name (INT64_TYPE), GFC_STD_F2003)
80 /* GNU Extension. */
81 NAMED_INTCST (ISOCBINDING_INT128_T, "c_int128_t", \
82 get_int_kind_from_width (128), GFC_STD_GNU)
84 NAMED_INTCST (ISOCBINDING_INT_LEAST8_T, "c_int_least8_t", \
85 get_int_kind_from_name (INT_LEAST8_TYPE), GFC_STD_F2003)
86 NAMED_INTCST (ISOCBINDING_INT_LEAST16_T, "c_int_least16_t", \
87 get_int_kind_from_name (INT_LEAST16_TYPE), GFC_STD_F2003)
88 NAMED_INTCST (ISOCBINDING_INT_LEAST32_T, "c_int_least32_t", \
89 get_int_kind_from_name (INT_LEAST32_TYPE), GFC_STD_F2003)
90 NAMED_INTCST (ISOCBINDING_INT_LEAST64_T, "c_int_least64_t", \
91 get_int_kind_from_name (INT_LEAST64_TYPE), GFC_STD_F2003)
92 /* GNU Extension. */
93 NAMED_INTCST (ISOCBINDING_INT_LEAST128_T, "c_int_least128_t", \
94 get_int_kind_from_minimal_width (128), GFC_STD_GNU)
96 NAMED_INTCST (ISOCBINDING_INT_FAST8_T, "c_int_fast8_t", \
97 get_int_kind_from_name (INT_FAST8_TYPE), GFC_STD_F2003)
98 NAMED_INTCST (ISOCBINDING_INT_FAST16_T, "c_int_fast16_t", \
99 get_int_kind_from_name (INT_FAST16_TYPE), GFC_STD_F2003)
100 NAMED_INTCST (ISOCBINDING_INT_FAST32_T, "c_int_fast32_t", \
101 get_int_kind_from_name (INT_FAST32_TYPE), GFC_STD_F2003)
102 NAMED_INTCST (ISOCBINDING_INT_FAST64_T, "c_int_fast64_t", \
103 get_int_kind_from_name (INT_FAST64_TYPE), GFC_STD_F2003)
104 /* GNU Extension. */
105 NAMED_INTCST (ISOCBINDING_INT_FAST128_T, "c_int_fast128_t",
106 get_int_kind_from_width (128), GFC_STD_GNU)
108 NAMED_REALCST (ISOCBINDING_FLOAT, "c_float", \
109 get_real_kind_from_node (float_type_node), GFC_STD_F2003)
110 NAMED_REALCST (ISOCBINDING_DOUBLE, "c_double", \
111 get_real_kind_from_node (double_type_node), GFC_STD_F2003)
112 NAMED_REALCST (ISOCBINDING_LONG_DOUBLE, "c_long_double", \
113 get_real_kind_from_node (long_double_type_node), GFC_STD_F2003)
114 NAMED_REALCST (ISOCBINDING_FLOAT128, "c_float128", \
115 float128_type_node == NULL_TREE \
116 ? -4 : get_real_kind_from_node (float128_type_node), \
117 GFC_STD_GNU)
118 NAMED_CMPXCST (ISOCBINDING_FLOAT_COMPLEX, "c_float_complex", \
119 get_real_kind_from_node (float_type_node), GFC_STD_F2003)
120 NAMED_CMPXCST (ISOCBINDING_DOUBLE_COMPLEX, "c_double_complex", \
121 get_real_kind_from_node (double_type_node), GFC_STD_F2003)
122 NAMED_CMPXCST (ISOCBINDING_LONG_DOUBLE_COMPLEX, "c_long_double_complex", \
123 get_real_kind_from_node (long_double_type_node), GFC_STD_F2003)
124 NAMED_CMPXCST (ISOCBINDING_FLOAT128_COMPLEX, "c_float128_complex", \
125 float128_type_node == NULL_TREE \
126 ? -4 : get_real_kind_from_node (float128_type_node), \
127 GFC_STD_GNU)
129 NAMED_LOGCST (ISOCBINDING_BOOL, "c_bool", \
130 get_int_kind_from_width (BOOL_TYPE_SIZE))
132 NAMED_CHARKNDCST (ISOCBINDING_CHAR, "c_char", gfc_default_character_kind)
134 #ifndef NAMED_CHARCST
135 # define NAMED_CHARCST(a,b,c)
136 #endif
138 /* Use langhooks to deal with host to target translations. */
139 NAMED_CHARCST (ISOCBINDING_NULL_CHAR, "c_null_char", \
140 lang_hooks.to_target_charset ('\0'))
141 NAMED_CHARCST (ISOCBINDING_ALERT, "c_alert", \
142 lang_hooks.to_target_charset ('\a'))
143 NAMED_CHARCST (ISOCBINDING_BACKSPACE, "c_backspace", \
144 lang_hooks.to_target_charset ('\b'))
145 NAMED_CHARCST (ISOCBINDING_FORM_FEED, "c_form_feed", \
146 lang_hooks.to_target_charset ('\f'))
147 NAMED_CHARCST (ISOCBINDING_NEW_LINE, "c_new_line", \
148 lang_hooks.to_target_charset ('\n'))
149 NAMED_CHARCST (ISOCBINDING_CARRIAGE_RETURN, "c_carriage_return", \
150 lang_hooks.to_target_charset ('\r'))
151 NAMED_CHARCST (ISOCBINDING_HORIZONTAL_TAB, "c_horizontal_tab", \
152 lang_hooks.to_target_charset ('\t'))
153 NAMED_CHARCST (ISOCBINDING_VERTICAL_TAB, "c_vertical_tab", \
154 lang_hooks.to_target_charset ('\v'))
156 #ifndef DERIVED_TYPE
157 # define DERIVED_TYPE(a,b,c)
158 #endif
160 DERIVED_TYPE (ISOCBINDING_PTR, "c_ptr", \
161 get_int_kind_from_node (ptr_type_node))
162 DERIVED_TYPE (ISOCBINDING_NULL_PTR, "c_null_ptr", \
163 get_int_kind_from_node (ptr_type_node))
164 DERIVED_TYPE (ISOCBINDING_FUNPTR, "c_funptr", \
165 get_int_kind_from_node (ptr_type_node))
166 DERIVED_TYPE (ISOCBINDING_NULL_FUNPTR, "c_null_funptr", \
167 get_int_kind_from_node (ptr_type_node))
170 #ifndef PROCEDURE
171 # define PROCEDURE(a,b)
172 #endif
174 PROCEDURE (ISOCBINDING_F_POINTER, "c_f_pointer")
175 PROCEDURE (ISOCBINDING_ASSOCIATED, "c_associated")
176 PROCEDURE (ISOCBINDING_LOC, "c_loc")
177 PROCEDURE (ISOCBINDING_FUNLOC, "c_funloc")
178 PROCEDURE (ISOCBINDING_F_PROCPOINTER, "c_f_procpointer")
180 /* The arguments to NAMED_FUNCTIONS are:
181 -- the ISYM
182 -- the symbol name in the module, as seen by Fortran code
183 -- the Fortran standard */
185 NAMED_FUNCTION (ISOCBINDING_C_SIZEOF, "c_sizeof", \
186 GFC_ISYM_C_SIZEOF, GFC_STD_F2008)
189 #undef NAMED_INTCST
190 #undef NAMED_REALCST
191 #undef NAMED_CMPXCST
192 #undef NAMED_LOGCST
193 #undef NAMED_CHARCST
194 #undef NAMED_CHARKNDCST
195 #undef DERIVED_TYPE
196 #undef PROCEDURE
197 #undef NAMED_FUNCTION