Skip to content

Commit 3fb251b

Browse files
committed
Remove dummy structure declarations for old buggy compilers.
While woolly mammoths still roamed the Earth and before Atlantis sunk into the ocean, there were C compilers that could not handle forward structure references, e.g. "struct name;". zlib dutifully provided a work-around for such compilers. That work-around is no longer needed, and, per the recommendation of a security audit of the zlib code by Trail of Bits and TrustInSoft, in support of the Mozilla Foundation, should be removed since what a compiler will do with this is technically undefined. From the report: "there is no telling what interactions the bug could have in the future with link-time optimizations and type-based alias analyses, both features that are present (but not default) in clang."
1 parent 33a7aff commit 3fb251b

File tree

6 files changed

+0
-28
lines changed

6 files changed

+0
-28
lines changed

deflate.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,6 @@ local const config configuration_table[10] = {
151151
#define EQUAL 0
152152
/* result of memcmp for equal strings */
153153

154-
#ifndef NO_DUMMY_DECL
155-
struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
156-
#endif
157-
158154
/* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */
159155
#define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0))
160156

zconf.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,6 @@
224224
# define z_const
225225
#endif
226226

227-
/* Some Mac compilers merge all .h files incorrectly: */
228-
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
229-
# define NO_DUMMY_DECL
230-
#endif
231-
232227
/* Maximum value for memLevel in deflateInit2 */
233228
#ifndef MAX_MEM_LEVEL
234229
# ifdef MAXSEG_64K

zconf.h.cmakein

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,6 @@
226226
# define z_const
227227
#endif
228228

229-
/* Some Mac compilers merge all .h files incorrectly: */
230-
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
231-
# define NO_DUMMY_DECL
232-
#endif
233-
234229
/* Maximum value for memLevel in deflateInit2 */
235230
#ifndef MAX_MEM_LEVEL
236231
# ifdef MAXSEG_64K

zconf.h.in

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,6 @@
224224
# define z_const
225225
#endif
226226

227-
/* Some Mac compilers merge all .h files incorrectly: */
228-
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
229-
# define NO_DUMMY_DECL
230-
#endif
231-
232227
/* Maximum value for memLevel in deflateInit2 */
233228
#ifndef MAX_MEM_LEVEL
234229
# ifdef MAXSEG_64K

zlib.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,11 +1759,6 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
17591759

17601760
#endif /* !Z_SOLO */
17611761

1762-
/* hack for buggy compilers */
1763-
#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
1764-
struct internal_state {int dummy;};
1765-
#endif
1766-
17671762
/* undocumented functions */
17681763
ZEXTERN const char * ZEXPORT zError OF((int));
17691764
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));

zutil.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
# include "gzguts.h"
1111
#endif
1212

13-
#ifndef NO_DUMMY_DECL
14-
struct internal_state {int dummy;}; /* for buggy compilers */
15-
#endif
16-
1713
z_const char * const z_errmsg[10] = {
1814
"need dictionary", /* Z_NEED_DICT 2 */
1915
"stream end", /* Z_STREAM_END 1 */

0 commit comments

Comments
 (0)