View Issue Details

IDProjectCategoryView StatusLast Update
0001409OpenMPTGeneralpublic2021-01-20 09:34
ReporterSaga Musix Assigned To 
PrioritynormalSeverityminorReproducibilityN/A
Status newResolutionopen 
Summary0001409: Replace MPT_UNREFERENCED_PARAMETER and MPT_UNUSED_VARIABLE with [[maybe_unused]]
Description

As we are on C++17 now, we can use [[maybe_unused]] for declaring potentially unused variables and parameters.

TagsNo tags attached.
Has the bug occurred in previous versions?
Tested code revision (in case you know it)

Activities

manx

manx

2021-01-20 09:34

administrator   ~0004614

I actually do not think this is useful. Quite the opposite. Around 50% of our uses are of the following form:

int bar(int baz)
{
#ifdef SOMETHING
 return foobar(baz);
#else
 MPT_UNREFERENCED_PARAMETER(baz);
 return 23;
#endif
}

[[maybe_unused]] instead would be used in the variable declaration, which would actually hide accidentally not using baz in the first preprocessor branch.

Issue History

Date Modified Username Field Change
2021-01-20 09:24 Saga Musix New Issue
2021-01-20 09:34 manx Note Added: 0004614