This is the mail archive of the guile@cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Better patch to snarf.h


The below is a better patch to snarf.h that uses the cast iff a C++
compiler is used to run guile-snarf or GUILE_CPLUSPLUS_SNARF is defined.
Then the rule to build .x from .cc (C++) files in a Makefile.am can do
something like:

%.x: %.cc
	CC=$(CXX) \
	guile-snarf -DGUILE_CPLUSPLUS_SNARF $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) $< > $@

and the snarfer will work on C++ code fine.

Thanks,
Greg

ChangeLog Entry:

Thu Jul  8 12:20:02 1999  Greg Badros  <gjb@cs.washington.edu>

* snarf.h: Use __cplusplus or GUILE_CPLUSPLUS_SNARF macros to force
adding a cast to the last (function pointer) argument to
scm_make_gsubr(..) calls.  This avoids warnings in C++ programs using
guile-snarf.

--- snarf.h	1999/07/06 19:20:42	1.1
+++ snarf.h	1999/07/08 18:53:59
@@ -54,10 +54,15 @@
 #define SCM_PROC1(RANAME, STR, TYPE, CFN)  \
 	static char RANAME[]=STR
 #else
+#if defined(__cplusplus) || defined(GUILE_CPLUSPLUS_SNARF)
+#define SCM_PROC(RANAME, STR, REQ, OPT, VAR, CFN)  \
+%%%	scm_make_gsubr (RANAME, REQ, OPT, VAR, (SCM (*)(...))CFN)
+#else
 #define SCM_PROC(RANAME, STR, REQ, OPT, VAR, CFN)  \
 %%%	scm_make_gsubr (RANAME, REQ, OPT, VAR, CFN)
+#endif
 #define SCM_PROC1(RANAME, STR, TYPE, CFN)  \
-%%%	scm_make_subr(RANAME, TYPE, CFN)
+%%%	scm_make_subr(RANAME, TYPE, (SCM (*)(...))CFN)
 #endif
 
 #ifndef SCM_MAGIC_SNARFER

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]