Re: [Mesa-dev] [PATCH 5/6] i965: Silence unused parameter warning

2015-03-04 Thread Ian Romanick
On 02/28/2015 10:33 AM, Ilia Mirkin wrote:
 On Sat, Feb 28, 2015 at 1:26 PM, Carl Worth cwo...@cworth.org wrote:
 On Fri, Feb 27 2015, Ian Romanick wrote:
 All dd functions take a gl_context as the first parameter.  Instead of
 removing it, just silence the warning.

 For code using gcc, I really prefer the __attribute__((__unused__))
 style, (though, obviously hidden in a reasonable looking macro). That
 results in cleaner looking code than these weird unused expressions
 being cast to void.
 
 Another clean alternative is to leave the name of the variable out, i.e.
 
 function(struct gl_context *)
 
 instead of
 
 function(struct gl_context *foo)

I use that method a lot because it makes the intention very obvious,
but, as others have mentioned, it's only available in C++.

 Does MSVC have an equivalent? Or, does it not emit the warning in the
 first place such that we could just define the macro as empty outside of
 gcc?

 So there's room for investigation here. In the meantime:

 Reviewed-by: Carl Worth cwo...@cworth.org

 -Carl

 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 5/6] i965: Silence unused parameter warning

2015-02-28 Thread Carl Worth
On Fri, Feb 27 2015, Ian Romanick wrote:
 All dd functions take a gl_context as the first parameter.  Instead of
 removing it, just silence the warning.

For code using gcc, I really prefer the __attribute__((__unused__))
style, (though, obviously hidden in a reasonable looking macro). That
results in cleaner looking code than these weird unused expressions
being cast to void.

Does MSVC have an equivalent? Or, does it not emit the warning in the
first place such that we could just define the macro as empty outside of
gcc?

So there's room for investigation here. In the meantime:

Reviewed-by: Carl Worth cwo...@cworth.org

-Carl


pgpSkpdVeZKDc.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 5/6] i965: Silence unused parameter warning

2015-02-28 Thread Ilia Mirkin
On Sat, Feb 28, 2015 at 1:51 PM, Jan Vesely jan.ves...@rutgers.edu wrote:
 On Sat, 2015-02-28 at 10:39 -0800, Carl Worth wrote:
 On Sat, Feb 28 2015, Ilia Mirkin wrote:
  Another clean alternative is to leave the name of the variable out, i.e.
 
  function(struct gl_context *)

 Wow. Less is more! I hadn't realized that's a solution for this, but
 it's really elegant.

 and it's also illegal in C (only allowed in C++)
 see 6.9.1 of c specs

Yeah... that's unfortunate. Come to think of it, did I only see this
in C++ code? Perhaps with gcc it works anyways? (Too lazy to test...)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 5/6] i965: Silence unused parameter warning

2015-02-28 Thread Jan Vesely
On Sat, 2015-02-28 at 10:39 -0800, Carl Worth wrote:
 On Sat, Feb 28 2015, Ilia Mirkin wrote:
  Another clean alternative is to leave the name of the variable out, i.e.
 
  function(struct gl_context *)
 
 Wow. Less is more! I hadn't realized that's a solution for this, but
 it's really elegant.

and it's also illegal in C (only allowed in C++)
see 6.9.1 of c specs

jan

 
 -Carl
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev

-- 
Jan Vesely jan.ves...@rutgers.edu


signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 5/6] i965: Silence unused parameter warning

2015-02-28 Thread Carl Worth
On Sat, Feb 28 2015, Ilia Mirkin wrote:
 Another clean alternative is to leave the name of the variable out, i.e.

 function(struct gl_context *)

Wow. Less is more! I hadn't realized that's a solution for this, but
it's really elegant.

-Carl


pgpHapVflSAmW.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 5/6] i965: Silence unused parameter warning

2015-02-28 Thread Ilia Mirkin
On Sat, Feb 28, 2015 at 1:26 PM, Carl Worth cwo...@cworth.org wrote:
 On Fri, Feb 27 2015, Ian Romanick wrote:
 All dd functions take a gl_context as the first parameter.  Instead of
 removing it, just silence the warning.

 For code using gcc, I really prefer the __attribute__((__unused__))
 style, (though, obviously hidden in a reasonable looking macro). That
 results in cleaner looking code than these weird unused expressions
 being cast to void.

Another clean alternative is to leave the name of the variable out, i.e.

function(struct gl_context *)

instead of

function(struct gl_context *foo)


 Does MSVC have an equivalent? Or, does it not emit the warning in the
 first place such that we could just define the macro as empty outside of
 gcc?

 So there's room for investigation here. In the meantime:

 Reviewed-by: Carl Worth cwo...@cworth.org

 -Carl

 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev