View | Details | Raw Unified | Return to bug 40568
Collapse All | Expand All

(-)iso-c-binding.def (-6 / +8 lines)
Lines 153-166 DERIVED_TYPE (ISOCBINDING_NULL_FUNPTR, " Link Here
153
153
154
  
154
  
155
#ifndef PROCEDURE
155
#ifndef PROCEDURE
156
# define PROCEDURE(a,b) 
156
# define PROCEDURE(a,b,c)
157
#endif
157
#endif
158
158
159
PROCEDURE (ISOCBINDING_F_POINTER, "c_f_pointer")
159
PROCEDURE (ISOCBINDING_F_POINTER, "c_f_pointer", GFC_STD_F2003)
160
PROCEDURE (ISOCBINDING_ASSOCIATED, "c_associated")
160
PROCEDURE (ISOCBINDING_ASSOCIATED, "c_associated", GFC_STD_F2003)
161
PROCEDURE (ISOCBINDING_LOC, "c_loc")
161
PROCEDURE (ISOCBINDING_LOC, "c_loc", GFC_STD_F2003)
162
PROCEDURE (ISOCBINDING_FUNLOC, "c_funloc")
162
PROCEDURE (ISOCBINDING_FUNLOC, "c_funloc", GFC_STD_F2003)
163
PROCEDURE (ISOCBINDING_F_PROCPOINTER, "c_f_procpointer")
163
PROCEDURE (ISOCBINDING_F_PROCPOINTER, "c_f_procpointer", GFC_STD_F2003)
164
PROCEDURE (ISOCBINDING_SIZEOF, "c_sizeof", GFC_STD_F2008)
165
164
166
165
#undef NAMED_INTCST
167
#undef NAMED_INTCST
166
#undef NAMED_REALCST
168
#undef NAMED_REALCST
(-)intrinsic.c (-1 lines)
Lines 2456-2462 add_functions (void) Link Here
2456
	     x, BT_UNKNOWN, 0, REQUIRED);
2456
	     x, BT_UNKNOWN, 0, REQUIRED);
2457
2457
2458
  make_generic ("sizeof", GFC_ISYM_SIZEOF, GFC_STD_GNU);
2458
  make_generic ("sizeof", GFC_ISYM_SIZEOF, GFC_STD_GNU);
2459
  make_alias ("c_sizeof", GFC_STD_F2008);
2460
2459
2461
  add_sym_1 ("spacing", GFC_ISYM_SPACING, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95,
2460
  add_sym_1 ("spacing", GFC_ISYM_SPACING, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95,
2462
	     gfc_check_x, gfc_simplify_spacing, gfc_resolve_spacing,
2461
	     gfc_check_x, gfc_simplify_spacing, gfc_resolve_spacing,
(-)symbol.c (-2 / +19 lines)
Lines 4199-4204 build_formal_args (gfc_symbol *new_proc_ Link Here
4199
	  tail->sym->attr.optional = 1;
4199
	  tail->sym->attr.optional = 1;
4200
	}
4200
	}
4201
    }
4201
    }
4202
  else if (old_sym->intmod_sym_id == ISOCBINDING_SIZEOF)
4203
    {
4204
      gen_fptr_param (&head, &tail, (const char *) new_proc_sym->module,
4205
		      gfc_current_ns, "X", ISOCBINDING_SIZEOF);
4206
    }
4202
4207
4203
  /* Add the interface (store formal args to new_proc_sym).  */
4208
  /* Add the interface (store formal args to new_proc_sym).  */
4204
  add_proc_interface (new_proc_sym, IFSRC_DECL, head);
4209
  add_proc_interface (new_proc_sym, IFSRC_DECL, head);
Lines 4218-4227 std_for_isocbinding_symbol (int id) Link Here
4218
#define NAMED_INTCST(a,b,c,d) \
4223
#define NAMED_INTCST(a,b,c,d) \
4219
      case a:\
4224
      case a:\
4220
        return d;
4225
        return d;
4226
#define PROCEDURE(a,b,c) \
4227
      case a:\
4228
        return c;
4221
#include "iso-c-binding.def"
4229
#include "iso-c-binding.def"
4222
#undef NAMED_INTCST
4230
#undef NAMED_INTCST
4223
       default:
4231
4224
         return GFC_STD_F2003;
4232
      default:
4233
        return GFC_STD_F2003;
4225
    }
4234
    }
