LCOV - code coverage report
Current view: top level - gcc/fortran - iso-c-binding.def Coverage Total Hit
Test: gcc.info Lines: 100.0 % 74 74
Test Date: 2026-02-28 14:20:25 Functions: - 0 0
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* Copyright (C) 2006-2026 Free Software Foundation, Inc.
       2              : 
       3              : This file is part of GCC.
       4              : 
       5              : GCC is free software; you can redistribute it and/or modify it under
       6              : the terms of the GNU General Public License as published by the Free
       7              : Software Foundation; either version 3, or (at your option) any later
       8              : version.
       9              : 
      10              : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      11              : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      12              : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      13              : for more details.
      14              : 
      15              : You should have received a copy of the GNU General Public License
      16              : along with GCC; see the file COPYING3.  If not see
      17              : <http://www.gnu.org/licenses/>.  */
      18              : 
      19              : /* This file contains the definition of the types provided by the
      20              :    Fortran 2003 ISO_C_BINDING intrinsic module.  The ordering of
      21              :    the entries matters for the *.mod backwards compatibility.  */
      22              : 
      23              : #ifndef NAMED_INTCST
      24              : # define NAMED_INTCST(a,b,c,d)
      25              : #endif
      26              : 
      27              : #ifndef NAMED_REALCST
      28              : # define NAMED_REALCST(a,b,c,d)
      29              : #endif
      30              : 
      31              : #ifndef NAMED_CMPXCST
      32              : # define NAMED_CMPXCST(a,b,c,d)
      33              : #endif
      34              : 
      35              : #ifndef NAMED_LOGCST
      36              : # define NAMED_LOGCST(a,b,c)
      37              : #endif
      38              : 
      39              : #ifndef NAMED_CHARKNDCST
      40              : # define NAMED_CHARKNDCST(a,b,c)
      41              : #endif
      42              : 
      43              : #ifndef NAMED_FUNCTION
      44              : # define NAMED_FUNCTION(a,b,c,d)
      45              : #endif
      46              : 
      47              : #ifndef NAMED_SUBROUTINE
      48              : # define NAMED_SUBROUTINE(a,b,c,d)
      49              : #endif
      50              : 
      51              : #ifndef NAMED_UINTCST
      52              : # define NAMED_UINTCST(a,b,c,d)
      53              : #endif
      54              : 
      55              : /* The arguments to NAMED_*CST are:
      56              :      -- an internal name
      57              :      -- the symbol name in the module, as seen by Fortran code
      58              :      -- the value it has, for use in trans-types.cc
      59              :      -- the standard that supports this type  */
      60              : 
      61       149206 : NAMED_INTCST (ISOCBINDING_INT, "c_int", gfc_c_int_kind, GFC_STD_F2003)
      62       147770 : NAMED_INTCST (ISOCBINDING_SHORT, "c_short", \
      63              :               get_int_kind_from_node (short_integer_type_node), GFC_STD_F2003)
      64       147769 : NAMED_INTCST (ISOCBINDING_LONG, "c_long", \
      65              :               get_int_kind_from_node (long_integer_type_node), GFC_STD_F2003)
      66       147769 : NAMED_INTCST (ISOCBINDING_LONG_LONG, "c_long_long", \
      67              :               get_int_kind_from_node (long_long_integer_type_node), GFC_STD_F2003)
      68              : 
      69       148176 : NAMED_INTCST (ISOCBINDING_INTMAX_T, "c_intmax_t", \
      70              :               get_int_kind_from_name (INTMAX_TYPE), GFC_STD_F2003)
      71       148318 : NAMED_INTCST (ISOCBINDING_INTPTR_T, "c_intptr_t", \
      72              :               get_int_kind_from_name (INTPTR_TYPE), GFC_STD_F2003)
      73        37989 : NAMED_INTCST (ISOCBINDING_PTRDIFF_T, "c_ptrdiff_t", \
      74              :               get_int_kind_from_name (PTRDIFF_TYPE), GFC_STD_F2018)
      75       149518 : NAMED_INTCST (ISOCBINDING_SIZE_T, "c_size_t", \
      76              :               gfc_index_integer_kind, GFC_STD_F2003)
      77       147889 : NAMED_INTCST (ISOCBINDING_SIGNED_CHAR, "c_signed_char", \
      78              :               get_int_kind_from_node (signed_char_type_node), GFC_STD_F2003)
      79              : 
      80       147769 : NAMED_INTCST (ISOCBINDING_INT8_T, "c_int8_t", \
      81              :               get_int_kind_from_name (INT8_TYPE), GFC_STD_F2003)
      82       147865 : NAMED_INTCST (ISOCBINDING_INT16_T, "c_int16_t", \
      83              :               get_int_kind_from_name (INT16_TYPE), GFC_STD_F2003)
      84       149183 : NAMED_INTCST (ISOCBINDING_INT32_T, "c_int32_t", \
      85              :               get_int_kind_from_name (INT32_TYPE), GFC_STD_F2003)
      86       149590 : NAMED_INTCST (ISOCBINDING_INT64_T, "c_int64_t", \
      87              :               get_int_kind_from_name (INT64_TYPE), GFC_STD_F2003)
      88              : /* GNU Extension.  */
      89       147771 : NAMED_INTCST (ISOCBINDING_INT128_T, "c_int128_t", \
      90              :               get_int_kind_from_width (128), GFC_STD_GNU)
      91              : 
      92       147769 : NAMED_INTCST (ISOCBINDING_INT_LEAST8_T, "c_int_least8_t", \
      93              :               get_int_kind_from_name (INT_LEAST8_TYPE), GFC_STD_F2003)
      94       147769 : NAMED_INTCST (ISOCBINDING_INT_LEAST16_T, "c_int_least16_t", \
      95              :               get_int_kind_from_name (INT_LEAST16_TYPE), GFC_STD_F2003)
      96       147769 : NAMED_INTCST (ISOCBINDING_INT_LEAST32_T, "c_int_least32_t", \
      97              :               get_int_kind_from_name (INT_LEAST32_TYPE), GFC_STD_F2003)
      98       148176 : NAMED_INTCST (ISOCBINDING_INT_LEAST64_T, "c_int_least64_t", \
      99              :               get_int_kind_from_name (INT_LEAST64_TYPE), GFC_STD_F2003)
     100              : /* GNU Extension.  */
     101       147771 : NAMED_INTCST (ISOCBINDING_INT_LEAST128_T, "c_int_least128_t", \
     102              :               get_int_kind_from_minimal_width (128), GFC_STD_GNU)
     103              : 
     104       147769 : NAMED_INTCST (ISOCBINDING_INT_FAST8_T, "c_int_fast8_t", \
     105              :               get_int_kind_from_name (INT_FAST8_TYPE), GFC_STD_F2003)
     106       148176 : NAMED_INTCST (ISOCBINDING_INT_FAST16_T, "c_int_fast16_t", \
     107              :               get_int_kind_from_name (INT_FAST16_TYPE), GFC_STD_F2003)
     108       148176 : NAMED_INTCST (ISOCBINDING_INT_FAST32_T, "c_int_fast32_t", \
     109              :               get_int_kind_from_name (INT_FAST32_TYPE), GFC_STD_F2003)
     110       148176 : NAMED_INTCST (ISOCBINDING_INT_FAST64_T, "c_int_fast64_t", \
     111              :               get_int_kind_from_name (INT_FAST64_TYPE), GFC_STD_F2003)
     112              : /* GNU Extension.  */
     113       147771 : NAMED_INTCST (ISOCBINDING_INT_FAST128_T, "c_int_fast128_t",
     114              :               get_int_kind_from_width (128), GFC_STD_GNU)
     115              : 
     116       147785 : NAMED_REALCST (ISOCBINDING_FLOAT, "c_float", \
     117              :                get_real_kind_from_node (float_type_node), GFC_STD_F2003)
     118       147784 : NAMED_REALCST (ISOCBINDING_DOUBLE, "c_double", \
     119              :                get_real_kind_from_node (double_type_node), GFC_STD_F2003)
     120       147775 : NAMED_REALCST (ISOCBINDING_LONG_DOUBLE, "c_long_double", \
     121              :                get_real_kind_from_node (long_double_type_node), GFC_STD_F2003)
     122              : 
     123              : /* GNU Extension.  Note that the equivalence here is specifically to
     124              :    the IEEE 128-bit type _Float128; if that does not map onto a type
     125              :    otherwise supported by the Fortran front end, get_real_kind_from_node
     126              :    will reject it as unsupported.  */
     127       147771 : NAMED_REALCST (ISOCBINDING_FLOAT128, "c_float128", \
     128              :                 (float128_type_node == NULL_TREE \
     129              :                  ? -4 : get_real_kind_from_node (float128_type_node)), \
     130              :                GFC_STD_GNU)
     131       147781 : NAMED_CMPXCST (ISOCBINDING_FLOAT_COMPLEX, "c_float_complex", \
     132              :                get_real_kind_from_node (float_type_node), GFC_STD_F2003)
     133       147781 : NAMED_CMPXCST (ISOCBINDING_DOUBLE_COMPLEX, "c_double_complex", \
     134              :                get_real_kind_from_node (double_type_node), GFC_STD_F2003)
     135       147781 : NAMED_CMPXCST (ISOCBINDING_LONG_DOUBLE_COMPLEX, "c_long_double_complex", \
     136              :                get_real_kind_from_node (long_double_type_node), GFC_STD_F2003)
     137              : 
     138              : /* GNU Extension.  Similar issues to c_float128 above.  */
     139       147777 : NAMED_CMPXCST (ISOCBINDING_FLOAT128_COMPLEX, "c_float128_complex", \
     140              :                 (float128_type_node == NULL_TREE \
     141              :                  ? -4 : get_real_kind_from_node (float128_type_node)), \
     142              :                GFC_STD_GNU)
     143              : 
     144       144622 : NAMED_LOGCST (ISOCBINDING_BOOL, "c_bool", \
     145              :               get_int_kind_from_width (BOOL_TYPE_SIZE))
     146              : 
     147       144622 : NAMED_CHARKNDCST (ISOCBINDING_CHAR, "c_char", gfc_default_character_kind)
     148              : 
     149              : #ifndef NAMED_CHARCST
     150              : # define NAMED_CHARCST(a,b,c)
     151              : #endif
     152              : 
     153              : /* Use langhooks to deal with host to target translations.  */
     154        56446 : NAMED_CHARCST (ISOCBINDING_NULL_CHAR, "c_null_char", \
     155              :                lang_hooks.to_target_charset ('\0'))
     156        56446 : NAMED_CHARCST (ISOCBINDING_ALERT, "c_alert", \
     157              :                lang_hooks.to_target_charset ('\a'))
     158        56446 : NAMED_CHARCST (ISOCBINDING_BACKSPACE, "c_backspace", \
     159              :                lang_hooks.to_target_charset ('\b'))
     160        56446 : NAMED_CHARCST (ISOCBINDING_FORM_FEED, "c_form_feed", \
     161              :                lang_hooks.to_target_charset ('\f'))
     162        56446 : NAMED_CHARCST (ISOCBINDING_NEW_LINE, "c_new_line", \
     163              :                lang_hooks.to_target_charset ('\n'))
     164        56446 : NAMED_CHARCST (ISOCBINDING_CARRIAGE_RETURN, "c_carriage_return", \
     165              :                lang_hooks.to_target_charset ('\r'))
     166        56446 : NAMED_CHARCST (ISOCBINDING_HORIZONTAL_TAB, "c_horizontal_tab", \
     167              :                lang_hooks.to_target_charset ('\t'))
     168        56446 : NAMED_CHARCST (ISOCBINDING_VERTICAL_TAB, "c_vertical_tab", \
     169              :                lang_hooks.to_target_charset ('\v'))
     170              : 
     171              : #ifndef DERIVED_TYPE
     172              : # define DERIVED_TYPE(a,b,c)
     173              : #endif
     174              : 
     175        31306 : DERIVED_TYPE (ISOCBINDING_PTR, "c_ptr", \
     176              :               get_int_kind_from_node (ptr_type_node))
     177        31306 : DERIVED_TYPE (ISOCBINDING_NULL_PTR, "c_null_ptr", \
     178              :               get_int_kind_from_node (ptr_type_node))
     179        31306 : DERIVED_TYPE (ISOCBINDING_FUNPTR, "c_funptr", \
     180              :               get_int_kind_from_node (ptr_type_node))
     181        31306 : DERIVED_TYPE (ISOCBINDING_NULL_FUNPTR, "c_null_funptr", \
     182              :               get_int_kind_from_node (ptr_type_node))
     183              : 
     184              : /* The arguments to NAMED_FUNCTIONS and NAMED_SUBROUTINES are:
     185              :      -- the ISYM
     186              :      -- the symbol name in the module, as seen by Fortran code
     187              :      -- the Fortran standard  */
     188              : 
     189        37718 : NAMED_SUBROUTINE (ISOCBINDING_F_POINTER, "c_f_pointer",
     190              :                   GFC_ISYM_C_F_POINTER, GFC_STD_F2003)
     191        37602 : NAMED_SUBROUTINE (ISOCBINDING_F_PROCPOINTER, "c_f_procpointer",
     192              :                   GFC_ISYM_C_F_PROCPOINTER, GFC_STD_F2003)
     193              : 
     194        37772 : NAMED_FUNCTION (ISOCBINDING_ASSOCIATED, "c_associated",
     195              :                 GFC_ISYM_C_ASSOCIATED, GFC_STD_F2003)
     196        37666 : NAMED_FUNCTION (ISOCBINDING_FUNLOC, "c_funloc",
     197              :                 GFC_ISYM_C_FUNLOC, GFC_STD_F2003)
     198        37854 : NAMED_FUNCTION (ISOCBINDING_LOC, "c_loc",
     199              :                 GFC_ISYM_C_LOC, GFC_STD_F2003)
     200              : 
     201        37637 : NAMED_FUNCTION (ISOCBINDING_C_SIZEOF, "c_sizeof", \
     202              :                 GFC_ISYM_C_SIZEOF, GFC_STD_F2008)
     203              : 
     204        37580 : NAMED_FUNCTION (ISOCBINDING_F_C_STRING, "f_c_string", \
     205              :                 GFC_ISYM_F_C_STRING, GFC_STD_F2023)
     206              : 
     207              : /* UNSIGNED.  */
     208       147769 : NAMED_UINTCST (ISOCBINDING_UINT, "c_unsigned", gfc_c_uint_kind, \
     209              :                GFC_STD_UNSIGNED)
     210       147769 : NAMED_UINTCST (ISOCBINDING_USHORT, "c_unsigned_short", \
     211              :                get_unsigned_kind_from_node (short_unsigned_type_node), \
     212              :                GFC_STD_UNSIGNED)
     213       147769 : NAMED_UINTCST (ISOCBINDING_UCHAR, "c_unsigned_char", \
     214              :                get_unsigned_kind_from_node (unsigned_char_type_node), \
     215              :                GFC_STD_UNSIGNED)
     216       147769 : NAMED_UINTCST (ISOCBINDING_ULONG, "c_unsigned_long", \
     217              :                get_unsigned_kind_from_node (long_unsigned_type_node), \
     218              :                GFC_STD_UNSIGNED)
     219       147769 : NAMED_UINTCST (ISOCBINDING_ULONGLONG, "c_unsigned_long_long", \
     220              :                get_unsigned_kind_from_node (long_long_unsigned_type_node), \
     221              :                GFC_STD_UNSIGNED)
     222       148176 : NAMED_UINTCST (ISOCBINDING_UINTMAX_T, "c_uintmax_t", \
     223              :                get_uint_kind_from_name (UINTMAX_TYPE), GFC_STD_UNSIGNED)
     224       147769 : NAMED_UINTCST (ISOCBINDING_UINT8_T, "c_uint8_t", \
     225              :                get_uint_kind_from_name (UINT8_TYPE), GFC_STD_UNSIGNED)
     226       147769 : NAMED_UINTCST (ISOCBINDING_UINT16_T, "c_uint16_t", \
     227              :                get_uint_kind_from_name (UINT16_TYPE), GFC_STD_UNSIGNED)
     228       147769 : NAMED_UINTCST (ISOCBINDING_UINT32_T, "c_uint32_t", \
     229              :                get_uint_kind_from_name (UINT32_TYPE), GFC_STD_UNSIGNED)
     230       148176 : NAMED_UINTCST (ISOCBINDING_UINT64_T, "c_uint64_t", \
     231              :                get_uint_kind_from_name (UINT64_TYPE), GFC_STD_UNSIGNED)
     232       147769 : NAMED_UINTCST (ISOCBINDING_UINT128_T, "c_uint128_t", \
     233              :                get_uint_kind_from_width (128), GFC_STD_UNSIGNED)
     234       147769 : NAMED_UINTCST (ISOCBINDING_UINT_LEAST8_T, "c_uint_least8_t", \
     235              :                get_uint_kind_from_name (UINT_LEAST8_TYPE), \
     236              :                GFC_STD_UNSIGNED)
     237       147769 : NAMED_UINTCST (ISOCBINDING_UINT_LEAST16_T, "c_uint_least16_t", \
     238              :                get_uint_kind_from_name (UINT_LEAST16_TYPE), \
     239              :                GFC_STD_UNSIGNED)
     240       147769 : NAMED_UINTCST (ISOCBINDING_UINT_LEAST32_T, "c_uint_least32_t", \
     241              :                get_uint_kind_from_name (UINT_LEAST32_TYPE),\
     242              :                GFC_STD_UNSIGNED)
     243       148176 : NAMED_UINTCST (ISOCBINDING_UINT_LEAST64_T, "c_uint_least64_t", \
     244              :                get_uint_kind_from_name (UINT_LEAST64_TYPE),\
     245              :                GFC_STD_UNSIGNED)
     246       147769 : NAMED_UINTCST (ISOCBINDING_UINT_LEAST128_T, "c_uint_least128_t", \
     247              :                get_uint_kind_from_width (128), GFC_STD_UNSIGNED)
     248       147769 : NAMED_UINTCST (ISOCBINDING_UINT_FAST8_T, "c_uint_fast8_t", \
     249              :                get_uint_kind_from_name (UINT_FAST8_TYPE), \
     250              :                GFC_STD_UNSIGNED)
     251       148176 : NAMED_UINTCST (ISOCBINDING_UINT_FAST16_T, "c_uint_fast16_t", \
     252              :                get_uint_kind_from_name (UINT_FAST16_TYPE), \
     253              :                GFC_STD_UNSIGNED)
     254       148176 : NAMED_UINTCST (ISOCBINDING_UINT_FAST32_T, "c_uint_fast32_t", \
     255              :                get_uint_kind_from_name (UINT_FAST32_TYPE),\
     256              :                GFC_STD_UNSIGNED)
     257       148176 : NAMED_UINTCST (ISOCBINDING_UINT_FAST64_T, "c_uint_fast64_t", \
     258              :                get_uint_kind_from_name (UINT_FAST64_TYPE),\
     259              :                GFC_STD_UNSIGNED)
     260       147769 : NAMED_UINTCST (ISOCBINDING_UINT_FAST128_T, "c_uint_fast128_t", \
     261              :                get_uint_kind_from_width (128), GFC_STD_UNSIGNED)
     262              : 
     263              : #undef NAMED_INTCST
     264              : #undef NAMED_UINTCST
     265              : #undef NAMED_REALCST
     266              : #undef NAMED_CMPXCST
     267              : #undef NAMED_LOGCST
     268              : #undef NAMED_CHARCST
     269              : #undef NAMED_CHARKNDCST
     270              : #undef DERIVED_TYPE
     271              : #undef NAMED_FUNCTION
     272              : #undef NAMED_SUBROUTINE
        

Generated by: LCOV version 2.4-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.