Re: [PATCH 8/8] Enable GIT_DEBUG_MEMCHECK on git_pathname()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Nguyễn,

Nguyễn Thái Ngọc Duy writes:
> diff --git a/cache.h b/cache.h
> index feb44a5..66365fb 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -661,10 +661,13 @@ extern char *git_pathdup(const char *fmt, ...)
>        __attribute__((format (printf, 1, 2)));
>
>  /* Return a statically allocated filename matching the sha1 signature */
> -extern char *mkpath(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
> -extern char *git_path(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
> -extern char *git_path_submodule(const char *path, const char *fmt, ...)
> -       __attribute__((format (printf, 2, 3)));
> +#define mkpath(...) mkpath_real(__FUNCTION__, __LINE__, __VA_ARGS__)
> +extern char *mkpath_real(const char *file, int line, const char *fmt, ...) __attribute__((format (printf, 3, 4)));
> +#define git_path( ...) git_path_real(__FUNCTION__, __LINE__, __VA_ARGS__)
> +extern char *git_path_real(const char *file, int line, const char *fmt, ...) __attribute__((format (printf, 3, 4)));
> +#define git_path_submodule(path, ...) git_path_submodule_real(__FUNCTION__, __LINE__, path, __VA_ARGS__)
> +extern char *git_path_submodule_real(const char *file, int line, const char *path, const char *fmt, ...)
> +       __attribute__((format (printf, 4, 5)));

The macros __FILE__, __LINE__ and __VA_ARGS__ are gcc-specific
extensions, no?  I was curious to see if some other parts of Git are
using this: a quick grep returns mailmap.c and notes-merge.c.  They
both use __VA_ARGS__ it for debugging purposes.  So, nothing new.

What happens if GIT_DEBUG_MEMCHECK is set, but I'm not using gcc?
Also, it's probably worth mentioning in the commit message that this
debugging trick is gcc-specific.

Thanks for working on this.

-- Ram
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]