On Tue, Aug 16, 2016 at 6:17 PM, Hanno Böck <ha...@hboeck.de> wrote:
> Hi,
>
> The variable presume_output_tty is defined both in the diff.h header
> and the file util.c (which includes diff.h).
>
> The diff.h file makes sure that the variable is declared as external
> except when it's included by the main program diff.c. But as it's also
> declared in util.c we end up having two non-external declarations of it.
>
> Traditionally gcc has allowed this behavior, which is probably the
> reason it has not been spottet before, but it's not correct C. One can
> get a more strict behavior here by passing -fno-common to the CFLAGS and
> LDFLAGS and then linking will fail.
>
> The solution is simple: Remove the superfluous declaration in util.c,
> see attached patch. Please apply.

Good catch. Thank you!
I will look into adding -fno-common when it is accepted.
Here's the patch I expect to push soon:
From c2dc91f1968c6ccd8ba623f9fa391f529ab800ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hanno=20B=C3=B6ck?= <ha...@hboeck.de>
Date: Tue, 16 Aug 2016 22:02:13 -0700
Subject: [PATCH] diff: avoid duplicate definition of presume_output_tty

* src/util.c (presume_output_tty): Remove this definition.
The other is in diff.h.  Reported in https://bugs.gnu.org/24248
---
 src/util.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/util.c b/src/util.c
index d7b8925..76872cb 100644
--- a/src/util.c
+++ b/src/util.c
@@ -44,8 +44,6 @@

 char const pr_program[] = PR_PROGRAM;

-bool presume_output_tty;
-
 /* Queue up one-line messages to be printed at the end,
    when -l is specified.  Each message is recorded with a 'struct msg'.  */

-- 
2.8.0-rc2

Reply via email to