4226
}
4235
}
4227
4236
Lines 4419-4424 generate_isocbinding_symbol (const char Link Here
4419
      case ISOCBINDING_LOC:
4428
      case ISOCBINDING_LOC:
4420
      case ISOCBINDING_FUNLOC:
4429
      case ISOCBINDING_FUNLOC:
4421
      case ISOCBINDING_F_PROCPOINTER:
4430
      case ISOCBINDING_F_PROCPOINTER:
4431
      case ISOCBINDING_SIZEOF:
4422
4432
4423
	tmp_sym->attr.proc = PROC_MODULE;
4433
	tmp_sym->attr.proc = PROC_MODULE;
4424
4434
Lines 4442-4447 generate_isocbinding_symbol (const char Link Here
4442
		tmp_sym->ts.kind = gfc_default_logical_kind;
4452
		tmp_sym->ts.kind = gfc_default_logical_kind;
4443
		tmp_sym->result = tmp_sym;
4453
		tmp_sym->result = tmp_sym;
4444
	      }
4454
	      }
4455
	    else if (s == ISOCBINDING_SIZEOF)
4456
	      {
4457
		tmp_sym->attr.function = 1;
4458
		tmp_sym->ts.type = BT_INTEGER;
4459
		tmp_sym->ts.kind = gfc_index_integer_kind;
4460
		tmp_sym->result = tmp_sym;
4461
	      }
4445
	    else
4462
	    else
