delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2014/04/13/10:02:35

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:date:message-id:subject:from:to:content-type;
bh=PUXSlACPDmoHA6cbTpmw4GiYocK8yIMvaG7LO5CF334=;
b=ATR30hmEF08RRZu5OGV+FhA1Y4wo+eyuvGGsqufqZMRsKbMhNvmkpRCHrKZUfzmuzj
H+dd8rqHgNM7F1HVQdWDs2utue8VUIslFmFOyj9KsiDTy+XIUkOKvhFdrnXJKsYJmZVx
kX4S7FfCuxMYLUcgijoNzUO4TSJLRjzhxIqaOqu732Ex0LpJmy39L7lBkQlqWOsaUvvs
oy1x5lcgLPz1X9ks88dA3lVfJ3eOXWkZd1SadY6QYICID6qx5A2XvVW050lnCo+7GtVH
6vH1lr4+O0ixumSWDEV4Bi9RkCPPZQl9A598rw9++t6blPIc8fcwiSubDwoMIGz2AI5b
XMlA==
MIME-Version: 1.0
X-Received: by 10.66.147.99 with SMTP id tj3mr38616328pab.47.1397396170669;
Sun, 13 Apr 2014 06:36:10 -0700 (PDT)
Date: Sun, 13 Apr 2014 16:36:10 +0300
Message-ID: <CAA2C=vBEXS=7Dp2yPwtv1noVt8FC3QGyczRyw8-uipyNscp9jg@mail.gmail.com>
Subject: [PATCH] fix library build for -Werror
From: Ozkan Sezer <sezeroz AT gmail DOT com>
To: djgpp-workers <djgpp-workers AT delorie DOT com>
Reply-To: djgpp-workers AT delorie DOT com

--047d7b6dce6a5d04a704f6eca649
Content-Type: text/plain; charset=ISO-8859-1

Current cvs fails building due to -Werror with gcc 3.3.6 and 3.4.6 :

djasm.y:706.11-714.14: warning: unused value: $4
ctime.c: In function `differ_by_repeat':
ctime.c:286: warning: comparison is always false due to limited range
of data type
mkdtemp.c: In function `mkdtemp':
mkdtemp.c:15: warning: 'rv' might be used uninitialized in this function

The djasm warning doesn't stop the build, but the two others do.
Here is a small patch that cures this: (also attached in case it gets
mangled in the mail.)

Index: libc/ansi/time/ctime.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/time/ctime.c,v
retrieving revision 1.11
diff -u -p -r1.11 ctime.c
--- djgpp/src/libc/ansi/time/ctime.c	17 Aug 2013 20:26:19 -0000	1.11
+++ djgpp/src/libc/ansi/time/ctime.c	12 Apr 2014 07:11:50 -0000
@@ -283,7 +283,7 @@ differ_by_repeat(const time_t t1, const
 {
   if (TYPE_INTEGRAL(time_t) && TYPE_BIT(time_t) - TYPE_SIGNED(time_t)
< SECSPERREPEAT_BITS)
     return 0;
-  return t1 - t0 == SECSPERREPEAT;
+  return (int_fast64_t)t1 - (int_fast64_t)t0 == SECSPERREPEAT;
 }

 static char *
Index: libc/posix/stdlib/mkdtemp.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/stdlib/mkdtemp.c,v
retrieving revision 1.1
diff -u -p -r1.1 mkdtemp.c
--- djgpp/src/libc/posix/stdlib/mkdtemp.c	10 Jan 2014 22:40:55 -0000	1.1
+++ djgpp/src/libc/posix/stdlib/mkdtemp.c	12 Apr 2014 07:11:56 -0000
@@ -12,8 +12,7 @@ mkdtemp(char *_template)
 {
   char tmp_name[FILENAME_MAX];
   char real_path[FILENAME_MAX];
-  int  rv;
-
+  int  rv = -1;

   do {
     strcpy(tmp_name, _template);


For the ctime warning, googling shows the same solution as the one I
did above, e.g.:  http://permalink.gmane.org/gmane.comp.time.tz/1928

Apart from this, the distrib/mkdist script line #13 blindly assumes
that the TMPDIR environment variable is set. If it is not, such as
the case on at least one of my linux boxen, if fails miserably.
Please cure it (I don't have a patch for it, I'm not a perl guy..)

--
O.S.

--047d7b6dce6a5d04a704f6eca649
Content-Type: text/plain; charset=US-ASCII; name="werror.diff"
Content-Disposition: attachment; filename="werror.diff"
Content-Transfer-Encoding: base64
X-Attachment-Id: file0

SW5kZXg6I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aWZmIC11IC1wIC1yMS4xIG1rZHRlbXAuYwotLS0gZGpncHAv
c3JjL2xpYmMvcG9zaXgvc3RkbGliL21rZHRlbXAuYwkxMCBKYW4gMjAxNCAyMjo0MDo1NSAtMDAw
MAkxLjEKKysrIGRqZ3BwL3NyYy9saWJjL3Bvc2l4L3N0ZGxpYi9ta2R0ZW1wLmMJMTIgQXByIDIw
MTQgMDc6MTE6NTYgLTAwMDAKQEAgLTEyLDggKzEyLDcgQEAgbWtkdGVtcChjaGFyICpfdGVtcGxh
dGUpCiB7CiAgIGNoYXIgdG1wX25hbWVbRklMRU5BTUVfTUFYXTsKICAgY2hhciByZWFsX3BhdGhb
RklMRU5BTUVfTUFYXTsKLSAgaW50ICBydjsKLQorICBpbnQgIHJ2ID0gLTE7CiAKICAgZG8gewog
ICAgIHN0cmNweSh0bXBfbmFtZSwgX3RlbXBsYXRlKTsK
--047d7b6dce6a5d04a704f6eca649--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019