Re: [PATCH 8/8] Enable GIT_DEBUG_MEMCHECK on git_pathname()
- From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
- Date
- Nov 18, 2011, 01:12 UTC
- Message-ID
- <CACsJy8A25SyLVKv8GwkYaHBJwU5tHqgdJK6L-upF9HWseFzCtQ@mail.gmail.com>
- In-Reply-To
- <20111117134201.GA30718@sigill.intra.peff.net>
On Thu, Nov 17, 2011 at 8:42 PM, Jeff King <peff@peff.net> wrote:
Show 17 quoted lines
> On Thu, Nov 17, 2011 at 04:05:52PM +0530, Ramkumar Ramachandra wrote: > >> 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. > > All three are in C99. I'm pretty sure __FILE__ and __LINE__ were > available in C89, but I only have a copy of C99 handy these days. > Variable-argument macros were definitely introduced in C99 (and were a > gcc extension for a while before then). > >> 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. > > Older compilers will probably barf on the variable-argument macros.
Anyway to detect if __VA_ARGS__ is supported at compile time? I guess #ifdef __GNUC__ is the last resort.
notes-merge.c introduces __VA_ARGS__ since v1.7.4 so we may want to do something there too.
-- Duy