__attribute__: mark some functions with LAST_ARG_MUST_BE_NULL

Some varargs functions that use NULL-terminated parameter list were missing __attributes__ ((sentinel)) aka LAST_ARG_MUST_BE_NULL. Add them. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Jun 8, 2024 at 11:37 UTC ba744647eae1eeee3a1c2c3d3a2b331fc1075b54
4 files changed +5
add-patch.c
+1
@@ -300,6 +300,7 @@ static void err(struct add_p_state *s, const char *fmt, ...)
300 va_end(args);
301 }
302
303 +LAST_ARG_MUST_BE_NULL
304 static void setup_child_process(struct add_p_state *s,
305 struct child_process *cp, ...)
306 {
attr.h
+2
@@ -190,6 +190,8 @@ struct attr_check {
190 };
191
192 struct attr_check *attr_check_alloc(void);
193 +
194 +LAST_ARG_MUST_BE_NULL
195 struct attr_check *attr_check_initl(const char *, ...);
196 struct attr_check *attr_check_dup(const struct attr_check *check);
197
hook.h
+1
@@ -86,5 +86,6 @@ int run_hooks(const char *hook_name);
86 * argument. These things will be used as positional arguments to the
87 * hook. This function behaves like the old run_hook_le() API.
88 */
89 +LAST_ARG_MUST_BE_NULL
90 int run_hooks_l(const char *hook_name, ...);
91 #endif
scalar.c
+1
@@ -70,6 +70,7 @@ static void setup_enlistment_directory(int argc, const char **argv,
70 strbuf_release(&path);
71 }
72
73 +LAST_ARG_MUST_BE_NULL
74 static int run_git(const char *arg, ...)
75 {
76 struct child_process cmd = CHILD_PROCESS_INIT;