CodingGuidelines: also mention MAYBE_UNUSED
A function that uses a parameter in one build may lose all uses of the parameter in another build, depending on the configuration. A workaround for such a case, MAYBE_UNUSED, should also be mentioned when we recommend the use of UNUSED to our developers. Keep the addition to the guideline short and document the criteria to choose between UNUSED and MAYBE_UNUSED near their definition. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@ -262,8 +262,9 @@ For C programs:
|
||||
like "error: unused parameter 'foo' [-Werror=unused-parameter]",
|
||||
which indicates that a function ignores its argument. If the unused
|
||||
parameter can't be removed (e.g., because the function is used as a
|
||||
callback and has to match a certain interface), you can annotate the
|
||||
individual parameters with the UNUSED keyword, like "int foo UNUSED".
|
||||
callback and has to match a certain interface), you can annotate
|
||||
the individual parameters with the UNUSED (or MAYBE_UNUSED)
|
||||
keyword, like "int foo UNUSED".
|
||||
|
||||
- We try to support a wide range of C compilers to compile Git with,
|
||||
including old ones. As of Git v2.35.0 Git requires C99 (we check
|
||||
|
||||
Reference in New Issue
Block a user