Hi Tom (and everybody) - Great, thanks. I've committed the compiler changes with your review and am awaiting a review of the test/ changes.
Cheers, -michael On 02/24/2014 02:33 PM, Tom Hildebrandt wrote: > Hi Michael: > > The C++ changes look fine to me. I am less familiar with scripts, so I hope > someone else will chime in on that part of the patch. > > You might consider checking this in as two separate pataches anyway, since > the problems fixed in the C++ and script codes are correspondingly distinct. > > THH > ________________________________________ > From: Michael Ferguson [[email protected]] > Sent: Monday, February 24, 2014 11:01 AM > To: chapel-developers > Subject: [Chapel-developers] request for review: portability fixes > > Hi - > > I recently switched to using Debian 7.4 for my Chapel development, > and I discovered: > - gcc 4.7.2 has -Wall enabled warnings about casting away const > - /bin/sh is more POSIX-compilant and doesn't like bash-isms > - /bin/csh is not tcsh and behaves oddly with echo >> somefile > > I've addressed these problems. For the build errors, in most > cases I just made cast-to types include 'const' in the right way, > but in one case I actually added C++'s const_cast. > > The main /bin/sh problem is that [ "a" == "b" ] does not > work; what we want is [ "a" = "b" ] for string comparison > or [ 1 -eq 2 ] for numeric comparison. > > The /bin/csh problems caused me to convert two tests > to using /bin/sh : > test/memory/shannon/outofmemory/sub_test > and lots of tiny scripts in > test/compflags/bradc/printstuff/ > > since the group has been trying to move away from csh. > > Patch below and attached. > > Index: compiler/AST/symbol.cpp > =================================================================== > --- compiler/AST/symbol.cpp (revision 22775) > +++ compiler/AST/symbol.cpp (working copy) > @@ -1800,8 +1800,8 @@ > > > static int compareLineno(const void* v1, const void* v2) { > - FnSymbol* fn1 = *(FnSymbol**)v1; > - FnSymbol* fn2 = *(FnSymbol**)v2; > + FnSymbol* fn1 = *(FnSymbol* const *)v1; > + FnSymbol* fn2 = *(FnSymbol* const *)v2; > if (fn1->linenum() > fn2->linenum()) > return 1; > else if (fn1->linenum() < fn2->linenum()) > Index: compiler/AST/type.cpp > =================================================================== > --- compiler/AST/type.cpp (revision 22775) > +++ compiler/AST/type.cpp (working copy) > @@ -1615,8 +1615,8 @@ > // Compare the cnames of different types alphabetically > static int compareCnames(const void* v1, const void* v2) { > int retval; > - TypeSymbol* t1 = *(TypeSymbol**)v1; > - TypeSymbol* t2 = *(TypeSymbol**)v2; > + TypeSymbol* t1 = *(TypeSymbol* const *)v1; > + TypeSymbol* t2 = *(TypeSymbol* const *)v2; > retval = strcmp(t1->cname, t2->cname); > if (retval > 0) > return 1; > Index: compiler/passes/codegen.cpp > =================================================================== > --- compiler/passes/codegen.cpp (revision 22775) > +++ compiler/passes/codegen.cpp (working copy) > @@ -316,8 +316,8 @@ > > static int > compareSymbol(const void* v1, const void* v2) { > - Symbol* s1 = *(Symbol**)v1; > - Symbol* s2 = *(Symbol**)v2; > + Symbol* s1 = *(Symbol* const *)v1; > + Symbol* s2 = *(Symbol* const *)v2; > ModuleSymbol* m1 = s1->getModule(); > ModuleSymbol* m2 = s2->getModule(); > if (m1 != m2) { > Index: compiler/passes/docs.cpp > =================================================================== > --- compiler/passes/docs.cpp (revision 22775) > +++ compiler/passes/docs.cpp (working copy) > @@ -16,14 +16,14 @@ > int NUMTABS = 0; > > static int compareNames(const void* v1, const void* v2) { > - Symbol* s1 = *(Symbol**)v1; > - Symbol* s2 = *(Symbol**)v2; > + Symbol* s1 = *(Symbol* const *)v1; > + Symbol* s2 = *(Symbol* const *)v2; > return strcmp(s1->name, s2->name); > } > > static int compareClasses(const void *v1, const void* v2) { > - Type *t1 = *(Type**)v1; > - Type *t2 = *(Type**)v2; > + Type *t1 = *(Type* const *)v1; > + Type *t2 = *(Type* const *)v2; > return strcmp(t1->symbol->name, t2->symbol->name); > } > > Index: compiler/optimizations/scalarReplace.cpp > =================================================================== > --- compiler/optimizations/scalarReplace.cpp (revision 22775) > +++ compiler/optimizations/scalarReplace.cpp (working copy) > @@ -68,8 +68,8 @@ > // > static int > compareTypesByOrder(const void* v1, const void* v2) { > - ClassType* ct1 = *(ClassType**)v1; > - ClassType* ct2 = *(ClassType**)v2; > + ClassType* ct1 = *(ClassType* const *)v1; > + ClassType* ct2 = *(ClassType* const *)v2; > int order1 = typeOrder.get(ct1); > int order2 = typeOrder.get(ct2); > if (order1 < order2) > Index: compiler/util/stringutil.cpp > =================================================================== > --- compiler/util/stringutil.cpp (revision 22775) > +++ compiler/util/stringutil.cpp (working copy) > @@ -92,7 +92,7 @@ > Vec<const char*> keys; > chapelStringsTable.get_keys(keys); > forv_Vec(const char, key, keys) { > - free((void*)key); > + free(const_cast<char*>(key)); > } > } > > Index: test/compflags/bradc/printstuff/versionhelp.csh > =================================================================== > --- test/compflags/bradc/printstuff/versionhelp.csh (revision 22775) > +++ test/compflags/bradc/printstuff/versionhelp.csh (working copy) > @@ -1,6 +0,0 @@ > -#!/bin/csh -f > -set compiler = $3 > -echo -n `basename $compiler` > -cat version.goodstart > -diff ../../../../compiler/main/BUILD_VERSION ./zero.txt >& /dev/null && echo > "" || (echo -n "." && cat ../../../../compiler/main/BUILD_VERSION) > - > Index: test/compflags/bradc/printstuff/zcopylice.prediff > =================================================================== > --- test/compflags/bradc/printstuff/zcopylice.prediff (revision 22775) > +++ test/compflags/bradc/printstuff/zcopylice.prediff (working copy) > @@ -1,2 +1,2 @@ > -#!/bin/csh -f > -./licensehelp.csh $1 $2 $3 > zcopylice.good > +#!/bin/sh > +./licensehelp.sh $1 $2 $3 > zcopylice.good > Index: test/compflags/bradc/printstuff/zall.prediff > =================================================================== > --- test/compflags/bradc/printstuff/zall.prediff (revision 22775) > +++ test/compflags/bradc/printstuff/zall.prediff (working copy) > @@ -1,5 +1,6 @@ > -#!/bin/csh -f > -./versionhelp.csh $1 $2 $3 > zall.good > -./licensehelp.csh $1 $2 $3 >> zall.good > +#!/bin/sh > +./versionhelp.sh $1 $2 $3 > zall.good > +./licensehelp.sh $1 $2 $3 >> zall.good > +#echo >> zall.good This version does not result in a newline on Debian 7.4's > csh > echo >> zall.good > -./helphelp.csh $1 $2 $3 >> zall.good > +./helphelp.sh $1 $2 $3 >> zall.good > Index: test/compflags/bradc/printstuff/zcopyvers.prediff > =================================================================== > --- test/compflags/bradc/printstuff/zcopyvers.prediff (revision 22775) > +++ test/compflags/bradc/printstuff/zcopyvers.prediff (working copy) > @@ -1,3 +1,3 @@ > -#!/bin/csh -f > -./versionhelp.csh $1 $2 $3 > zcopyvers.good > -./copyrighthelp.csh $1 $2 $3 >> zcopyvers.good > +#!/bin/sh > +./versionhelp.sh $1 $2 $3 > zcopyvers.good > +./copyrighthelp.sh $1 $2 $3 >> zcopyvers.good > Index: test/compflags/bradc/printstuff/copyrighthelp.sh > =================================================================== > --- test/compflags/bradc/printstuff/copyrighthelp.sh (revision 22775) > +++ test/compflags/bradc/printstuff/copyrighthelp.sh (working copy) > @@ -1,2 +1,2 @@ > -#!/bin/csh -f > +#!/bin/sh > cat ../../../../COPYRIGHT > Index: test/compflags/bradc/printstuff/zhelplice.prediff > =================================================================== > --- test/compflags/bradc/printstuff/zhelplice.prediff (revision 22775) > +++ test/compflags/bradc/printstuff/zhelplice.prediff (working copy) > @@ -1,4 +1,4 @@ > -#!/bin/csh -f > -./licensehelp.csh $1 $2 $3 > zhelplice.good > +#!/bin/sh > +./licensehelp.sh $1 $2 $3 > zhelplice.good > echo >> zhelplice.good > -./helphelp.csh $1 $2 $3 >> zhelplice.good > +./helphelp.sh $1 $2 $3 >> zhelplice.good > Index: test/compflags/bradc/printstuff/copyrighthelp.csh > =================================================================== > --- test/compflags/bradc/printstuff/copyrighthelp.csh (revision 22775) > +++ test/compflags/bradc/printstuff/copyrighthelp.csh (working copy) > @@ -1,2 +0,0 @@ > -#!/bin/csh -f > -cat ../../../../COPYRIGHT > Index: test/compflags/bradc/printstuff/zhelpvers.prediff > =================================================================== > --- test/compflags/bradc/printstuff/zhelpvers.prediff (revision 22775) > +++ test/compflags/bradc/printstuff/zhelpvers.prediff (working copy) > @@ -1,5 +1,5 @@ > -#!/bin/csh -f > -./versionhelp.csh $1 $2 $3 > zhelpvers.good > -./copyrighthelp.csh $1 $2 $3 >> zhelpvers.good > +#!/bin/sh > +./versionhelp.sh $1 $2 $3 > zhelpvers.good > +./copyrighthelp.sh $1 $2 $3 >> zhelpvers.good > echo >> zhelpvers.good > -./helphelp.csh $1 $2 $3 >> zhelpvers.good > +./helphelp.sh $1 $2 $3 >> zhelpvers.good > Index: test/compflags/bradc/printstuff/version.prediff > =================================================================== > --- test/compflags/bradc/printstuff/version.prediff (revision 22775) > +++ test/compflags/bradc/printstuff/version.prediff (working copy) > @@ -1,4 +1,4 @@ > -#!/bin/csh -f > -./versionhelp.csh $1 $2 $3 > version.good > -./copyrighthelp.csh $1 $2 $3 >> version.good > +#!/bin/sh > +./versionhelp.sh $1 $2 $3 > version.good > +./copyrighthelp.sh $1 $2 $3 >> version.good > > Index: test/compflags/bradc/printstuff/licensehelp.sh > =================================================================== > --- test/compflags/bradc/printstuff/licensehelp.sh (revision 22775) > +++ test/compflags/bradc/printstuff/licensehelp.sh (working copy) > @@ -1,2 +1,2 @@ > -#!/bin/csh -f > +#!/bin/sh > cat ../../../../LICENSE > Index: test/compflags/bradc/printstuff/versionhelp.sh > =================================================================== > --- test/compflags/bradc/printstuff/versionhelp.sh (revision 22775) > +++ test/compflags/bradc/printstuff/versionhelp.sh (working copy) > @@ -1,6 +1,6 @@ > -#!/bin/csh -f > -set compiler = $3 > +#!/bin/sh > +compiler=$3 > echo -n `basename $compiler` > cat version.goodstart > -diff ../../../../compiler/main/BUILD_VERSION ./zero.txt >& /dev/null && echo > "" || (echo -n "." && cat ../../../../compiler/main/BUILD_VERSION) > +diff ../../../../compiler/main/BUILD_VERSION ./zero.txt > /dev/null 2>&1 && > echo "" || (echo -n "." && cat ../../../../compiler/main/BUILD_VERSION) > > Index: test/compflags/bradc/printstuff/licensehelp.csh > =================================================================== > --- test/compflags/bradc/printstuff/licensehelp.csh (revision 22775) > +++ test/compflags/bradc/printstuff/licensehelp.csh (working copy) > @@ -1,2 +0,0 @@ > -#!/bin/csh -f > -cat ../../../../LICENSE > Index: test/compflags/bradc/printstuff/helphelp.sh > =================================================================== > --- test/compflags/bradc/printstuff/helphelp.sh (revision 22775) > +++ test/compflags/bradc/printstuff/helphelp.sh (working copy) > @@ -1,2 +1,2 @@ > -#!/bin/csh -f > +#!/bin/sh > cat ../help/userhelp.good > Index: test/compflags/bradc/printstuff/helphelp.csh > =================================================================== > --- test/compflags/bradc/printstuff/helphelp.csh (revision 22775) > +++ test/compflags/bradc/printstuff/helphelp.csh (working copy) > @@ -1,2 +0,0 @@ > -#!/bin/csh -f > -cat ../help/userhelp.good > Index: test/compflags/bradc/printstuff/zlicevers.prediff > =================================================================== > --- test/compflags/bradc/printstuff/zlicevers.prediff (revision 22775) > +++ test/compflags/bradc/printstuff/zlicevers.prediff (working copy) > @@ -1,3 +1,3 @@ > -#!/bin/csh -f > -./versionhelp.csh $1 $2 $3 > zlicevers.good > -./licensehelp.csh $1 $2 $3 >> zlicevers.good > +#!/bin/sh > +./versionhelp.sh $1 $2 $3 > zlicevers.good > +./licensehelp.sh $1 $2 $3 >> zlicevers.good > Index: test/compflags/bradc/printstuff/copyright.prediff > =================================================================== > --- test/compflags/bradc/printstuff/copyright.prediff (revision 22775) > +++ test/compflags/bradc/printstuff/copyright.prediff (working copy) > @@ -1,3 +1,3 @@ > -#!/bin/csh -f > -./copyrighthelp.csh $1 $2 $3 > copyright.good > -echo "Hello, Merl\!" >> copyright.good > +#!/bin/sh > +./copyrighthelp.sh $1 $2 $3 > copyright.good > +echo "Hello, Merl!" >> copyright.good > Index: test/compflags/bradc/printstuff/zcopyhelp.prediff > =================================================================== > --- test/compflags/bradc/printstuff/zcopyhelp.prediff (revision 22775) > +++ test/compflags/bradc/printstuff/zcopyhelp.prediff (working copy) > @@ -1,4 +1,4 @@ > -#!/bin/csh -f > -./copyrighthelp.csh $1 $2 $3 > zcopyhelp.good > +#!/bin/sh > +./copyrighthelp.sh $1 $2 $3 > zcopyhelp.good > echo >> zcopyhelp.good > -./helphelp.csh $1 $2 $3 >> zcopyhelp.good > +./helphelp.sh $1 $2 $3 >> zcopyhelp.good > Index: test/compflags/bradc/printstuff/license.prediff > =================================================================== > --- test/compflags/bradc/printstuff/license.prediff (revision 22775) > +++ test/compflags/bradc/printstuff/license.prediff (working copy) > @@ -1,2 +1,2 @@ > -#!/bin/csh -f > -./licensehelp.csh $1 $2 $3 > license.good > +#!/bin/sh > +./licensehelp.sh $1 $2 $3 > license.good > Index: test/io/ferguson/readThis/readclass4.prediff > =================================================================== > --- test/io/ferguson/readThis/readclass4.prediff (revision 22775) > +++ test/io/ferguson/readThis/readclass4.prediff (working copy) > @@ -4,7 +4,7 @@ > outfile=$2 > > grep -i error $outfile > $outfile.2 > -if [ $? == 0 ] > +if [ $? -eq 0 ] > then > echo CompileError > $outfile.2 > mv $outfile.2 $outfile > Index: test/chpldoc/module/PREDIFF > =================================================================== > --- test/chpldoc/module/PREDIFF (revision 22775) > +++ test/chpldoc/module/PREDIFF (working copy) > @@ -2,7 +2,7 @@ > > chplCompiler=`basename $3` > > -if [ "$chplCompiler" == "chpldoc" ]; > +if [ "$chplCompiler" = "chpldoc" ]; > then > cat $1.doc.out > $1.good > else > Index: test/chpldoc/PREDIFF > =================================================================== > --- test/chpldoc/PREDIFF (revision 22775) > +++ test/chpldoc/PREDIFF (working copy) > @@ -2,7 +2,7 @@ > > chplCompiler=`basename $3` > > -if [ "$chplCompiler" == "chpldoc" ]; > +if [ "$chplCompiler" = "chpldoc" ]; > then > cat $1.doc.out > $1.good > else > Index: test/memory/shannon/outofmemory/sub_test > =================================================================== > --- test/memory/shannon/outofmemory/sub_test (revision 22775) > +++ test/memory/shannon/outofmemory/sub_test (working copy) > @@ -1,6 +1,6 @@ > -#!/bin/csh -f > +#!/bin/bash > > -limit vmemoryuse 256M > +# Set virtual memory limit > +ulimit -v 262144 > > ../../../../util/test/sub_test $1 > - > ------------------------------------------------------------------------------ Flow-based real-time traffic analytics software. Cisco certified tool. Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer Customize your own dashboards, set traffic alerts and generate reports. Network behavioral analysis & security monitoring. All-in-one tool. http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk _______________________________________________ Chapel-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/chapel-developers
