Skip to content

Commit 103e02c

Browse files
avargitster
authored andcommitted
*.c static functions: don't forward-declare __attribute__
9cf6d33 (Add git-index-pack utility, 2005-10-12) and 466dbc4 (receive-pack: Send internal errors over side-band #2, 2010-02-10) we added these static functions and forward-declared their __attribute__((printf)). I think this may have been to work around some compiler limitation at the time, but in any case we have a lot of code that uses the briefer way of declaring these that I'm using here, so if we had any such issues with compilers we'd have seen them already. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d486ca6 commit 103e02c

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

builtin/index-pack.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,7 @@ static void parse_pack_header(void)
369369
use(sizeof(struct pack_header));
370370
}
371371

372-
static NORETURN void bad_object(off_t offset, const char *format,
373-
...) __attribute__((format (printf, 2, 3)));
374-
372+
__attribute__((format (printf, 2, 3)))
375373
static NORETURN void bad_object(off_t offset, const char *format, ...)
376374
{
377375
va_list params;

builtin/receive-pack.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,6 @@ static int proc_receive_ref_matches(struct command *cmd)
425425
return 0;
426426
}
427427

428-
static void rp_error(const char *err, ...) __attribute__((format (printf, 1, 2)));
429-
static void rp_warning(const char *err, ...) __attribute__((format (printf, 1, 2)));
430-
431428
static void report_message(const char *prefix, const char *err, va_list params)
432429
{
433430
int sz;
@@ -445,6 +442,7 @@ static void report_message(const char *prefix, const char *err, va_list params)
445442
xwrite(2, msg, sz);
446443
}
447444

445+
__attribute__((format (printf, 1, 2)))
448446
static void rp_warning(const char *err, ...)
449447
{
450448
va_list params;
@@ -453,6 +451,7 @@ static void rp_warning(const char *err, ...)
453451
va_end(params);
454452
}
455453

454+
__attribute__((format (printf, 1, 2)))
456455
static void rp_error(const char *err, ...)
457456
{
458457
va_list params;

0 commit comments

Comments
 (0)