Make compilable with g++, not just gcc (fixes Gentoo build issue).

git-svn-id: http://llvm-py.googlecode.com/svn/trunk@57 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
mdevan.foobar 2008-12-22 17:39:39 +00:00
commit 2190cb045c
3 changed files with 84 additions and 19 deletions

View file

@ -382,10 +382,10 @@ _wrap_objobj2obj(LLVMConstAnd, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_objobj2obj(LLVMConstOr, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_objobj2obj(LLVMConstXor, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_intobjobj2obj(LLVMConstICmp, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_intobjobj2obj(LLVMConstFCmp, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_intobjobj2obj(LLVMConstVICmp, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_intobjobj2obj(LLVMConstVFCmp, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_enumobjobj2obj(LLVMConstICmp, LLVMIntPredicate, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_enumobjobj2obj(LLVMConstFCmp, LLVMRealPredicate, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_enumobjobj2obj(LLVMConstVICmp, LLVMIntPredicate, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_enumobjobj2obj(LLVMConstVFCmp, LLVMRealPredicate, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_objobj2obj(LLVMConstShl, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_objobj2obj(LLVMConstLShr, LLVMValueRef, LLVMValueRef, LLVMValueRef)
@ -418,11 +418,11 @@ _wrap_objobjobj2obj(LLVMConstShuffleVector, LLVMValueRef, LLVMValueRef, LLVMValu
_wrap_obj2obj(LLVMGetGlobalParent, LLVMValueRef, LLVMModuleRef)
_wrap_obj2obj(LLVMIsDeclaration, LLVMValueRef, int)
_wrap_obj2obj(LLVMGetLinkage, LLVMValueRef, int)
_wrap_objint2none(LLVMSetLinkage, LLVMValueRef)
_wrap_objenum2none(LLVMSetLinkage, LLVMValueRef, LLVMLinkage)
_wrap_obj2str(LLVMGetSection, LLVMValueRef)
_wrap_objstr2none(LLVMSetSection, LLVMValueRef)
_wrap_obj2obj(LLVMGetVisibility, LLVMValueRef, int)
_wrap_objint2none(LLVMSetVisibility, LLVMValueRef)
_wrap_objenum2none(LLVMSetVisibility, LLVMValueRef, LLVMVisibility)
_wrap_obj2obj(LLVMGetAlignment, LLVMValueRef, int)
_wrap_objint2none(LLVMSetAlignment, LLVMValueRef)
@ -474,9 +474,9 @@ _wrap_obj2obj(LLVMCountParams, LLVMValueRef, int)
_wrap_obj2obj(LLVMGetFirstParam, LLVMValueRef, LLVMValueRef)
_wrap_obj2obj(LLVMGetNextParam, LLVMValueRef, LLVMValueRef)
_wrap_obj2obj(LLVMGetParamParent, LLVMValueRef, LLVMValueRef)
_wrap_objint2none(LLVMAddAttribute, LLVMValueRef)
_wrap_objint2none(LLVMRemoveAttribute, LLVMValueRef)
_wrap_objint2none(LLVMSetParamAlignment, LLVMValueRef)
_wrap_objenum2none(LLVMAddAttribute, LLVMValueRef, LLVMAttribute)
_wrap_objenum2none(LLVMRemoveAttribute, LLVMValueRef, LLVMAttribute)
_wrap_objenum2none(LLVMSetParamAlignment, LLVMValueRef, LLVMAttribute)
/*===-- Basic Blocks -----------------------------------------------------===*/
@ -511,8 +511,8 @@ _wrap_obj2str(LLVMInstGetOpcodeName, LLVMValueRef)
_wrap_objint2none(LLVMSetInstructionCallConv, LLVMValueRef)
_wrap_obj2obj(LLVMGetInstructionCallConv, LLVMValueRef, int)
_wrap_objintint2none(LLVMAddInstrAttribute, LLVMValueRef)
_wrap_objintint2none(LLVMRemoveInstrAttribute, LLVMValueRef)
_wrap_objintenum2none(LLVMAddInstrAttribute, LLVMValueRef, LLVMAttribute)
_wrap_objintenum2none(LLVMRemoveInstrAttribute, LLVMValueRef, LLVMAttribute)
_wrap_objintint2none(LLVMSetInstrParamAlignment, LLVMValueRef)
/*===-- PHI Nodes --------------------------------------------------------===*/
@ -630,10 +630,10 @@ _wrap_objobjobjstr2obj(LLVMBuildBitCast, LLVMBuilderRef, LLVMValueRef, LLVMTypeR
/* Comparisons */
_wrap_objintobjobjstr2obj(LLVMBuildICmp, LLVMBuilderRef, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_objintobjobjstr2obj(LLVMBuildFCmp, LLVMBuilderRef, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_objintobjobjstr2obj(LLVMBuildVICmp, LLVMBuilderRef, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_objintobjobjstr2obj(LLVMBuildVFCmp, LLVMBuilderRef, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_objenumobjobjstr2obj(LLVMBuildICmp, LLVMBuilderRef, LLVMIntPredicate, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_objenumobjobjstr2obj(LLVMBuildFCmp, LLVMBuilderRef, LLVMRealPredicate, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_objenumobjobjstr2obj(LLVMBuildVICmp, LLVMBuilderRef, LLVMIntPredicate, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_objenumobjobjstr2obj(LLVMBuildVFCmp, LLVMBuilderRef, LLVMRealPredicate, LLVMValueRef, LLVMValueRef, LLVMValueRef)
/* Miscellaneous instructions */

View file

@ -100,7 +100,7 @@ void **make_array_from_list(PyObject *list, int n)
PyObject *make_list_from_LLVMTypeRef_array(LLVMTypeRef *p, unsigned n)
{
int i;
size_t i;
PyObject *list = PyList_New(n);
if (!list)

View file

@ -278,6 +278,28 @@ _w ## func (PyObject *self, PyObject *args) \
return ctor_ ## outtype ( func (arg1, arg2, arg3)); \
}
/**
* Wrap LLVM functions of the type
* outtype func(enum_intype1 arg1, intype2 arg2, intype3 arg3)
*/
#define _wrap_enumobjobj2obj(func, intype1, intype2, intype3, outtype) \
static PyObject * \
_w ## func (PyObject *self, PyObject *args) \
{ \
intype1 arg1; \
PyObject *obj2, *obj3; \
intype2 arg2; \
intype3 arg3; \
\
if (!PyArg_ParseTuple(args, "IOO", &arg1, &obj2, &obj3)) \
return NULL; \
\
arg2 = ( intype2 ) PyCObject_AsVoidPtr(obj2); \
arg3 = ( intype3 ) PyCObject_AsVoidPtr(obj3); \
\
return ctor_ ## outtype ( func (arg1, arg2, arg3)); \
}
/**
* Wrap LLVM functions of the type
* outtype func(const char *s)
@ -403,6 +425,27 @@ _w ## func (PyObject *self, PyObject *args) \
Py_RETURN_NONE; \
}
/**
* Wrap LLVM functions of the type
* void func(intype1 arg1, enum_intype2 arg2)
*/
#define _wrap_objenum2none(func, intype1, intype2) \
static PyObject * \
_w ## func (PyObject *self, PyObject *args) \
{ \
PyObject *obj1; \
intype1 arg1; \
intype2 arg2; \
\
if (!PyArg_ParseTuple(args, "Oi", &obj1, &arg2)) \
return NULL; \
\
arg1 = ( intype1 ) PyCObject_AsVoidPtr(obj1); \
\
func (arg1, arg2); \
Py_RETURN_NONE; \
}
/**
* Wrap LLVM functions of the type
* outtype func(intype1 arg1, intype2 arg2, const char *arg3)
@ -446,6 +489,28 @@ _w ## func (PyObject *self, PyObject *args) \
Py_RETURN_NONE; \
}
/**
* Wrap LLVM functions of the type
* void func(intype1 arg1, <unsigned/signed int> arg2, enum_intype3 arg3)
*/
#define _wrap_objintenum2none(func, intype1, intype3) \
static PyObject * \
_w ## func (PyObject *self, PyObject *args) \
{ \
PyObject *obj1; \
intype1 arg1; \
int arg2; \
intype3 arg3; \
\
if (!PyArg_ParseTuple(args, "Oii", &obj1, &arg2, &arg3)) \
return NULL; \
\
arg1 = ( intype1 ) PyCObject_AsVoidPtr(obj1); \
\
func (arg1, arg2, arg3); \
Py_RETURN_NONE; \
}
/**
* Wrap LLVM functions of the type
* outtype func(intype1 arg1, const char *arg2, intype3 arg3)
@ -593,15 +658,15 @@ _w ## func (PyObject *self, PyObject *args) \
/**
* Wrap LLVM functions of the type
* outtype func(intype1 arg1, int arg2, intype3 arg3, intype4 arg4, const char *arg5)
* outtype func(intype1 arg1, enum_intype2 arg2, intype3 arg3, intype4 arg4, const char *arg5)
*/
#define _wrap_objintobjobjstr2obj(func, intype1, intype3, intype4, outtype) \
#define _wrap_objenumobjobjstr2obj(func, intype1, intype2, intype3, intype4, outtype) \
static PyObject * \
_w ## func (PyObject *self, PyObject *args) \
{ \
PyObject *obj1, *obj3, *obj4; \
intype1 arg1; \
int arg2; \
intype2 arg2; \
intype3 arg3; \
intype4 arg4; \
const char *arg5; \