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]

guile-snarf and C++


For the guile-snarf-ed .x files to work w/o g++ compiler warnings when
included from a C++ .cc file, the last argument of SCM_PROC and
SCM_PROC1 macros needs to be cast to a (SCM (*)(...)) otherwise g++ may
give a warning such as:

constraint-primitives.x:3: warning: ANSI C++ prohibits conversion from `(SCM)' to `(...)'

This in no way affects C code;  it just makes it more explicit that the
the argument is a pointer to any kind of function that returns an SCM.

(I do not believe that the C++ language standard will guarantee that the 
pointer to an arbitrary function will work;  in practice with g++ on x86 
it does, and it is better to make the warning disappear, IMO).

Thanks,
Greg


Here is my simple patch to guile-1.3:

--- snarf.h	1999/07/06 19:20:42	1.1
+++ snarf.h	1999/07/06 19:21:39
@@ -55,9 +55,9 @@
 	static char RANAME[]=STR
 #else
 #define SCM_PROC(RANAME, STR, REQ, OPT, VAR, CFN)  \
-%%%	scm_make_gsubr (RANAME, REQ, OPT, VAR, CFN)
+%%%	scm_make_gsubr (RANAME, REQ, OPT, VAR, (SCM (*)(...))CFN)
 #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]