[Dune-devel] How to proceed with deprecation of DUNE_UNUSED_PARAM?

Simon Praetorius simon.praetorius at tu-dresden.de
Wed Mar 31 13:43:27 CEST 2021


Hi,

I would just leave the macros as they are. We can add a comment in the 
documentation that we would recommend to use [[maybe_unused]] instead, 
but if someone prefers to use a macro for this in user-code it does not 
hurt anyone. We just have the additional header unused.hh and the cmake 
test. can cleanup the core modules (as already done partially, thanks to 
Christoph)

The cmake test is necessary only for the DUNE_UNUSED macro (or is it?). 
The second one, DUNE_UNUSED_PARAMETER, can be defined without any 
restrictions, no compatibility test necessary. So, it could just be left 
untouched.
The DUNE_UNUSED macro defines __attribute__(unused)) that is only 
available in GNU, Clang and ICC compilers on Linux. (maybe MacOS). Thus, 
the cmake check could be removed in favor of a simple preprocessor check 
for the compiler.

This would allow to remove the cmake test and just leaves the unused.hh 
header in the source tree. No deprecation is necessary, no change in any 
downstream code. But for future code, we could just recommend to use 
[[maybe_unused]] instead.

Best,
Simon


Am 31.03.21 um 12:40 schrieb Markus Blatt:
> On Wed, Mar 31, 2021 at 10:24:40AM +0200, Christoph Grüninger wrote:
>> Hi!
>>
>> Thinking further about a smooth transition path for DUNE_UNUSED I
>> propose the following (extension of option 1):
>>
>> * Deprecate the macro DUNE_UNUSED, no warning will be emitted.
>> * After Dune 2.8 we remove the CMake test, thus HAS_ATTRIBUTE_UNUSED
>> will be always undefined and DUNE_UNUSED has no effect.
>> * The user will get a warning for an unused variable and can investigate
>> the problem. There is no guarantee that the user will act, but it
>> increases the chances.
>> * After Dune 2.9 we remove the macro.
>>
>> Any objections?
>>
>> Bye
>> Christoph
>>
>
> Hi,
>
> Personally, I am fine with this but only as long as 
> DUNE_USED_PARAMETER stays as it is, because that is the only thing I 
> am using.
>
> Nevertheless I would like to raise the question:
> What improvement is this for the user? What work is it saving us?
>
> It seems a bit like people using our macros will get annoying warnings 
> and finally will need to do additional work for little benefit. What 
> is the justification for this?
> My personal conclusion would be to not use DUNE's macros again as they 
> might turn out to be a maintenance burden in the end.
>
> Markus
>
-- 
Dr. Simon Praetorius
Technische Universität Dresden
Institute of Scientific Computing
phone: +49 351 463-34432
mail: simon.praetorius at tu-dresden.de
web: https://tu-dresden.de/mn/math/wir/das-institut/beschaeftigte/simon-praetorius





More information about the Dune-devel mailing list