mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
trace2: NULL is not allowed for va_list
Some compilers don't allow NULL to be passed for a va_list,
and e.g. "gcc (Raspbian 6.3.0-18+rpi1+deb9u1) 6.3.0 20170516"
errors out like this:
trace2/tr2_tgt_event.c:193:18:
error: invalid operands to binary &&
(have ‘int’ and ‘va_list {aka __va_list}’)
if (fmt && *fmt && ap) {
^^
I couldn't find any hints that va_list and pointers can be mixed,
and no hints that they can't either. Morten Welinder comments:
"C99, Section 7.15, simply says that va_list "is an object type suitable for
holding information needed by the macros va_start, va_end, and
va_copy". So clearly not guaranteed to be mixable with pointers...
The portable solution is to use "va_list" everywhere in the callchain.
As a consequence, both trace2_region_enter_fl() and trace2_region_leave_fl()
now take a variable argument list.
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Acked-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
32038fef00
commit
ad006fe419
4
trace2.h
4
trace2.h
@@ -238,7 +238,7 @@ void trace2_def_repo_fl(const char *file, int line, struct repository *repo);
|
||||
* on this thread.
|
||||
*/
|
||||
void trace2_region_enter_fl(const char *file, int line, const char *category,
|
||||
const char *label, const struct repository *repo);
|
||||
const char *label, const struct repository *repo, ...);
|
||||
|
||||
#define trace2_region_enter(category, label, repo) \
|
||||
trace2_region_enter_fl(__FILE__, __LINE__, (category), (label), (repo))
|
||||
@@ -278,7 +278,7 @@ void trace2_region_enter_printf(const char *category, const char *label,
|
||||
* in this nesting level.
|
||||
*/
|
||||
void trace2_region_leave_fl(const char *file, int line, const char *category,
|
||||
const char *label, const struct repository *repo);
|
||||
const char *label, const struct repository *repo, ...);
|
||||
|
||||
#define trace2_region_leave(category, label, repo) \
|
||||
trace2_region_leave_fl(__FILE__, __LINE__, (category), (label), (repo))
|
||||
|
||||
Reference in New Issue
Block a user