[Openmcl-devel] Re: Helmut Eller's ffigen changes

rm at fabula.de rm at fabula.de
Wed Dec 8 16:51:21 UTC 2004


On Tue, Dec 07, 2004 at 03:01:57PM -0700, Gary Byers wrote:
> 
> 
> On Tue, 7 Dec 2004 rm at fabula.de wrote:
> 
> >
> > BTW, in an other post you mention work on a gcc-3.n based ffigen. Is this
> > in CVS allready?
> >
> 
> Helmut Eller sent mail to this list several months ago, announcing
> that he'd gotten it mostly working in 3.x.  (Unfortunately, the spam
> filter in clozure's mailer tagged his message as spam, and many people
> may have missed it.  His message is at:
> 
> <http://clozure.com/mailman/htdig/openmcl-devel/2004-August/001855.html>
> 
> ).
> 
> I haven't done anything with it; his message arrived during the "Death
> March" phase of my other project, which has since moved on to the
> "Damn It, I'm Too Old For This Kind Of Grueling Schedule" phase.  Some
> other people have said that they've used his changes successfully.

Oh, i know those ...
i just downloaded and compiled Helmut's version. I needed to apply the patches
for "__int128_t" to get i working and i also rewrote h-to-ffi.sh (so we don't
need to use/distribute the gcc include files). Everything seems to work as
expected, but: there seems to be a new version of stdarg.h that causes ffigen
to emit code that OpenMCL can't grok. Here's a sample header file:

--------------------------- test.h --------------------------------------
 #include <stdio.h>
  
  void my_fun (int);
  
-------------------------------------------------------------------------


which will generate 
 
--------------------------- test.i --------------------------------------
 ....

#define __need___va_list
# 1 "/usr/lib/gcc-lib/powerpc-linux/3.3.3/include/stdarg.h" 1 3 4
# 37 "/usr/lib/gcc-lib/powerpc-linux/3.3.3/include/stdarg.h" 3 4
#undef __need___va_list
                                                                                                               
                                                                                                               
                                                                                                               
                                                                                                               
#define __GNUC_VA_LIST
typedef __builtin_va_list __gnuc_va_list;
# 54 "/usr/include/libio.h" 2 3 4
 
 ...
-------------------------------------------------------------------------

which will result in

--------------------------- test.ffi ------------------------------------

 ...

 ("/usr/include/libio.h" 52) "__need___va_list" "")
(undef-macro "__need___va_list")
(macro ("/usr/lib/gcc-lib/powerpc-linux/3.3.3/include/stdarg.h" 42) "__GNUC_VA_LIST" "")
(type ("/usr/lib/gcc-lib/powerpc-linux/3.3.3/include/stdarg.h" 43)
 "__gnuc_va_list"
 (builtin-va-list ()))
(undef-macro "_IO_va_list")

 ...

-------------------------------------------------------------------------


Now, that builtin-va-list seems to come from ffi.c:

 static ffi_primitive_name_map ffi_primitive_names[] =
{
  {"int", "int"},
  {"char", "char"},
  {"float", "float"},
  {"double", "double"},
  {"long double", "long-double"},
  {"void", "void"},
  {"long int", "long"},
  {"unsigned int", "unsigned"},
  {"long unsigned int", "unsigned-long"},
  {"long long int", "long-long"},
  {"long long unsigned int", "unsigned-long-long"},
  {"short int", "short"},
  {"short unsigned int", "unsigned-short"},
  {"signed char", "signed-char"},
  {"unsigned char", "unsigned-char"},
  {"complex int", "complex-int"},
  {"complex float", "complex-float"},
  {"complex double", "complex-double"},
  {"complex long double", "complex-long-double"},
  {"__builtin_va_list", "builtin-va-list"},    <-------------- 
  {"_Bool", "bool"},
  {NULL, NULL}
};

I wasn't able to find any reference to builtin-va-list so far, so maybe someone
on this list can enlighten me? 

 TIA  Ralf Mattes
> >  TIA
> >
> >    RalfD
> >
> >



More information about the Openmcl-devel mailing list