diff options
author | amdmi3 <amdmi3@FreeBSD.org> | 2014-09-05 02:43:58 +0800 |
---|---|---|
committer | amdmi3 <amdmi3@FreeBSD.org> | 2014-09-05 02:43:58 +0800 |
commit | de5d11e700376c2b87e975d85c602d788c0cb09f (patch) | |
tree | 8f1105e9253fb0cbe702fd174b88c9e9a2a4eb41 /science/qcl | |
parent | 52ac31fce57324c3be9e5a33a92d98f518a3ba7b (diff) | |
download | freebsd-ports-gnome-de5d11e700376c2b87e975d85c602d788c0cb09f.tar.gz freebsd-ports-gnome-de5d11e700376c2b87e975d85c602d788c0cb09f.tar.zst freebsd-ports-gnome-de5d11e700376c2b87e975d85c602d788c0cb09f.zip |
- Fix build with clang by using std::vector instead of variable size array of non-POD type
- Fix build with PLOTUTILS enabled, which was broken when built with GCC
Diffstat (limited to 'science/qcl')
-rw-r--r-- | science/qcl/Makefile | 12 | ||||
-rw-r--r-- | science/qcl/files/patch-eval.cc | 15 | ||||
-rw-r--r-- | science/qcl/files/patch-extern.cc | 47 |
3 files changed, 65 insertions, 9 deletions
diff --git a/science/qcl/Makefile b/science/qcl/Makefile index 314286096526..7c756a47e685 100644 --- a/science/qcl/Makefile +++ b/science/qcl/Makefile @@ -12,15 +12,9 @@ COMMENT= Quantum computer simulator LICENSE= GPLv2 # (or later) USES= bison gmake readline tar:tgz -USE_GCC= any - -PLIST_FILES= bin/qcl \ - %%DATADIR%%/default.qcl %%DATADIR%%/deutsch.qcl \ - %%DATADIR%%/dft.qcl %%DATADIR%%/examples.qcl \ - %%DATADIR%%/grover.qcl %%DATADIR%%/linalg.qcl \ - %%DATADIR%%/modarith.qcl %%DATADIR%%/primes.qcl \ - %%DATADIR%%/shor.qcl %%DATADIR%%/test.qcl -PLIST_DIRS= %%DATADIR%% + +PLIST_FILES= bin/qcl +PORTDATA= * OPTIONS_DEFINE= PLOTUTILS diff --git a/science/qcl/files/patch-eval.cc b/science/qcl/files/patch-eval.cc new file mode 100644 index 000000000000..bd25859c7615 --- /dev/null +++ b/science/qcl/files/patch-eval.cc @@ -0,0 +1,15 @@ +--- eval.cc.orig 2014-03-27 17:24:43.000000000 +0400 ++++ eval.cc 2014-09-04 21:33:12.000000000 +0400 +@@ -474,10 +474,10 @@ + void *c; + int i; + int argc=pexpr->n(); +- tValue v[argc]; ++ std::vector<tValue> v(argc); + tInt n[argc]; + tReal r[argc]; +- tComplex z[argc]; ++ std::vector<tComplex> z(argc); + tInt rn; + tReal rr; + TRACE(); diff --git a/science/qcl/files/patch-extern.cc b/science/qcl/files/patch-extern.cc new file mode 100644 index 000000000000..a1de74241609 --- /dev/null +++ b/science/qcl/files/patch-extern.cc @@ -0,0 +1,47 @@ +--- extern.cc.orig 2014-03-27 17:24:43.000000000 +0400 ++++ extern.cc 2014-09-04 21:37:03.000000000 +0400 +@@ -81,7 +81,7 @@ + dim=(1 << n); + if(!loc->getRef(sdec(dim-1,"u%ld")+sdec(dim-1)) || loc->getRef(string("u")+sdec(dim)+sdec(dim))) + EXTERR("illegal register size for matrix operator"); +- tComplex u[dim][dim]; ++ std::vector<std::vector<tComplex> > u(dim, std::vector<tComplex>(dim)); + term* t[dim]; + for(i=0;i<dim;i++) for(j=0;j<dim;j++) { + v=loc->getVal(sdec(j,"u%ld")+sdec(i)); +@@ -190,7 +190,7 @@ + EXTERR("illegal register size for permutation operator"); + int p[dim]; + int pp[dim]; +- term t[dim]; ++ std::vector<term> t(dim); + for(i=0;i<dim;i++) { + v=loc->getVal(sdec(i,"p%ld")); + if(!v.isInt() || v.toInt() < 0 || v.toInt() >= dim) +@@ -207,7 +207,7 @@ + t[i]=term(bitvec(n,p[i]),1); + } + } +- opPermutation(n,t).apply(*q); ++ opPermutation(n,t.data()).apply(*q); + return 0; + } + +@@ -221,7 +221,7 @@ + if(dim!=v.dim()) + EXTERR("illegal register size for permutation operator"); + int p[dim]; +- term t[dim]; ++ std::vector<term> t(dim); + for(i=0;i<dim;i++) p[i]=-1; + for(i=0;i<dim;i++) p[v[i].toInt()]=i; + for(i=0;i<dim;i++) { +@@ -232,7 +232,7 @@ + t[i]=term(bitvec(n,v[i].toInt()),1); + } + } +- opPermutation(n,t).apply(*q); ++ opPermutation(n,t.data()).apply(*q); + return 0; + } + |