In recent versions of gcc (4.9.0), we get hundreds of these:
advice.c: In function ‘error_resolve_conflict’:
advice.c:79:69: warning: right-hand operand of comma expression has no effect
[-Wunused-value]
error("'%s' is not possible because you have unmerged files.", me);
^
The original patch intended to help in situations like this:
if (error(...))
/* do stuff */
However, when there's no conditional statement this gets translated to:
(error(..), 1);
And the right hand of the expression has no effect.
So it looks like gcc is smarter now, and in trying to fix a few warnings
we generated hundreds more.
This reverts commit e208f9cc7574f5980faba498d0aa30b4defeb34f.
Conflicts:
git-compat-util.h
---
git-compat-util.h | 11 -----------
usage.c | 1 -
2 files changed, 12 deletions(-)
diff --git a/git-compat-util.h b/git-compat-util.h
index f6d3a46..b4242e4 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -323,17 +323,6 @@ extern void warning(const char *err, ...)
__attribute__((format (printf, 1, 2)))
#include <openssl/x509v3.h>
#endif /* NO_OPENSSL */
-/*
- * 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.
- */
-#if defined(__GNUC__) && ! defined(__clang__)
-#define error(...) (error(__VA_ARGS__), -1)
-#endif
-
extern void set_die_routine(NORETURN_PTR void (*routine)(const char *err,
va_list params));
extern void set_error_routine(void (*routine)(const char *err, va_list
params));
extern void set_die_is_recursing_routine(int (*routine)(void));
diff --git a/usage.c b/usage.c
index ed14645..9d2961e 100644
--- a/usage.c
+++ b/usage.c
@@ -138,7 +138,6 @@ void NORETURN die_errno(const char *fmt, ...)
va_end(params);
}
-#undef error
int error(const char *err, ...)
{
va_list params;
--
1.9.2+fc1.20.g204a630
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html