Merge branch 'jk/squelch-false-warning-from-gcc-o3' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 19 Sep 2016 20:51:41 +0000 (13:51 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 19 Sep 2016 20:51:41 +0000 (13:51 -0700)
Compilation fix.

* jk/squelch-false-warning-from-gcc-o3:
color_parse_mem: initialize "struct color" temporary
error_errno: use constant return similar to error()

color.c
git-compat-util.h
usage.c
diff --git a/color.c b/color.c
index 81c26767239f9e028057c1843f57b77640db6c26..1b95e6b2a7bb1601fa5862de8989775e197c7b41 100644 (file)
--- a/color.c
+++ b/color.c
@@ -215,7 +215,7 @@ int color_parse_mem(const char *value, int value_len, char *dst)
        /* [fg [bg]] [attr]... */
        while (len > 0) {
                const char *word = ptr;
-               struct color c;
+               struct color c = { COLOR_UNSPECIFIED };
                int val, wordlen = 0;
 
                while (len > 0 && !isspace(word[wordlen])) {
index db89ba774891a9608531e52252de19d552cbf535..2ad45b3f759336acbca40499e737eb2d68a44669 100644 (file)
@@ -436,6 +436,7 @@ static inline int const_error(void)
        return -1;
 }
 #define error(...) (error(__VA_ARGS__), const_error())
+#define error_errno(...) (error_errno(__VA_ARGS__), const_error())
 #endif
 
 extern void set_die_routine(NORETURN_PTR void (*routine)(const char *err, va_list params));
diff --git a/usage.c b/usage.c
index 1dad03fb5c9b7f8f7785915d004aff43e39b0d2a..0efa3faf601231db35239161a1a7253b3975b3f8 100644 (file)
--- a/usage.c
+++ b/usage.c
@@ -148,6 +148,7 @@ void NORETURN die_errno(const char *fmt, ...)
        va_end(params);
 }
 
+#undef error_errno
 int error_errno(const char *fmt, ...)
 {
        char buf[1024];