blob: b286c6c172b1059ecc1d607ba757e733ab9d6c51 (
plain)
1 commit 624d3aebb6e6afadb4f35e894d11b5ebe290cd87
2 Author: christos <christos>
3 Date: Thu May 28 11:47:03 2015 +0000
4
5 avoid gcc-5 optimization malloc + memset = calloc (Fridolin Pokorny)
6
7 diff --git a/tc.alloc.c b/tc.alloc.c
8 index b9aec63..c1cb330 100644
9 --- a/tc.alloc.c
10 +++ b/tc.alloc.c
11 @@ -348,10 +348,13 @@ calloc(size_t i, size_t j)
12 {
13 #ifndef lint
14 char *cp;
15 + size_t k;
16
17 i *= j;
18 cp = xmalloc(i);
19 - memset(cp, 0, i);
20 + /* Stop gcc 5.x from optimizing malloc+memset = calloc */
21 + k = i;
22 + memset(cp, 0, k);
23
24 return ((memalign_t) cp);
25 #else
26
27
28 commit 05e7406049bd2686dee0ee8d819dcd38eb131f6f
29 Author: christos <christos>
30 Date: Tue Jul 7 12:24:54 2015 +0000
31
32 make k volatile to prevent gcc-5 memset() optimization (Fridolin Pokorny)
33
34 diff --git a/tc.alloc.c b/tc.alloc.c
35 index c1cb330..f68a8c5 100644
36 --- a/tc.alloc.c
37 +++ b/tc.alloc.c
38 @@ -348,7 +348,7 @@ calloc(size_t i, size_t j)
39 {
40 #ifndef lint
41 char *cp;
42 - size_t k;
43 + volatile size_t k;
44
45 i *= j;
46 cp = xmalloc(i);
47
48
49 commit c43b072b89f19e9b41d45bdf3946593ae9bc6e5e
50 Author: christos <christos>
51 Date: Mon Aug 24 07:08:42 2015 +0000
52
53 restrict BSDWAIT to __GLIBC__ because other linux libraries (muslc) don't
54 have the macros.
55
56 diff --git a/sh.proc.c b/sh.proc.c
57 index 76eca3b..ad07250 100644
58 --- a/sh.proc.c
59 +++ b/sh.proc.c
60 @@ -47,7 +47,7 @@ RCSID("$tcsh$")
61 # define HZ 16
62 #endif /* aiws */
63
64 -#if defined(_BSD) || (defined(IRIS4D) && __STDC__) || defined(__lucid) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)
65 +#if defined(_BSD) || (defined(IRIS4D) && __STDC__) || defined(__lucid) || defined(__GLIBC__)
66 # if !defined(__ANDROID__)
67 # define BSDWAIT
68 # endif
69 commit eab72f9797ec4faaf1fb4de491c357f194b84dd6
70 Author: christos <christos>
71 Date: Thu Apr 14 11:09:09 2016 +0000
72
73 GLIBC is getting rid of union wait.
74
75 diff --git a/sh.proc.c b/sh.proc.c
76 index ad07250..5c68409 100644
77 --- a/sh.proc.c
78 +++ b/sh.proc.c
79 @@ -47,11 +47,11 @@ RCSID("$tcsh$")
80 # define HZ 16
81 #endif /* aiws */
82
83 -#if defined(_BSD) || (defined(IRIS4D) && __STDC__) || defined(__lucid) || defined(__GLIBC__)
84 -# if !defined(__ANDROID__)
85 +#if defined(_BSD) || (defined(IRIS4D) && __STDC__) || defined(__lucid) || defined(__linux__) || defined(__GNU__)
86 +# if !defined(__ANDROID__) && !defined(__GLIBC__)
87 # define BSDWAIT
88 # endif
89 -#endif /* _BSD || (IRIS4D && __STDC__) || __lucid || glibc */
90 +#endif /* _BSD || (IRIS4D && __STDC__) || __lucid || gnu-linux */
91 #ifndef WTERMSIG
92 # define WTERMSIG(w) (((union wait *) &(w))->w_termsig)
93 # ifndef BSDWAIT
94
95
96 diff -Nru tcsh-6.19.00.orig/config/linux tcsh-6.19.00/config/linux
97 --- tcsh-6.19.00.orig/config/linux 2016-09-22 17:51:43.086924218 +0200
98 +++ tcsh-6.19.00/config/linux 2016-09-22 17:54:16.123662001 +0200
99 @@ -86,11 +86,11 @@
100 */
101
102 #define __STRICT_ANSI__
103 -#ifndef _BSD_SOURCE
104 -# define _BSD_SOURCE
105 +#ifndef _DEFAULT_SOURCE
106 +# define _DEFAULT_SOURCE
107 #endif
108 -#ifndef _SVID_SOURCE
109 -# define _SVID_SOURCE
110 +#ifndef _DEFAULT_SOURCE
111 +# define _DEFAULT_SOURCE
112 #endif
113 #ifndef _POSIX_SOURCE
114 # define _POSIX_SOURCE
|