Skip to content

Commit

Permalink
stricter compiler flags
Browse files Browse the repository at this point in the history
  • Loading branch information
jhanna-kx committed Oct 26, 2018
1 parent 0b02c03 commit 85de8fc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion py.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions py.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 85de8fc

Please sign in to comment.