Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Sep 2014 18:43:58 +0000 (UTC)
From:      Dmitry Marakasov <amdmi3@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r367304 - in head/science/qcl: . files
Message-ID:  <201409041843.s84IhwYr083013@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: amdmi3
Date: Thu Sep  4 18:43:58 2014
New Revision: 367304
URL: http://svnweb.freebsd.org/changeset/ports/367304
QAT: https://qat.redports.org/buildarchive/r367304/

Log:
  - 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

Added:
  head/science/qcl/files/patch-eval.cc   (contents, props changed)
  head/science/qcl/files/patch-extern.cc   (contents, props changed)
Modified:
  head/science/qcl/Makefile

Modified: head/science/qcl/Makefile
==============================================================================
--- head/science/qcl/Makefile	Thu Sep  4 18:35:10 2014	(r367303)
+++ head/science/qcl/Makefile	Thu Sep  4 18:43:58 2014	(r367304)
@@ -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
 

Added: head/science/qcl/files/patch-eval.cc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/science/qcl/files/patch-eval.cc	Thu Sep  4 18:43:58 2014	(r367304)
@@ -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();

Added: head/science/qcl/files/patch-extern.cc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/science/qcl/files/patch-extern.cc	Thu Sep  4 18:43:58 2014	(r367304)
@@ -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;
+ }
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409041843.s84IhwYr083013>