aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/dump-parse-tree.cc
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2024-10-12 19:09:14 +0200
committerThomas Koenig <tkoenig@gcc.gnu.org>2024-10-12 19:11:22 +0200
commitd09131eea083e80ccad60cc2686c09e9fdae0188 (patch)
tree174779033715c02846445fb37c75cba1160abbeb /gcc/fortran/dump-parse-tree.cc
parenta9173a50e7e346a218323916e4d3add8552529ae (diff)
downloadgcc-d09131eea083e80ccad60cc2686c09e9fdae0188.zip
gcc-d09131eea083e80ccad60cc2686c09e9fdae0188.tar.gz
gcc-d09131eea083e80ccad60cc2686c09e9fdae0188.tar.bz2
Unsigned constants for ISO_FORTRAN_ENV and ISO_C_BINDING.
gcc/fortran/ChangeLog: * dump-parse-tree.cc (get_c_type_name): Also handle BT_UNSIGNED. * gfortran.h (NAMED_UINTCST): Define before inclusion of iso-c-binding.def and iso-fortran-env.def. (gfc_get_uint_kind_from_width_isofortranenv): Prototype. * gfortran.texi: Mention new constants in iso_c_binding and iso_fortran_env. * iso-c-binding.def: Handle NAMED_UINTCST. Add c_unsigned, c_unsigned_short,c_unsigned_char, c_unsigned_long, c_unsigned_long_long, c_uintmax_t, c_uint8_t, c_uint16_t, c_uint32_t, c_uint64_t, c_uint128_t, c_uint_least8_t, c_uint_least16_t, c_uint_least32_t, c_uint_least64_t, c_uint_least128_t, c_uint_fast8_t, c_uint_fast16_t, c_uint_fast32_t, c_uint_fast64_t and c_uint_fast128_t. * iso-fortran-env.def: Handle NAMED_UINTCST. Add uint8, uint16, uint32 and uint64. * module.cc (parse_integer): Whitespace fix. (write_module): Whitespace fix. (NAMED_UINTCST): Define before inclusion of iso-fortran-evn.def and iso-fortran-env.def. * symbol.cc: Likewise. * trans-types.cc (get_unsigned_kind_from_node): New function. (get_uint_kind_from_name): New function. (gfc_get_uint_kind_from_width_isofortranenv): New function. (get_uint_kind_from_width): New function. (gfc_init_kinds): Initialize gfc_c_uint_kind. gcc/testsuite/ChangeLog: * gfortran.dg/unsigned_36.f90: New test.
Diffstat (limited to 'gcc/fortran/dump-parse-tree.cc')
-rw-r--r--gcc/fortran/dump-parse-tree.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/fortran/dump-parse-tree.cc b/gcc/fortran/dump-parse-tree.cc
index 3547d7f..bc8a95a 100644
--- a/gcc/fortran/dump-parse-tree.cc
+++ b/gcc/fortran/dump-parse-tree.cc
@@ -3867,7 +3867,8 @@ get_c_type_name (gfc_typespec *ts, gfc_array_spec *as, const char **pre,
*asterisk = false;
*post = "";
*type_name = "<error>";
- if (ts->type == BT_REAL || ts->type == BT_INTEGER || ts->type == BT_COMPLEX)
+ if (ts->type == BT_REAL || ts->type == BT_INTEGER || ts->type == BT_COMPLEX
+ || ts->type == BT_UNSIGNED)
{
if (ts->is_c_interop && ts->interop_kind)
ret = T_OK;
@@ -3895,7 +3896,16 @@ get_c_type_name (gfc_typespec *ts, gfc_array_spec *as, const char **pre,
*type_name = "__GFORTRAN_DOUBLE_COMPLEX";
else if (strcmp (*type_name, "long_double_complex") == 0)
*type_name = "__GFORTRAN_LONG_DOUBLE_COMPLEX";
-
+ else if (strcmp (*type_name, "unsigned") == 0)
+ *type_name = "unsigned int";
+ else if (strcmp (*type_name, "unsigned_char") == 0)
+ *type_name = "unsigned char";
+ else if (strcmp (*type_name, "unsigned_short") == 0)
+ *type_name = "unsigned short int";
+ else if (strcmp (*type_name, "unsigned_long") == 0)
+ *type_name = "unsigned long int";
+ else if (strcmp (*type_name, "unsigned_long long") == 0)
+ *type_name = "unsigned long long int";
break;
}
}