Patchwork [Fortran] Add TS29113's C_PTRDIFF_T

login
register
mail settings
Submitter Tobias Burnus
Date July 21, 2012, 7:53 a.m.
Message ID <500A6017.5060807@net-b.de>
Download mbox | patch
Permalink /patch/172407/
State New
Headers show

Comments

Tobias Burnus - July 21, 2012, 7:53 a.m.
TS 29113 adds (a bit hidden in "9.9 Edits to clause 15") a new 
ISO_C_Binding parameter: C_PTRDIFF_T.

Build, tested, and currently regtesting on x86-64-gnu-linux.
OK for the trunk?

Tobias
Janne Blomqvist - July 21, 2012, 3:19 p.m.
On Sat, Jul 21, 2012 at 10:53 AM, Tobias Burnus <burnus@net-b.de> wrote:
> TS 29113 adds (a bit hidden in "9.9 Edits to clause 15") a new ISO_C_Binding
> parameter: C_PTRDIFF_T.
>
> Build, tested, and currently regtesting on x86-64-gnu-linux.
> OK for the trunk?

Ok. Thanks for the patch.

Patch

2012-07-21  Tobias Burnus  <burnus@net-b.de>

	* iso-c-binding.def (C_PTRDIFF_T): New TS29113 parameter.
	* intrinsic.texi (ISO_C_BINDING): Document it.

diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi
index 9bc36d7..47a9fee 100644
--- a/gcc/fortran/intrinsic.texi
+++ b/gcc/fortran/intrinsic.texi
@@ -13029,11 +13029,11 @@  The @code{ISO_C_BINDING} module provides the following named constants of
 type default integer, which can be used as KIND type parameters.
 
 In addition to the integer named constants required by the Fortran 2003 
-standard, GNU Fortran provides as an extension named constants for the 
-128-bit integer types supported by the C compiler: @code{C_INT128_T, 
-C_INT_LEAST128_T, C_INT_FAST128_T}. Furthermore, if @code{__float} is
-supported in C, the named constants @code{C_FLOAT128, C_FLOAT128_COMPLEX}
-are defined.
+standard and @code{C_PTRDIFF_T} of TS 29113, GNU Fortran provides as an
+extension named constants for the 128-bit integer types supported by the
+C compiler: @code{C_INT128_T, C_INT_LEAST128_T, C_INT_FAST128_T}.
+Furthermore, if @code{__float128} is supported in C, the named constants
+@code{C_FLOAT128, C_FLOAT128_COMPLEX} are defined.
 
 @multitable @columnfractions .15 .35 .35 .35
 @item Fortran Type  @tab Named constant         @tab C type                                @tab Extension
@@ -13060,6 +13060,7 @@  are defined.
 @item @code{INTEGER}@tab @code{C_INT_FAST128_T} @tab @code{int_fast128_t}                 @tab Ext.
 @item @code{INTEGER}@tab @code{C_INTMAX_T}      @tab @code{intmax_t}
 @item @code{INTEGER}@tab @code{C_INTPTR_T}      @tab @code{intptr_t}
+@item @code{INTEGER}@tab @code{C_PTRDIFF_T}     @tab @code{intptr_t}                      @tab TS 29113
 @item @code{REAL}   @tab @code{C_FLOAT}         @tab @code{float}
 @item @code{REAL}   @tab @code{C_DOUBLE}        @tab @code{double}
 @item @code{REAL}   @tab @code{C_LONG_DOUBLE}   @tab @code{long double}
diff --git a/gcc/fortran/iso-c-binding.def b/gcc/fortran/iso-c-binding.def
index f8673b9..66712ad 100644
--- a/gcc/fortran/iso-c-binding.def
+++ b/gcc/fortran/iso-c-binding.def
@@ -61,6 +61,8 @@  NAMED_INTCST (ISOCBINDING_INTMAX_T, "c_intmax_t", \
               get_int_kind_from_name (INTMAX_TYPE), GFC_STD_F2003)
 NAMED_INTCST (ISOCBINDING_INTPTR_T, "c_intptr_t", \
               get_int_kind_from_name (INTPTR_TYPE), GFC_STD_F2003)
+NAMED_INTCST (ISOCBINDING_PTRDIFF_T, "c_ptrdiff_t", \
+              get_int_kind_from_name (PTRDIFF_TYPE), GFC_STD_F2008_TS)
 NAMED_INTCST (ISOCBINDING_SIZE_T, "c_size_t", \
               gfc_index_integer_kind, GFC_STD_F2003)
 NAMED_INTCST (ISOCBINDING_SIGNED_CHAR, "c_signed_char", \