[chuck-dev] compiling with gcc -Wparentheses

Steve M. Robbins steve at sumost.ca
Mon Dec 28 17:02:42 EST 2009


Hi again,

On Mon, Dec 28, 2009 at 03:56:55PM -0600, Steve M. Robbins wrote:

> As a first pass to /that/, I looked at warnings generated by
> -Wparentheses.  Below is my patch to avoid these warnings.

By the way, I'd /really/ appreciate it if a chuck developer would look
at these three changes very carefully to make sure I've got the right
semantics:


> diff -u -r ../orig/chuck-1.2.1.3/src/chuck_shell.cpp src/chuck_shell.cpp
> --- ../orig/chuck-1.2.1.3/src/chuck_shell.cpp	2009-10-05 01:09:29.000000000 -0500
> +++ src/chuck_shell.cpp	2009-12-28 15:07:20.000000000 -0600
> @@ -1750,7 +1750,7 @@
>      for( ; i < len; i++ )
>      {
>          vm_no = strtoul( argv[i].c_str(), NULL, 10 );
> -        if( vm_no == 0 && errno == EINVAL || caller->vms.size() <= vm_no || 
> +        if( (vm_no == 0 && errno == EINVAL) || caller->vms.size() <= vm_no || 
>              caller->vms[vm_no] == NULL )
>          {
>              out += "error: invalid VM id: " + argv[i] + "\n";


> diff -u -r ../orig/chuck-1.2.1.3/src/chuck_type.cpp src/chuck_type.cpp
> --- ../orig/chuck-1.2.1.3/src/chuck_type.cpp	2009-10-05 01:09:29.000000000 -0500
> +++ src/chuck_type.cpp	2009-12-28 15:47:21.000000000 -0600
> @@ -4201,9 +4201,8 @@
>  //-----------------------------------------------------------------------------
>  t_CKBOOL type_engine_check_primitive( Chuck_Type * type )
>  {
> -    return ( isa(type, &t_int) || isa(type, &t_float) || isa(type, &t_dur) ||
> -             isa(type, &t_time) ) || isa(type, &t_complex) || isa(type, &t_polar)
> -             && ( type->array_depth == 0 );
> +    return ( isa(type, &t_int) || isa(type, &t_float) || isa(type, &t_dur) || isa(type, &t_time) ) 
> +        || ( ( isa(type, &t_complex) || isa(type, &t_polar) ) && ( type->array_depth == 0 ) );
>  }
>  t_CKBOOL isprim( Chuck_Type * type )
>  {   return type_engine_check_primitive( type ); }


> diff -u -r ../orig/chuck-1.2.1.3/src/ugen_stk.cpp src/ugen_stk.cpp
> --- ../orig/chuck-1.2.1.3/src/ugen_stk.cpp	2009-10-05 01:09:29.000000000 -0500
> +++ src/ugen_stk.cpp	2009-12-28 14:57:37.000000000 -0600
> @@ -15461,8 +15461,9 @@
>      envelope.setTarget( norm * 2.0 );
>    else if (number == __SK_Breath_) // 2
>      blowFreqMod = norm * 0.5;
> -  else if (number == __SK_Sustain_)  // 64
> +  else if (number == __SK_Sustain_) {  // 64
>        if (value < 1.0) subSample = 1;
> +  }
>    else
>      std::cerr << "[chuck](via STK): Whistle: Undefined Control Number (" << number << ")!!" << std::endl;


Thanks,
-Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://lists.cs.princeton.edu/pipermail/chuck-dev/attachments/20091228/c47bd9f1/attachment.bin>


More information about the chuck-dev mailing list