aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/iso-c-binding.def
diff options
context:
space:
mode:
authorSteven G. Kargl <kargls@comcast.net>2024-12-29 14:19:18 -0800
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2024-12-30 09:41:03 -0800
commitefc0981077a70c4de4596f682c4aeade07ec2f17 (patch)
treef73c4968cc8eea464cf2c62c8256ea21209faa6e /gcc/fortran/iso-c-binding.def
parent64d31343d4676d8ceef9232dcd33824bc2eff330 (diff)
downloadgcc-efc0981077a70c4de4596f682c4aeade07ec2f17.zip
gcc-efc0981077a70c4de4596f682c4aeade07ec2f17.tar.gz
gcc-efc0981077a70c4de4596f682c4aeade07ec2f17.tar.bz2
Fortran: Implement f_c_string function.
Fortran 2023 has added the new intrinsic function F_C_STRING to convert fortran strings of default character kind to a null terminated C string. Contributions from Steve Kargl, Harald Anlauf, FX Coudert, Mikael Morin, and Jerry DeLisle. PR fortran/117643 gcc/fortran/ChangeLog: * check.cc (gfc_check_f_c_string): Check arguments of f_c_string(). * gfortran.h (enum gfc_isym_id): New symbol GFC_ISYM_F_C_STRING. * intrinsic.cc (add_functions): Add the ISO C Binding routine f_c_string(). Wrap nearby long line to less than 80 characters. * intrinsic.h (gfc_check_f_c_string): Prototype for gfc_check_f_c_string(). * iso-c-binding.def (NAMED_FUNCTION): Declare for ISO C Binding routine f_c_string(). * primary.cc (gfc_match_rvalue): Fix comment that has been untrue since 2011. Add ISOCBINDING_F_C_STRING to conditional. * trans-intrinsic.cc (conv_trim): Specialized version of trim() for f_c_string(). (gfc_conv_intrinsic_function): Use GFC_ISYM_F_C_STRING to trigger in-lining. gcc/testsuite/ChangeLog: * gfortran.dg/f_c_string1.f90: New test. * gfortran.dg/f_c_string2.f90: New test.
Diffstat (limited to 'gcc/fortran/iso-c-binding.def')
-rw-r--r--gcc/fortran/iso-c-binding.def3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/fortran/iso-c-binding.def b/gcc/fortran/iso-c-binding.def
index bad66b1..5ef4368 100644
--- a/gcc/fortran/iso-c-binding.def
+++ b/gcc/fortran/iso-c-binding.def
@@ -256,6 +256,9 @@ NAMED_FUNCTION (ISOCBINDING_LOC, "c_loc",
NAMED_FUNCTION (ISOCBINDING_C_SIZEOF, "c_sizeof", \
GFC_ISYM_C_SIZEOF, GFC_STD_F2008)
+NAMED_FUNCTION (ISOCBINDING_F_C_STRING, "f_c_string", \
+ GFC_ISYM_F_C_STRING, GFC_STD_F2023)
+
#undef NAMED_INTCST
#undef NAMED_UINTCST
#undef NAMED_REALCST