1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

Add `scm_t_subr' typedef (fix bug #23681).

* libguile/__scm.h (scm_t_subr): New typedef.

* libguile/deprecated.h (scm_make_gsubr, scm_make_gsubr_with_generic,
  scm_call_catching_errors): Use it.

* libguile/gsubr.h (scm_c_make_gsubr, scm_c_define_gsubr,
  scm_c_define_gsubr_with_generic): Likewise.

* libguile/smob.h (scm_smob_descriptor)[apply]: Likewise.
  (scm_set_smob_apply): Likewise.

* libguile/snarf.h (SCM_FUNC_CAST_ARBITRARY_ARGS): Likewise.
This commit is contained in:
Ludovic Courtès 2011-02-13 14:50:05 +01:00
parent 10b9343f04
commit be90d0b6f9
5 changed files with 35 additions and 24 deletions

View file

@ -3,7 +3,8 @@
#ifndef SCM___SCM_H #ifndef SCM___SCM_H
#define SCM___SCM_H #define SCM___SCM_H
/* Copyright (C) 1995,1996,1998,1999,2000,2001,2002,2003, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. /* Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2006,
* 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -424,6 +425,19 @@
#include "libguile/tags.h" #include "libguile/tags.h"
/* The type of subrs, i.e., Scheme procedures implemented in C. Empty
function declarators are used internally for pointers to functions of
any arity. However, these are equivalent to `(void)' in C++, are
obsolescent as of C99, and trigger `strict-prototypes' GCC warnings
(bug #23681). */
#ifdef BUILDING_LIBGUILE
typedef SCM (* scm_t_subr) ();
#else
typedef void *scm_t_subr;
#endif
#ifdef vms #ifdef vms
# ifndef CHEAP_CONTINUATIONS # ifndef CHEAP_CONTINUATIONS

View file

@ -133,12 +133,12 @@ SCM_DEPRECATED SCM scm_internal_with_fluids (SCM fluids, SCM vals,
SCM_DEPRECATED SCM scm_make_gsubr (const char *name, SCM_DEPRECATED SCM scm_make_gsubr (const char *name,
int req, int opt, int rst, int req, int opt, int rst,
SCM (*fcn)()); scm_t_subr fcn);
SCM_DEPRECATED SCM scm_make_gsubr_with_generic (const char *name, SCM_DEPRECATED SCM scm_make_gsubr_with_generic (const char *name,
int req, int req,
int opt, int opt,
int rst, int rst,
SCM (*fcn)(), scm_t_subr fcn,
SCM *gf); SCM *gf);
SCM_DEPRECATED SCM scm_create_hook (const char* name, int n_args); SCM_DEPRECATED SCM scm_create_hook (const char* name, int n_args);
@ -173,7 +173,8 @@ SCM_DEPRECATED SCM scm_read_and_eval_x (SCM port);
#define SCM_SUBR_DOC(x) SCM_BOOL_F #define SCM_SUBR_DOC(x) SCM_BOOL_F
SCM_DEPRECATED SCM scm_call_catching_errors (SCM (*thunk)(), SCM (*err_filter)(), SCM_DEPRECATED SCM scm_call_catching_errors (scm_t_subr thunk,
scm_t_subr err_filter,
void * closure); void * closure);
SCM_DEPRECATED long scm_make_smob_type_mfpe (char *name, size_t size, SCM_DEPRECATED long scm_make_smob_type_mfpe (char *name, size_t size,

View file

@ -3,7 +3,8 @@
#ifndef SCM_GSUBR_H #ifndef SCM_GSUBR_H
#define SCM_GSUBR_H #define SCM_GSUBR_H
/* Copyright (C) 1995,1996,1998,2000,2001, 2006, 2008, 2009, 2010 Free Software Foundation, Inc. /* Copyright (C) 1995, 1996, 1998, 2000, 2001, 2006, 2008, 2009,
* 2010, 2011 Free Software Foundation, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -59,16 +60,16 @@ SCM_API SCM scm_subr_objcode_trampoline (unsigned int nreq,
SCM_API SCM scm_c_make_gsubr (const char *name, SCM_API SCM scm_c_make_gsubr (const char *name,
int req, int opt, int rst, SCM (*fcn) ()); int req, int opt, int rst, scm_t_subr fcn);
SCM_API SCM scm_c_make_gsubr_with_generic (const char *name, SCM_API SCM scm_c_make_gsubr_with_generic (const char *name,
int req, int opt, int rst, int req, int opt, int rst,
SCM (*fcn) (), SCM *gf); scm_t_subr fcn, SCM *gf);
SCM_API SCM scm_c_define_gsubr (const char *name, SCM_API SCM scm_c_define_gsubr (const char *name,
int req, int opt, int rst, SCM (*fcn) ()); int req, int opt, int rst, scm_t_subr fcn);
SCM_API SCM scm_c_define_gsubr_with_generic (const char *name, SCM_API SCM scm_c_define_gsubr_with_generic (const char *name,
int req, int opt, int rst, int req, int opt, int rst,
SCM (*fcn) (), SCM *gf); scm_t_subr fcn, SCM *gf);
SCM_INTERNAL void scm_init_gsubr (void); SCM_INTERNAL void scm_init_gsubr (void);

View file

@ -3,7 +3,8 @@
#ifndef SCM_SMOB_H #ifndef SCM_SMOB_H
#define SCM_SMOB_H #define SCM_SMOB_H
/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2004, 2006, 2009, 2010 Free Software Foundation, Inc. /* Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2004, 2006, 2009,
* 2010, 2011 Free Software Foundation, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -40,7 +41,7 @@ typedef struct scm_smob_descriptor
size_t (*free) (SCM); size_t (*free) (SCM);
int (*print) (SCM exp, SCM port, scm_print_state *pstate); int (*print) (SCM exp, SCM port, scm_print_state *pstate);
SCM (*equalp) (SCM, SCM); SCM (*equalp) (SCM, SCM);
SCM (*apply) (); scm_t_subr apply;
SCM apply_trampoline_objcode; SCM apply_trampoline_objcode;
} scm_smob_descriptor; } scm_smob_descriptor;
@ -202,7 +203,7 @@ SCM_API void scm_set_smob_print (scm_t_bits tc,
int (*print) (SCM, SCM, scm_print_state*)); int (*print) (SCM, SCM, scm_print_state*));
SCM_API void scm_set_smob_equalp (scm_t_bits tc, SCM (*equalp) (SCM, SCM)); SCM_API void scm_set_smob_equalp (scm_t_bits tc, SCM (*equalp) (SCM, SCM));
SCM_API void scm_set_smob_apply (scm_t_bits tc, SCM_API void scm_set_smob_apply (scm_t_bits tc,
SCM (*apply) (), scm_t_subr apply,
unsigned int req, unsigned int req,
unsigned int opt, unsigned int opt,
unsigned int rst); unsigned int rst);

View file

@ -3,7 +3,8 @@
#ifndef SCM_SNARF_H #ifndef SCM_SNARF_H
#define SCM_SNARF_H #define SCM_SNARF_H
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2004, 2006, 2009, 2010 Free Software Foundation, Inc. /* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
* 2004, 2006, 2009, 2010, 2011 Free Software Foundation, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -25,16 +26,9 @@
/* Macros for snarfing initialization actions from C source. */ /* Macros for snarfing initialization actions from C source. */
#if defined(__cplusplus) || defined(GUILE_CPLUSPLUS_SNARF) /* Casting to a function that can take any number of arguments. */
#define SCM_FUNC_CAST_ARBITRARY_ARGS scm_t_subr
/* This used to be "SCM (*)(...)" but GCC on RedHat 7.1 doesn't seem
to like it.
*/
#define SCM_FUNC_CAST_ARBITRARY_ARGS SCM (*)()
#else
#define SCM_FUNC_CAST_ARBITRARY_ARGS SCM (*)()
#endif
#if (defined SCM_ALIGNED) && (SCM_DEBUG_TYPING_STRICTNESS <= 1) #if (defined SCM_ALIGNED) && (SCM_DEBUG_TYPING_STRICTNESS <= 1)
/* We support static allocation of some `SCM' objects. */ /* We support static allocation of some `SCM' objects. */