4446
	      {
4463
	      {
4447
               /* Here, we're taking the simple approach.  We're defining
4464
               /* Here, we're taking the simple approach.  We're defining
(-)resolve.c (-3 / +12 lines)
Lines 2333-2341 is_scalar_expr_ptr (gfc_expr *expr) Link Here
2333
}
2318
}
2334
2319
2335
2320
2336
/* Match one of the iso_c_binding functions (c_associated or c_loc)
2321
/* Match one of the iso_c_binding functions (c_associated, c_loc or
2337
   and, in the case of c_associated, set the binding label based on
2322
   c_sizeof) and, in the case of c_associated, set the binding label
2338
   the arguments.  */
2323
   based on the arguments.  */
2339
2324
2340
static gfc_try
2325
static gfc_try
2341
gfc_iso_c_func_interface (gfc_symbol *sym, gfc_actual_arglist *args,
2326
gfc_iso_c_func_interface (gfc_symbol *sym, gfc_actual_arglist *args,
Lines 2552-2557 gfc_iso_c_func_interface (gfc_symbol *sy Link Here
2552
      /* for c_loc/c_funloc, the new symbol is the same as the old one */
2537
      /* for c_loc/c_funloc, the new symbol is the same as the old one */
2553
      *new_sym = sym;
2538
      *new_sym = sym;
2554
    }
2539
    }
2540
  else if (sym->intmod_sym_id == ISOCBINDING_SIZEOF)
2541
    {
2542
      if (gfc_notify_std (GFC_STD_F2008, "Fortran 2008: C_SIZEOF "
2543
			  "intrinsic at %C") == FAILURE)
2544
	return FAILURE;
2545
2546
      /* do nothing?! */
2547
      *new_sym = sym;
2548
    }
2555
  else
2549
  else
2556
    {
2550
    {
2557
      gfc_internal_error ("gfc_iso_c_func_interface(): Unhandled "
2551
      gfc_internal_error ("gfc_iso_c_func_interface(): Unhandled "
(-)primary.c (-3 / +4 lines)
Lines 2727-2740 gfc_match_rvalue (gfc_expr **result) Link Here
2727
	}
2727
	}
2728
2728
2729
      /* Check here for the existence of at least one argument for the
2729
      /* Check here for the existence of at least one argument for the
2730
         iso_c_binding functions C_LOC, C_FUNLOC, and C_ASSOCIATED.  The
2730
         iso_c_binding functions C_LOC, C_FUNLOC, C_ASSOCIATED and C_SIZEOF.
2731
         argument(s) given will be checked in gfc_iso_c_func_interface,
2731
         The argument(s) given will be checked in gfc_iso_c_func_interface,
2732
         during resolution of the function call.  */
2732
         during resolution of the function call.  */
2733
      if (sym->attr.is_iso_c == 1
2733
      if (sym->attr.is_iso_c == 1
2734
	  && (sym->from_intmod == INTMOD_ISO_C_BINDING
2734
	  && (sym->from_intmod == INTMOD_ISO_C_BINDING
2735
	      && (sym->intmod_sym_id == ISOCBINDING_LOC
2735
	      && (sym->intmod_sym_id == ISOCBINDING_LOC
2736
		  || sym->intmod_sym_id == ISOCBINDING_FUNLOC
2736
		  || sym->intmod_sym_id == ISOCBINDING_FUNLOC
2737
		  || sym->intmod_sym_id == ISOCBINDING_ASSOCIATED)))
2737
		  || sym->intmod_sym_id == ISOCBINDING_ASSOCIATED
2738
		  || sym->intmod_sym_id == ISOCBINDING_SIZEOF)))
2738
        {
2739
        {
2739
          /* make sure we were given a param */
2740
          /* make sure we were given a param */
2740
          if (actual_arglist == NULL)
2741
          if (actual_arglist == NULL)
(-)trans-expr.c (+1 lines)
Lines 2520-2525 gfc_conv_derived_to_class (gfc_se *parms Link Here
2520
    * C_F_POINTER     (subroutine)
2520
    * C_F_POINTER     (subroutine)
2521
    * C_F_PROCPOINTER (subroutine)
2521
    * C_F_PROCPOINTER (subroutine)
2522
    * C_ASSOCIATED    (function)
2522
    * C_ASSOCIATED    (function)
2523
    * C_SIZEOF        (function)
2523
   One exception which is not handled here is C_F_POINTER with non-scalar
2524
   One exception which is not handled here is C_F_POINTER with non-scalar
2524
   arguments. Returns 1 if the call was replaced by inline code (else: 0).  */
2525
   arguments. Returns 1 if the call was replaced by inline code (else: 0).  */
2525
2526
(-)trans-types.c (-1 / +1 lines)
Lines 323-329 void init_c_interop_kinds (void) Link Here
323
  strncpy (c_interop_kinds_table[a].name, b, strlen(b) + 1); \
323
  strncpy (c_interop_kinds_table[a].name, b, strlen(b) + 1); \
324
  c_interop_kinds_table[a].f90_type = BT_DERIVED; \
324
  c_interop_kinds_table[a].f90_type = BT_DERIVED; \
325
  c_interop_kinds_table[a].value = c;
325
  c_interop_kinds_table[a].value = c;
326
#define PROCEDURE(a,b) \
326
#define PROCEDURE(a,b,c) \
327
  strncpy (c_interop_kinds_table[a].name, b, strlen(b) + 1); \
327
  strncpy (c_interop_kinds_table[a].name, b, strlen(b) + 1); \
328
  c_interop_kinds_table[a].f90_type = BT_PROCEDURE; \
328
  c_interop_kinds_table[a].f90_type = BT_PROCEDURE; \
329
  c_interop_kinds_table[a].value = 0;
329
  c_interop_kinds_table[a].value = 0;
(-)intrinsic.texi (-3 / +4 lines)
Lines 2183-2201 expression @code{X} occupies. Link Here
2183
Fortran 2008
2183
Fortran 2008
2184
2184
2185
@item @emph{Class}:
2185
@item @emph{Class}:
2186
Intrinsic function
2186
Inquiry function
2187
2187
2188
@item @emph{Syntax}:
2188
@item @emph{Syntax}:
2189
@code{N = C_SIZEOF(X)}
2189
@code{N = C_SIZEOF(X)}
2190
2190
2191
@item @emph{Arguments}:
2191
@item @emph{Arguments}:
2192
@multitable @columnfractions .15 .70
2192
@multitable @columnfractions .15 .70
2193
@item @var{X} @tab The argument shall be of any type, rank or shape.
2193
@item @var{X} @tab The argument shall be of any type, rank or shape, but
2194
not an array of assumed-size.
2194
@end multitable
2195
@end multitable
2195
2196
2196
@item @emph{Return value}:
2197
@item @emph{Return value}:
2197
The return value is of type integer and of the system-dependent kind
2198
The return value is of type integer and of the system-dependent kind
2198
@var{C_SIZE_T} (from the @var{ISO_C_BINDING} module). Its value is the
2199
@code{C_SIZE_T} (from the @code{ISO_C_BINDING} module). Its value is the
2199
number of bytes occupied by the argument.  If the argument has the
2200
number of bytes occupied by the argument.  If the argument has the
2200
@code{POINTER} attribute, the number of bytes of the storage area pointed
2201
@code{POINTER} attribute, the number of bytes of the storage area pointed
2201
to is returned.  If the argument is of a derived type with @code{POINTER}
2202
to is returned.  If the argument is of a derived type with @code{POINTER}
(-)gfortran.h (-1 / +1 lines)
Lines 596-602 iso_fortran_env_symbol; Link Here
596
#define NAMED_CHARKNDCST(a,b,c) a,
596
#define NAMED_CHARKNDCST(a,b,c) a,
597
#define NAMED_CHARCST(a,b,c) a,
597
#define NAMED_CHARCST(a,b,c) a,
598
#define DERIVED_TYPE(a,b,c) a,
598
#define DERIVED_TYPE(a,b,c) a,
599
#define PROCEDURE(a,b) a,
599
#define PROCEDURE(a,b,c) a,
600
typedef enum
600
typedef enum
601
{
601
{
602
  ISOCBINDING_INVALID = -1, 
602
  ISOCBINDING_INVALID = -1, 

Return to bug 40568