git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 07/12] date: mark unused parameters in handler functions

From
Jeff King <peff@peff.net>
Date
Oct 18, 2022, 01:05 UTC
Message-ID
<Y0378IyBza5uo2Md@coredump.intra.peff.net>
In-Reply-To
<Y036whEorZV0rOgB@coredump.intra.peff.net>

When parsing approxidates, we use a table to map special strings (like "noon") to functions which handle them. Not all functions need the "now" parameter, as they are not relative (e.g., "yesterday" does, but "pm" does not). Let's annotate those to make -Wunused-parameter happy.

Signed-off-by: Jeff King <peff@peff.net>
---
 date.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/date.c b/date.c
index 68a260c214..53bd6a7932 100644
--- a/date.c
+++ b/date.c
@@ -1101,7 +1101,7 @@ static void date_tea(struct tm *tm, struct tm *now, int *num)
 	date_time(tm, now, 17);
 }
 
-static void date_pm(struct tm *tm, struct tm *now, int *num)
+static void date_pm(struct tm *tm, struct tm *now UNUSED, int *num)
 {
 	int hour, n = *num;
 	*num = 0;
@@ -1115,7 +1115,7 @@ static void date_pm(struct tm *tm, struct tm *now, int *num)
 	tm->tm_hour = (hour % 12) + 12;
 }
 
-static void date_am(struct tm *tm, struct tm *now, int *num)
+static void date_am(struct tm *tm, struct tm *now UNUSED, int *num)
 {
 	int hour, n = *num;
 	*num = 0;
@@ -1129,7 +1129,7 @@ static void date_am(struct tm *tm, struct tm *now, int *num)
 	tm->tm_hour = (hour % 12);
 }
 
-static void date_never(struct tm *tm, struct tm *now, int *num)
+static void date_never(struct tm *tm, struct tm *now UNUSED, int *num)
 {
 	time_t n = 0;
 	localtime_r(&n, tm);
-- 
2.38.0.371.g300879f34e
Previous: Jeff KingNext: Jeff King
Message 8 of 13 in “more unused-parameter fixes / annotations”
  1. 0/12 more unused-parameter fixes / annotationsJeff King, Oct 18, 2022
  2. 01/12 diffstat_consume(): assert non-zero lengthJeff King, Oct 18, 2022
  3. 02/12 submodule--helper: drop unused argc from module_list_compute()Jeff King, Oct 18, 2022
  4. 03/12 update-index: drop unused argc from do_reupdate()Jeff King, Oct 18, 2022
  5. 04/12 mark unused parameters in trivial compat functionsJeff King, Oct 18, 2022
  6. 05/12 object-file: mark unused parameters in hash_unknown functionsJeff King, Oct 18, 2022
  7. 06/12 string-list: mark unused callback parametersJeff King, Oct 18, 2022
  8. 07/12 date: mark unused parameters in handler functionsJeff King, Oct 18, 2022
  9. 08/12 apply: mark unused parameters in handlersJeff King, Oct 18, 2022
  10. 09/12 apply: mark unused parameters in noop error/warning routineJeff King, Oct 18, 2022
  11. 11/12 diffcore-pickaxe: mark unused parameters in pickaxe functionsJeff King, Oct 18, 2022
  12. 10/12 convert: mark unused parameter in null stream filterJeff King, Oct 18, 2022
  13. 12/12 ll-merge: mark unused parameters in callbacksJeff King, Oct 18, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.