[RFC PATCH 01/21] git-compat-util.h: clarify GCC v.s. C99-specific in comment
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Nov 15, 2021, 22:18 UTC
- Message-ID
- <RFC-patch-01.21-e49ac938399-20211115T220831Z-avarab@gmail.com>
- In-Reply-To
- <RFC-cover-00.21-00000000000-20211115T220831Z-avarab@gmail.com>
Change a comment added in e208f9cc757 (make error()'s constant return value more visible, 2012-12-15). It's not correct that this is GCC-ism anymore, it's code that uses standard C99 features.
The comment being changed here pre-dates the HAVE_VARIADIC_MACROS define, which we got in e05bed960d3 (trace: add 'file:line' to all trace output, 2014-07-12).
The original implementation of an error() macro) in e208f9cc757 used a GCC-ism with the paste operator (see the commit message for mention of it), but that was dropped later by 9798f7e5f9 (Use __VA_ARGS__ for all of error's arguments, 2013-02-08), giving us the C99-portable version we have now.
While we could remove the __GNUC__ define here, it might cause issues for other compilers or static analysis systems, so let's not. See 87fe5df365 (inline constant return from error() function, 2014-05-06) for one such issue.
See also e05bed960d3 (trace: add 'file:line' to all trace output, 2014-07-12) for another comment about GNUC's handling of __VA_ARGS__.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- git-compat-util.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/git-compat-util.h b/git-compat-util.h index d70ce142861..e86df9769ba 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -489,9 +489,7 @@ void warning_errno(const char *err, ...) __attribute__((format (printf, 1, 2))); /* * Let callers be aware of the constant return value; this can help * gcc with -Wuninitialized analysis. We restrict this trick to gcc, though, - * because some compilers may not support variadic macros. Since we're only - * trying to help gcc, anyway, it's OK; other compilers will fall back to - * using the function as usual. + * because other compilers may be confused by this. */ #if defined(__GNUC__) static inline int const_error(void)
-- 2.34.0.rc2.809.g11e21d44b24