monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] 'warning: unused parameter'


From: Markus Wanner
Subject: Re: [Monotone-devel] 'warning: unused parameter'
Date: Thu, 01 May 2014 10:55:53 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.4.0

On 04/30/2014 11:19 AM, Václav Zeman wrote:
> On 30 April 2014 11:05, Stephen Leake wrote:
>> Stephen Leake <address@hidden> writes:
>>> Stephen Leake <address@hidden> writes:
>>>> Is there a way to mark 'thing' as unused? or do we have to disable that
>>>> warning with -Wno-unused-parameter?
>>>
>>> I found three answers on stack overflow:
>>>
>>> 1) comment out or delete the parameter name:
>>>
>>>     a) origin::type get_made_from<std::string>(std::string const & /* thing 
>>> */)
>>>
>>>     b) origin::type get_made_from<std::string>(std::string const & )
>>>
>>> 2) cast it to void:
>>>
>>>     (void)thing;
>>>
>>> I prefer 1a; it most clearly documents that we know there is a parameter
>>> by that name, but we are not using it in this case. Any objections?

I agree.

>> In most uses of CMD_NO_WORKSPACE, "execid" is not used, but it is used
>> in some (cmd_netsync.cc clone).

Yeah, macros are problematic - not only in that regard. I'd generally
like to see us move away from those, but...

> You could special case GCC and introduce your own macro that expands
> to the "unused" attribute in case of GCC:
> http://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Function-Attributes.html#index-g_t_0040code_007bunused_007d-attribute_002e-3000

Special casing a compiler just to get rid of a warning sounds weird to
me. How about other compilers? And changes between compiler versions?
We'll end up cluttering our code with a lot of ifdefs if we go that
route. That's not worth it, IMO.

That being said, I certainly agree we should try to reduce compiler
warnings as much as possible with generic ways. I started the branch
nvm.cleanup-warnings for that work. But please keep focusing on fixing
real issues for release 1.1, for now.

Regards

Markus Wanner


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]