View Issue Details

IDProjectCategoryView StatusLast Update
0001409OpenMPTGeneralpublic2023-01-01 14:28
ReporterSaga Musix Assigned To 
PrioritynormalSeverityminorReproducibilityN/A
Status feedbackResolutionopen 
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.

manx

manx

2023-01-01 14:28

administrator   ~0005444

I still do not think this would be very useful.

If anything, I would prefer a form of this feature that would actually warn if used in the opposite case when applied to a variable that actually does get used regardless. Our current macro does theoretically semantically allow for such a future warning, while [[maybe_unused]] does prohibit any warning in this case.

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
2023-01-01 14:28 manx Status new => feedback
2023-01-01 14:28 manx Note Added: 0005444