summaryrefslogtreecommitdiff
path: root/libguile
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2011-02-13 14:50:05 +0100
committerLudovic Courtès <ludo@gnu.org>2011-02-13 14:50:05 +0100
commitbe90d0b6f9e79bc882b2289bf0a5ea1b3c082b3c (patch)
tree949a3caa5a82ea2dc9d37cdee6211d8ac2632a0c /libguile
parent10b9343f04ce8ed245b8d4316805909d2821d5b1 (diff)
downloadguile-be90d0b6f9e79bc882b2289bf0a5ea1b3c082b3c.tar.gz
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.
Diffstat (limited to 'libguile')
-rw-r--r--libguile/__scm.h16
-rw-r--r--libguile/deprecated.h7
-rw-r--r--libguile/gsubr.h15
-rw-r--r--libguile/smob.h7
-rw-r--r--libguile/snarf.h14
5 files changed, 35 insertions, 24 deletions
diff --git a/libguile/__scm.h b/libguile/__scm.h
index efdab6d67..2bfb4f694 100644
--- a/libguile/__scm.h
+++ b/libguile/__scm.h
@@ -3,7 +3,8 @@
#ifndef 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
* modify it under the terms of the GNU Lesser General Public License
@@ -424,6 +425,19 @@
#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
# ifndef CHEAP_CONTINUATIONS
diff --git a/libguile/deprecated.h b/libguile/deprecated.h
index 68aee6362..7deee359a 100644
--- a/libguile/deprecated.h
+++ b/libguile/deprecated.h
@@ -133,12 +133,12 @@ SCM_DEPRECATED SCM scm_internal_with_fluids (SCM fluids, SCM vals,
SCM_DEPRECATED SCM scm_make_gsubr (const char *name,
int req, int opt, int rst,
- SCM (*fcn)());
+ scm_t_subr fcn);
SCM_DEPRECATED SCM scm_make_gsubr_with_generic (const char *name,
int req,
int opt,
int rst,
- SCM (*fcn)(),
+ scm_t_subr fcn,
SCM *gf);
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
-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);
SCM_DEPRECATED long scm_make_smob_type_mfpe (char *name, size_t size,
diff --git a/libguile/gsubr.h b/libguile/gsubr.h
index faa4bb0d4..5adffa4fe 100644
--- a/libguile/gsubr.h
+++ b/libguile/gsubr.h
@@ -3,7 +3,8 @@
#ifndef 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
* 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,
- int req, int opt, int rst, SCM (*fcn) ());
+SCM_API SCM scm_c_make_gsubr (const char *name,
+ int req, int opt, int rst, scm_t_subr fcn);
SCM_API SCM scm_c_make_gsubr_with_generic (const char *name,
int req, int opt, int rst,
- SCM (*fcn) (), SCM *gf);
-SCM_API SCM scm_c_define_gsubr (const char *name,
- int req, int opt, int rst, SCM (*fcn) ());
+ scm_t_subr fcn, SCM *gf);
+SCM_API SCM scm_c_define_gsubr (const char *name,
+ int req, int opt, int rst, scm_t_subr fcn);
SCM_API SCM scm_c_define_gsubr_with_generic (const char *name,
int req, int opt, int rst,
- SCM (*fcn) (), SCM *gf);
+ scm_t_subr fcn, SCM *gf);
SCM_INTERNAL void scm_init_gsubr (void);
diff --git a/libguile/smob.h b/libguile/smob.h
index 07deebd27..6a7ceeae6 100644
--- a/libguile/smob.h
+++ b/libguile/smob.h
@@ -3,7 +3,8 @@
#ifndef 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
* 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);
int (*print) (SCM exp, SCM port, scm_print_state *pstate);
SCM (*equalp) (SCM, SCM);
- SCM (*apply) ();
+ scm_t_subr apply;
SCM apply_trampoline_objcode;
} 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*));
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 (*apply) (),
+ scm_t_subr apply,
unsigned int req,
unsigned int opt,
unsigned int rst);
diff --git a/libguile/snarf.h b/libguile/snarf.h
index fcd017346..9bb998eb0 100644
--- a/libguile/snarf.h
+++ b/libguile/snarf.h
@@ -3,7 +3,8 @@
#ifndef 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
* modify it under the terms of the GNU Lesser General Public License
@@ -25,16 +26,9 @@
/* 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)
/* We support static allocation of some `SCM' objects. */