aboutsummaryrefslogtreecommitdiff
path: root/Documentation/CodingGuidelines
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-09-06 10:38:49 -0700
committerJunio C Hamano <gitster@pobox.com>2024-09-06 10:38:50 -0700
commit5ecd5fa58b3315d6bdd6ef9218c7ae442782bc5d (patch)
tree36dad0e60cd1a4e69fd2ebbadb8694a6b73a7b70 /Documentation/CodingGuidelines
parent6dcb2db0fa20cbad961ebdc8414ce4f9246d8c2b (diff)
parenta61bc8879eaade17eccec2a22693501480843db1 (diff)
downloadgit-5ecd5fa58b3315d6bdd6ef9218c7ae442782bc5d.tar.xz
Merge branch 'jk/unused-parameters'
Make our codebase compilable with the -Werror=unused-parameter option. * jk/unused-parameters: CodingGuidelines: mention -Wunused-parameter and UNUSED config.mak.dev: enable -Wunused-parameter by default compat: mark unused parameters in win32/mingw functions compat: disable -Wunused-parameter in win32/headless.c compat: disable -Wunused-parameter in 3rd-party code t-reftable-readwrite: mark unused parameter in callback function gc: mark unused config parameter in virtual functions
Diffstat (limited to 'Documentation/CodingGuidelines')
-rw-r--r--Documentation/CodingGuidelines7
1 files changed, 7 insertions, 0 deletions
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index ccaea39752..d0fc7cfe60 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -258,6 +258,13 @@ For C programs:
ensure your patch is clear of all compiler warnings we care about,
by e.g. "echo DEVELOPER=1 >>config.mak".
+ - When using DEVELOPER=1 mode, you may see warnings from the compiler
+ 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".
+
- 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
"__STDC_VERSION__"). You should not use features from a newer C