On Wed, May 29, 2013 at 10:23:29PM -0700, Austin English wrote:
This was added 12 years ago in 1db20bfd33f9c1486a1a662c2f78f45d00caf24b
but clang doesn't like it: clang -m32 -c -I. -I. -I../../include -I../../include -D__WINESRC__ -D_MT -D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers -Wstrict-prototypes -Wtype-limits -Wwrite-strings -Wpointer-arith -gdwarf-2 -gstrict-dwarf -fno-omit-frame-pointer -g -O2 -o process.o process.c process.c:363:10: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign] action = action; /* Remove warning */
1 warning generated. and no modern gcc/other compiler that I can find cares.
It was probably added because of a tool that warned of the unused parameter ... So it all goes in circles. ;)
Ciao, Marcus
Le 30/05/2013 09:54, Marcus Meissner a écrit :
On Wed, May 29, 2013 at 10:23:29PM -0700, Austin English wrote:
This was added 12 years ago in 1db20bfd33f9c1486a1a662c2f78f45d00caf24b
but clang doesn't like it: clang -m32 -c -I. -I. -I../../include -I../../include -D__WINESRC__ -D_MT -D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers -Wstrict-prototypes -Wtype-limits -Wwrite-strings -Wpointer-arith -gdwarf-2 -gstrict-dwarf -fno-omit-frame-pointer -g -O2 -o process.o process.c process.c:363:10: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign] action = action; /* Remove warning */
1 warning generated. and no modern gcc/other compiler that I can find cares.
It was probably added because of a tool that warned of the unused parameter ... So it all goes in circles. ;)
Ciao, Marcus
So what about action = NULL instead?
Christian Costa titan.costa@gmail.com wrote:
and no modern gcc/other compiler that I can find cares.
It was probably added because of a tool that warned of the unused parameter ... So it all goes in circles. ;)
Ciao, Marcus
So what about action = NULL instead?
A checker tool should be instructed to ignore that kind of a warning instead. There are many legitimate cases when a function doesn't use all of its parameters, in that cases there is no need to take any special action to silence a warning IMHO.
Le 30/05/2013 10:59, Dmitry Timoshkov a écrit :
Christian Costa titan.costa@gmail.com wrote:
and no modern gcc/other compiler that I can find cares.
It was probably added because of a tool that warned of the unused parameter ... So it all goes in circles. ;)
Ciao, Marcus
So what about action = NULL instead?
A checker tool should be instructed to ignore that kind of a warning instead. There are many legitimate cases when a function doesn't use all of its parameters, in that cases there is no need to take any special action to silence a warning IMHO.
There is also __attribute__((unused_parameter)) but it's gcc specific.
Christian Costa titan.costa@gmail.com wrote:
and no modern gcc/other compiler that I can find cares.
It was probably added because of a tool that warned of the unused parameter ... So it all goes in circles. ;)
Ciao, Marcus
So what about action = NULL instead?
A checker tool should be instructed to ignore that kind of a warning instead. There are many legitimate cases when a function doesn't use all of its parameters, in that cases there is no need to take any special action to silence a warning IMHO.
There is also __attribute__((unused_parameter)) but it's gcc specific.
How is that better than 'unused = unused'? And it's even more typing...
Le 30/05/2013 13:56, Dmitry Timoshkov a écrit :
Christian Costa titan.costa@gmail.com wrote:
and no modern gcc/other compiler that I can find cares.
It was probably added because of a tool that warned of the unused parameter ... So it all goes in circles. ;)
Ciao, Marcus
So what about action = NULL instead?
A checker tool should be instructed to ignore that kind of a warning instead. There are many legitimate cases when a function doesn't use all of its parameters, in that cases there is no need to take any special action to silence a warning IMHO.
There is also __attribute__((unused_parameter)) but it's gcc specific.
How is that better than 'unused = unused'? And it's even more typing...
It's a compiler thing like const. It's quite long right. Unless using it through a macro like e.g UNUSED. Normally it is used for handlers whose implementations may not used some params. It may not be the best solution but this can of things exists.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 30/05/13 12:56, Dmitry Timoshkov wrote:
Christian Costa titan.costa@gmail.com wrote:
and no modern gcc/other compiler that I can find cares.
It was probably added because of a tool that warned of the unused parameter ... So it all goes in circles. ;)
Ciao, Marcus
So what about action = NULL instead?
A checker tool should be instructed to ignore that kind of a warning instead. There are many legitimate cases when a function doesn't use all of its parameters, in that cases there is no need to take any special action to silence a warning IMHO.
There is also __attribute__((unused_parameter)) but it's gcc specific.
How is that better than 'unused = unused'? And it's even more typing...
Just cast it to void:
(void)unused_param;
Thats the tidiest way IMHO.