diff --git a/makefile b/makefile index 55ff4a8..9f9b04b 100644 --- a/makefile +++ b/makefile @@ -1,4 +1,4 @@ -CFLAGS=-ggdb3 -O2 -Wno-pointer-sign -Wno-parentheses +CFLAGS=-ggdb3 -O2 -Wno-pointer-sign -Wno-parentheses -Wextra -Werror -Wsign-compare -Wwrite-strings ifeq ($(shell uname),Linux) LDFLAGS=-fPIC -shared QLIBDIR=l64 diff --git a/py.c b/py.c index 8aca695..e20ca1e 100644 --- a/py.c +++ b/py.c @@ -6,7 +6,7 @@ ZV*t1(){R PyEval_SaveThread();}ZV t0(V*t){PyEval_RestoreThread(t);}ZP M;ZV**N;ZP ZP p1(P p){Py_IncRef(p);R p;}ZV p0(P p){Py_DecRef(p);}ZI pt(P p,P t){P u=PyObject_Type(p);I f;f=(u==t||PyType_IsSubtype(u,t));p0(u);R f;} ZP pg(K x){R(P)(kK(x)[1]);}ZV pd(K x){I g=g1();p0(pg(x));g0(g);}ZK kfp(P p){K x=knk(2,pd,p);R xt=112,x;}ZI pq(K x){R xt==112&&xn==2&&*kK(x)==(K)pd;} ZK kfg(P p){R PyCapsule_GetPointer(p,"k");}ZV kfd(P p){r0(kfg(p));}ZP pfk(K x){R PyCapsule_New(r1(x),"k",kfd);} -ZK prr(S s){ZC __thread b[4096];J n=sizeof(b)-1;P t,v,d,a;*b=0;strncat(b,s,n);PyErr_Fetch(&t,&v,&d);if(t){PyErr_NormalizeException(&t,&v,&d); +ZK prr(S s){Z __thread C b[4096];J n=sizeof(b)-1;P t,v,d,a;*b=0;strncat(b,s,n);PyErr_Fetch(&t,&v,&d);if(t){PyErr_NormalizeException(&t,&v,&d); strncat(strncat(b,": ",n),PyUnicode_AsUTF8AndSize(a=PyObject_Str(v),0),n);p0(a);p0(t);p0(v);p0(d);}R krr(b);}ZK prg(S s,I g){K r=prr(s);g0(g);R r;} ZK ko(P);ZK cf;//k from python diff --git a/py.h b/py.h index 9ede435..737bbb8 100644 --- a/py.h +++ b/py.h @@ -116,3 +116,9 @@ ZI pyn(V**v){ #define X(r,n,a,i) U(n=(T##n(*)a)v[i]) NF R 1;} +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wincompatible-pointer-types-discards-qualifiers" +#pragma clang diagnostic ignored "-Wunused-parameter" +#elif __GNUC__ +#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers" +#endif