Various C99 compatibility fixes

The first three patches are backports, texlive-base-c99-4.patch
has been submitted for upstream inclusion.

Related to:

  <https://fedoraproject.org/wiki/Changes/PortingToModernC>
  <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
This commit is contained in:
Florian Weimer 2023-01-31 08:03:11 +01:00
parent 715697a69e
commit 963e9ad7f2
5 changed files with 944 additions and 1 deletions

60
texlive-base-c99-1.patch Normal file
View File

@ -0,0 +1,60 @@
Backuport of upstream r64940: stdlib.h to placate clang16
2022-11-05 Sam James <sam@gentoo.org>
* configure.ac (Ghostscript version): #include <stdlib.h>
to declare exit and placate clang16.
https://tug.org/pipermail/tlbuild/2022q4/005269.html
Index: Build/source/texk/dvisvgm/configure
===================================================================
--- Build/source/texk/dvisvgm/configure (revision 64940)
+++ Build/source/texk/dvisvgm/configure (revision 64941)
@@ -23415,6 +23415,7 @@
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdio.h>
+ #include <stdlib.h>
#include <ghostscript/iapi.h>
int main () {
gsapi_revision_t r;
Index: Build/source/texk/dvisvgm/configure.ac
===================================================================
--- Build/source/texk/dvisvgm/configure.ac (revision 64940)
+++ Build/source/texk/dvisvgm/configure.ac (revision 64941)
@@ -94,6 +94,7 @@
# query Ghostscript version
AC_MSG_CHECKING([Ghostscript version])
AC_RUN_IFELSE([AC_LANG_SOURCE([#include <stdio.h>
+ #include <stdlib.h>
#include <ghostscript/iapi.h>
int main () {
gsapi_revision_t r;
Index: Build/source/texk/kpathsea/configure
===================================================================
--- Build/source/texk/kpathsea/configure (revision 64940)
+++ Build/source/texk/kpathsea/configure (revision 64941)
@@ -14633,7 +14633,8 @@
else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-int fork() { exit(1); }
+#include <stdlib.h>
+ int fork() { exit(1); }
int vfork() { exit(1); }
extern char *getcwd();
char path[100];
Index: Build/source/texk/kpathsea/configure.ac
===================================================================
--- Build/source/texk/kpathsea/configure.ac (revision 64940)
+++ Build/source/texk/kpathsea/configure.ac (revision 64941)
@@ -45,7 +45,8 @@
# We only need to run this if we have getcwd.
AC_CACHE_CHECK([whether getcwd uses fork or vfork],
[kb_cv_func_getcwd_forks],
- [AC_RUN_IFELSE([AC_LANG_PROGRAM([[int fork() { exit(1); }
+ [AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
+ int fork() { exit(1); }
int vfork() { exit(1); }
extern char *getcwd();
char path[100];]],

782
texlive-base-c99-2.patch Normal file
View File

@ -0,0 +1,782 @@
Backport of upstream revision r64953:
2022-11-06 Sam James <sam@gentoo.org>
* freetype-src/builds/unix/freetype2.m4: placate clang16.
https://tug.org/pipermail/tlbuild/2022q4/005273.html
2022-11-06 Karl Berry <karl@freefriends.org>
* patch-01-do-not-export-internal-zlib: add.
* patch-04-void-main: add (see ../ChangeLog).
2022-11-06 Sam James <sam@gentoo.org>
* libgd-src/tests/xpm/bug00185.c: placate clang16.
https://tug.org/pipermail/tlbuild/2022q4/005273.html
2022-11-06 Sam James <sam@gentoo.org>
* basename.c: placate clang16.
https://tug.org/pipermail/tlbuild/2022q4/005273.html
2022-11-06 Sam James <sam@gentoo.org>
* pmx-src/libf2c/main.c: placate clang16.
https://tug.org/pipermail/tlbuild/2022q4/005273.html
Index: Build/source/libs/freetype2/TLpatches/patch-01-do-not-export-internal-zlib
===================================================================
--- Build/source/libs/freetype2/TLpatches/patch-01-do-not-export-internal-zlib (nonexistent)
+++ Build/source/libs/freetype2/TLpatches/patch-01-do-not-export-internal-zlib (revision 64953)
@@ -0,0 +1,626 @@
+diff -ur freetype-2.12.1/src/gzip/adler32.c freetype-src/src/gzip/adler32.c
+--- freetype-2.12.1/src/gzip/adler32.c Fri Apr 01 17:24:23 2022
++++ freetype-src/src/gzip/adler32.c Thu May 05 07:23:26 2022
+@@ -62,7 +62,7 @@
+ #endif
+
+ /* ========================================================================= */
+-uLong ZEXPORT adler32_z(
++static uLong ZEXPORT adler32_z(
+ uLong adler,
+ const Bytef *buf,
+ z_size_t len)
+@@ -133,7 +133,7 @@
+ }
+
+ /* ========================================================================= */
+-uLong ZEXPORT adler32(
++static uLong ZEXPORT adler32(
+ uLong adler,
+ const Bytef *buf,
+ uInt len)
+@@ -173,7 +173,7 @@
+ }
+
+ /* ========================================================================= */
+-uLong ZEXPORT adler32_combine(
++static uLong ZEXPORT adler32_combine(
+ uLong adler1,
+ uLong adler2,
+ z_off_t len2)
+@@ -181,7 +181,7 @@
+ return adler32_combine_(adler1, adler2, len2);
+ }
+
+-uLong ZEXPORT adler32_combine64(
++static uLong ZEXPORT adler32_combine64(
+ uLong adler1,
+ uLong adler2,
+ z_off64_t len2)
+diff -ur freetype-2.12.1/src/gzip/crc32.c freetype-src/src/gzip/crc32.c
+--- freetype-2.12.1/src/gzip/crc32.c Fri Apr 01 16:13:52 2022
++++ freetype-src/src/gzip/crc32.c Fri May 06 12:34:16 2022
+@@ -583,7 +583,7 @@
+ * This function can be used by asm versions of crc32(), and to force the
+ * generation of the CRC tables in a threaded application.
+ */
+-const z_crc_t FAR * ZEXPORT get_crc_table()
++static const z_crc_t FAR * ZEXPORT get_crc_table()
+ {
+ #ifdef DYNAMIC_CRC_TABLE
+ once(&made, make_crc_table);
+@@ -610,7 +610,7 @@
+ #define Z_BATCH_ZEROS 0xa10d3d0c /* computed from Z_BATCH = 3990 */
+ #define Z_BATCH_MIN 800 /* fewest words in a final batch */
+
+-unsigned long ZEXPORT crc32_z(
++static unsigned long ZEXPORT crc32_z(
+ unsigned long crc,
+ const unsigned char FAR *buf,
+ z_size_t len)
+@@ -736,7 +736,7 @@
+ #endif
+
+ /* ========================================================================= */
+-unsigned long ZEXPORT crc32_z(
++static unsigned long ZEXPORT crc32_z(
+ unsigned long crc,
+ const unsigned char FAR *buf,
+ z_size_t len)
+@@ -1060,7 +1060,7 @@
+ #endif
+
+ /* ========================================================================= */
+-unsigned long ZEXPORT crc32(
++static unsigned long ZEXPORT crc32(
+ unsigned long crc,
+ const unsigned char FAR *buf,
+ uInt len)
+@@ -1069,7 +1069,7 @@
+ }
+
+ /* ========================================================================= */
+-uLong ZEXPORT crc32_combine64(
++static uLong ZEXPORT crc32_combine64(
+ uLong crc1,
+ uLong crc2,
+ z_off64_t len2)
+@@ -1081,7 +1081,7 @@
+ }
+
+ /* ========================================================================= */
+-uLong ZEXPORT crc32_combine(
++static uLong ZEXPORT crc32_combine(
+ uLong crc1,
+ uLong crc2,
+ z_off_t len2)
+@@ -1090,7 +1090,7 @@
+ }
+
+ /* ========================================================================= */
+-uLong ZEXPORT crc32_combine_gen64(
++static uLong ZEXPORT crc32_combine_gen64(
+ z_off64_t len2)
+ {
+ #ifdef DYNAMIC_CRC_TABLE
+@@ -1100,14 +1100,14 @@
+ }
+
+ /* ========================================================================= */
+-uLong ZEXPORT crc32_combine_gen(
++static uLong ZEXPORT crc32_combine_gen(
+ z_off_t len2)
+ {
+ return crc32_combine_gen64(len2);
+ }
+
+ /* ========================================================================= */
+-uLong crc32_combine_op(
++static uLong crc32_combine_op(
+ uLong crc1,
+ uLong crc2,
+ uLong op)
+diff -ur freetype-2.12.1/src/gzip/ftgzip.c freetype-src/src/gzip/ftgzip.c
+--- freetype-2.12.1/src/gzip/ftgzip.c Thu Jan 27 16:43:19 2022
++++ freetype-src/src/gzip/ftgzip.c Fri May 06 12:01:06 2022
+@@ -80,6 +80,9 @@
+ #define HAVE_HIDDEN 1
+ #define ZEXPORT
+ #define ZEXTERN static
++#else
++#define ZEXPORT
++#define ZEXTERN static
+ #endif
+
+ #define Z_SOLO 1
+@@ -160,7 +163,7 @@
+
+ #if !defined( FT_CONFIG_OPTION_SYSTEM_ZLIB ) && !defined( USE_ZLIB_ZCALLOC )
+
+- voidpf ZLIB_INTERNAL
++ static voidpf ZLIB_INTERNAL
+ zcalloc ( voidpf opaque,
+ unsigned items,
+ unsigned size )
+@@ -169,7 +172,7 @@
+ }
+
+
+- void ZLIB_INTERNAL
++ static void ZLIB_INTERNAL
+ zcfree( voidpf opaque,
+ voidpf ptr )
+ {
+diff -ur freetype-2.12.1/src/gzip/gzguts.h freetype-src/src/gzip/gzguts.h
+--- freetype-2.12.1/src/gzip/gzguts.h Fri Apr 01 17:24:23 2022
++++ freetype-src/src/gzip/gzguts.h Sat May 07 14:12:37 2022
+@@ -12,11 +12,8 @@
+ # endif
+ #endif
+
+-#ifdef HAVE_HIDDEN
+-# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
+-#else
+-# define ZLIB_INTERNAL
+-#endif
++/* we use "static" for all platforms */
++#define ZLIB_INTERNAL
+
+ #include <stdio.h>
+ #include "zlib.h"
+@@ -203,9 +200,9 @@
+ typedef gz_state FAR *gz_statep;
+
+ /* shared functions */
+-void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
++static void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
+ #if defined UNDER_CE
+-char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
++static char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
+ #endif
+
+ /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
+@@ -214,6 +211,6 @@
+ #ifdef INT_MAX
+ # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
+ #else
+-unsigned ZLIB_INTERNAL gz_intmax OF((void));
++static unsigned ZLIB_INTERNAL gz_intmax OF((void));
+ # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
+ #endif
+diff -ur freetype-2.12.1/src/gzip/infback.c freetype-src/src/gzip/infback.c
+--- freetype-2.12.1/src/gzip/infback.c Fri Apr 01 16:13:52 2022
++++ freetype-src/src/gzip/infback.c Thu May 05 07:24:06 2022
+@@ -25,7 +25,7 @@
+ windowBits is in the range 8..15, and window is a user-supplied
+ window and output buffer that is 2**windowBits bytes.
+ */
+-int ZEXPORT inflateBackInit_(
++static int ZEXPORT inflateBackInit_(
+ z_streamp strm,
+ int windowBits,
+ unsigned char FAR *window,
+@@ -247,7 +247,7 @@
+ inflateBack() can also return Z_STREAM_ERROR if the input parameters
+ are not correct, i.e. strm is Z_NULL or the state was not initialized.
+ */
+-int ZEXPORT inflateBack(
++static int ZEXPORT inflateBack(
+ z_streamp strm,
+ in_func in,
+ void FAR *in_desc,
+@@ -629,7 +629,7 @@
+ return ret;
+ }
+
+-int ZEXPORT inflateBackEnd(
++static int ZEXPORT inflateBackEnd(
+ z_streamp strm)
+ {
+ if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
+diff -ur freetype-2.12.1/src/gzip/inffast.c freetype-src/src/gzip/inffast.c
+--- freetype-2.12.1/src/gzip/inffast.c Fri Apr 01 16:13:52 2022
++++ freetype-src/src/gzip/inffast.c Fri May 06 12:01:59 2022
+@@ -47,7 +47,7 @@
+ requires strm->avail_out >= 258 for each loop to avoid checking for
+ output space.
+ */
+-void ZLIB_INTERNAL inflate_fast(
++static void ZLIB_INTERNAL inflate_fast(
+ z_streamp strm,
+ unsigned start)
+ {
+diff -ur freetype-2.12.1/src/gzip/inffast.h freetype-src/src/gzip/inffast.h
+--- freetype-2.12.1/src/gzip/inffast.h Fri Apr 01 16:13:52 2022
++++ freetype-src/src/gzip/inffast.h Fri May 06 12:25:15 2022
+@@ -8,4 +8,4 @@
+ subject to change. Applications should only use zlib.h.
+ */
+
+-void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
++static void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
+diff -ur freetype-2.12.1/src/gzip/inflate.c freetype-src/src/gzip/inflate.c
+--- freetype-2.12.1/src/gzip/inflate.c Fri Apr 01 17:25:55 2022
++++ freetype-src/src/gzip/inflate.c Thu May 05 07:24:18 2022
+@@ -118,7 +118,7 @@
+ return 0;
+ }
+
+-int ZEXPORT inflateResetKeep(
++static int ZEXPORT inflateResetKeep(
+ z_streamp strm)
+ {
+ struct inflate_state FAR *state;
+@@ -144,7 +144,7 @@
+ return Z_OK;
+ }
+
+-int ZEXPORT inflateReset(
++static int ZEXPORT inflateReset(
+ z_streamp strm)
+ {
+ struct inflate_state FAR *state;
+@@ -157,7 +157,7 @@
+ return inflateResetKeep(strm);
+ }
+
+-int ZEXPORT inflateReset2(
++static int ZEXPORT inflateReset2(
+ z_streamp strm,
+ int windowBits)
+ {
+@@ -195,7 +195,7 @@
+ return inflateReset(strm);
+ }
+
+-int ZEXPORT inflateInit2_(
++static int ZEXPORT inflateInit2_(
+ z_streamp strm,
+ int windowBits,
+ const char *version,
+@@ -239,7 +239,7 @@
+ return ret;
+ }
+
+-int ZEXPORT inflateInit_(
++static int ZEXPORT inflateInit_(
+ z_streamp strm,
+ const char *version,
+ int stream_size)
+@@ -249,7 +249,7 @@
+
+ #ifndef Z_FREETYPE
+
+-int ZEXPORT inflatePrime(
++static int ZEXPORT inflatePrime(
+ z_streamp strm,
+ int bits,
+ int value)
+@@ -626,7 +626,7 @@
+ will return Z_BUF_ERROR if it has not reached the end of the stream.
+ */
+
+-int ZEXPORT inflate(
++static int ZEXPORT inflate(
+ z_streamp strm,
+ int flush)
+ {
+@@ -1304,7 +1304,7 @@
+ return ret;
+ }
+
+-int ZEXPORT inflateEnd(
++static int ZEXPORT inflateEnd(
+ z_streamp strm)
+ {
+ struct inflate_state FAR *state;
+@@ -1320,7 +1320,7 @@
+
+ #ifndef Z_FREETYPE
+
+-int ZEXPORT inflateGetDictionary(
++static int ZEXPORT inflateGetDictionary(
+ z_streamp strm,
+ Bytef *dictionary,
+ uInt *dictLength)
+@@ -1343,7 +1343,7 @@
+ return Z_OK;
+ }
+
+-int ZEXPORT inflateSetDictionary(
++static int ZEXPORT inflateSetDictionary(
+ z_streamp strm,
+ const Bytef *dictionary,
+ uInt dictLength)
+@@ -1378,7 +1378,7 @@
+ return Z_OK;
+ }
+
+-int ZEXPORT inflateGetHeader(
++static int ZEXPORT inflateGetHeader(
+ z_streamp strm,
+ gz_headerp head)
+ {
+@@ -1429,7 +1429,7 @@
+ return next;
+ }
+
+-int ZEXPORT inflateSync(
++static int ZEXPORT inflateSync(
+ z_streamp strm)
+ {
+ unsigned len; /* number of bytes to look at or looked at */
+@@ -1489,7 +1489,7 @@
+ block. When decompressing, PPP checks that at the end of input packet,
+ inflate is waiting for these length bytes.
+ */
+-int ZEXPORT inflateSyncPoint(
++static int ZEXPORT inflateSyncPoint(
+ z_streamp strm)
+ {
+ struct inflate_state FAR *state;
+@@ -1501,7 +1501,7 @@
+
+ #ifndef Z_FREETYPE
+
+-int ZEXPORT inflateCopy(
++static int ZEXPORT inflateCopy(
+ z_streamp dest,
+ z_streamp source)
+ {
+@@ -1550,7 +1550,7 @@
+
+ #endif /* !Z_FREETYPE */
+
+-int ZEXPORT inflateUndermine(
++static int ZEXPORT inflateUndermine(
+ z_streamp strm,
+ int subvert)
+ {
+@@ -1568,7 +1568,7 @@
+ #endif
+ }
+
+-int ZEXPORT inflateValidate(
++static int ZEXPORT inflateValidate(
+ z_streamp strm,
+ int check)
+ {
+@@ -1585,7 +1585,7 @@
+
+ #ifndef Z_FREETYPE
+
+-long ZEXPORT inflateMark(
++static long ZEXPORT inflateMark(
+ z_streamp strm)
+ {
+ struct inflate_state FAR *state;
+@@ -1598,7 +1598,7 @@
+ (state->mode == MATCH ? state->was - state->length : 0));
+ }
+
+-unsigned long ZEXPORT inflateCodesUsed(
++static unsigned long ZEXPORT inflateCodesUsed(
+ z_streamp strm)
+ {
+ struct inflate_state FAR *state;
+diff -ur freetype-2.12.1/src/gzip/inftrees.c freetype-src/src/gzip/inftrees.c
+--- freetype-2.12.1/src/gzip/inftrees.c Fri Apr 01 16:13:52 2022
++++ freetype-src/src/gzip/inftrees.c Fri May 06 12:33:23 2022
+@@ -8,7 +8,7 @@
+
+ #define MAXBITS 15
+
+-const char inflate_copyright[] =
++static const char inflate_copyright[] =
+ " inflate 1.2.12 Copyright 1995-2022 Mark Adler ";
+ /*
+ If you use the zlib library in a product, an acknowledgment is welcome
+@@ -29,7 +29,7 @@
+ table index bits. It will differ if the request is greater than the
+ longest code or if it is less than the shortest code.
+ */
+-int ZLIB_INTERNAL inflate_table(
++static int ZLIB_INTERNAL inflate_table(
+ codetype type,
+ unsigned short FAR *lens,
+ unsigned codes,
+diff -ur freetype-2.12.1/src/gzip/inftrees.h freetype-src/src/gzip/inftrees.h
+--- freetype-2.12.1/src/gzip/inftrees.h Fri Apr 01 17:24:23 2022
++++ freetype-src/src/gzip/inftrees.h Fri May 06 12:25:35 2022
+@@ -60,7 +60,7 @@
+ DISTS
+ } codetype;
+
+-int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
++static int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
+ unsigned codes, code FAR * FAR *table,
+ unsigned FAR *bits, unsigned short FAR *work));
+
+diff -ur freetype-2.12.1/src/gzip/zutil.c freetype-src/src/gzip/zutil.c
+--- freetype-2.12.1/src/gzip/zutil.c Fri Apr 01 16:13:54 2022
++++ freetype-src/src/gzip/zutil.c Fri May 06 12:08:24 2022
+@@ -10,7 +10,7 @@
+ # include "gzguts.h"
+ #endif
+
+-z_const char * const z_errmsg[10] = {
++static z_const char * const z_errmsg[10] = {
+ (z_const char *)"need dictionary", /* Z_NEED_DICT 2 */
+ (z_const char *)"stream end", /* Z_STREAM_END 1 */
+ (z_const char *)"", /* Z_OK 0 */
+@@ -24,12 +24,12 @@
+ };
+
+
+-const char * ZEXPORT zlibVersion()
++static const char * ZEXPORT zlibVersion()
+ {
+ return ZLIB_VERSION;
+ }
+
+-uLong ZEXPORT zlibCompileFlags()
++static uLong ZEXPORT zlibCompileFlags()
+ {
+ uLong flags;
+
+@@ -117,9 +117,9 @@
+ # ifndef verbose
+ # define verbose 0
+ # endif
+-int ZLIB_INTERNAL z_verbose = verbose;
++static int ZLIB_INTERNAL z_verbose = verbose;
+
+-void ZLIB_INTERNAL z_error (
++static void ZLIB_INTERNAL z_error (
+ char *m)
+ {
+ fprintf(stderr, "%s\n", m);
+@@ -130,7 +130,7 @@
+ /* exported to allow conversion of error code to string for compress() and
+ * uncompress()
+ */
+-const char * ZEXPORT zError(
++static const char * ZEXPORT zError(
+ int err)
+ {
+ return ERR_MSG(err);
+@@ -146,7 +146,7 @@
+
+ #ifndef HAVE_MEMCPY
+
+-void ZLIB_INTERNAL zmemcpy(
++static void ZLIB_INTERNAL zmemcpy(
+ Bytef* dest,
+ const Bytef* source,
+ uInt len)
+@@ -157,7 +157,7 @@
+ } while (--len != 0);
+ }
+
+-int ZLIB_INTERNAL zmemcmp(
++static int ZLIB_INTERNAL zmemcmp(
+ const Bytef* s1,
+ const Bytef* s2,
+ uInt len)
+@@ -170,7 +170,7 @@
+ return 0;
+ }
+
+-void ZLIB_INTERNAL zmemzero(
++static void ZLIB_INTERNAL zmemzero(
+ Bytef* dest,
+ uInt len)
+ {
+@@ -214,7 +214,7 @@
+ * a protected system like OS/2. Use Microsoft C instead.
+ */
+
+-voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
++static voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
+ {
+ voidpf buf;
+ ulg bsize = (ulg)items*size;
+@@ -240,7 +240,7 @@
+ return buf;
+ }
+
+-void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
++static void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
+ {
+ int n;
+
+@@ -277,13 +277,13 @@
+ # define _hfree hfree
+ #endif
+
+-voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size)
++static voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size)
+ {
+ (void)opaque;
+ return _halloc((long)items, size);
+ }
+
+-void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
++static void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
+ {
+ (void)opaque;
+ _hfree(ptr);
+@@ -302,7 +302,7 @@
+ extern void free OF((voidpf ptr));
+ #endif
+
+-voidpf ZLIB_INTERNAL zcalloc (
++static voidpf ZLIB_INTERNAL zcalloc (
+ voidpf opaque,
+ unsigned items,
+ unsigned size)
+@@ -312,7 +312,7 @@
+ (voidpf)calloc(items, size);
+ }
+
+-void ZLIB_INTERNAL zcfree (
++static void ZLIB_INTERNAL zcfree (
+ voidpf opaque,
+ voidpf ptr)
+ {
+diff -ur freetype-2.12.1/src/gzip/zutil.h freetype-src/src/gzip/zutil.h
+--- freetype-2.12.1/src/gzip/zutil.h Fri Apr 01 17:24:23 2022
++++ freetype-src/src/gzip/zutil.h Sat May 07 14:13:48 2022
+@@ -13,11 +13,8 @@
+ #ifndef ZUTIL_H
+ #define ZUTIL_H
+
+-#ifdef HAVE_HIDDEN
+-# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
+-#else
+-# define ZLIB_INTERNAL
+-#endif
++/* we use "static" for all platforms */
++#define ZLIB_INTERNAL
+
+ #include "zlib.h"
+
+@@ -53,7 +50,7 @@
+ # endif
+ #endif
+
+-extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
++static z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
+ /* (size given to avoid silly warnings with Visual C++) */
+
+ #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
+@@ -235,16 +232,16 @@
+ # define zmemzero(dest, len) ft_memset(dest, 0, len)
+ # endif
+ #else
+- void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
+- int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
+- void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
++ static void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
++ static int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
++ static void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
+ #endif
+
+ /* Diagnostic functions */
+ #ifdef ZLIB_DEBUG
+ # include <stdio.h>
+- extern int ZLIB_INTERNAL z_verbose;
+- extern void ZLIB_INTERNAL z_error OF((char *m));
++ static int ZLIB_INTERNAL z_verbose;
++ static void ZLIB_INTERNAL z_error OF((char *m));
+ # define Assert(cond,msg) {if(!(cond)) z_error(msg);}
+ # define Trace(x) {if (z_verbose>=0) fprintf x ;}
+ # define Tracev(x) {if (z_verbose>0) fprintf x ;}
+@@ -261,9 +258,9 @@
+ #endif
+
+ #ifndef Z_SOLO
+- voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
++ static voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
+ unsigned size));
+- void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
++ static void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
+ #endif
+
+ #define ZALLOC(strm, items, size) \
Index: Build/source/libs/freetype2/TLpatches/patch-04-void-main
===================================================================
--- Build/source/libs/freetype2/TLpatches/patch-04-void-main (nonexistent)
+++ Build/source/libs/freetype2/TLpatches/patch-04-void-main (revision 64953)
@@ -0,0 +1,13 @@
+diff --git a/libs/freetype2/freetype-src/builds/unix/freetype2.m4 b/libs/freetype2/freetype-src/builds/unix/freetype2.m4
+index 0cafc8e8c..51843f5fa 100644
+--- a/libs/freetype2/freetype-src/builds/unix/freetype2.m4
++++ b/libs/freetype2/freetype-src/builds/unix/freetype2.m4
+@@ -121,7 +121,7 @@ AC_DEFUN([AC_CHECK_FT2],
+ #include <stdlib.h>
+
+ int
+-main()
++main(void)
+ {
+ FT_Library library;
+ FT_Error error;
Index: Build/source/libs/freetype2/freetype-src/builds/unix/freetype2.m4
===================================================================
--- Build/source/libs/freetype2/freetype-src/builds/unix/freetype2.m4 (revision 64952)
+++ Build/source/libs/freetype2/freetype-src/builds/unix/freetype2.m4 (revision 64953)
@@ -121,7 +121,7 @@
#include <stdlib.h>
int
-main()
+main(void)
{
FT_Library library;
FT_Error error;
Index: Build/source/libs/gd/TLpatches/patch-03-void-main
===================================================================
--- Build/source/libs/gd/TLpatches/patch-03-void-main (nonexistent)
+++ Build/source/libs/gd/TLpatches/patch-03-void-main (revision 64953)
@@ -0,0 +1,13 @@
+diff --git a/libs/gd/libgd-src/tests/xpm/bug00185.c b/libs/gd/libgd-src/tests/xpm/bug00185.c
+index 3056ed950..37659d6a4 100644
+--- a/libs/gd/libgd-src/tests/xpm/bug00185.c
++++ b/libs/gd/libgd-src/tests/xpm/bug00185.c
+@@ -5,7 +5,7 @@
+
+ /* To check memory leaks, run such as 'valgrind --leak-check=full ./bug00185' */
+ int
+-main()
++main(void)
+ {
+ gdImagePtr im;
+ char *path;
Index: Build/source/libs/gd/libgd-src/tests/xpm/bug00185.c
===================================================================
--- Build/source/libs/gd/libgd-src/tests/xpm/bug00185.c (revision 64952)
+++ Build/source/libs/gd/libgd-src/tests/xpm/bug00185.c (revision 64953)
@@ -5,7 +5,7 @@
/* To check memory leaks, run such as 'valgrind --leak-check=full ./bug00185' */
int
-main()
+main(void)
{
gdImagePtr im;
char *path;
Index: Build/source/texk/ps2pk/basename.c
===================================================================
--- Build/source/texk/ps2pk/basename.c (revision 64952)
+++ Build/source/texk/ps2pk/basename.c (revision 64953)
@@ -6,11 +6,12 @@
* AUTHOR: Piet Tutelaers
* VERSION: 1.0 (Sept. 1995)
*/
+#include <stdlib.h> /* exit() */
#include <stdio.h> /* printf() */
#include "basics.h" /* fatal() */
#include "filenames.h" /* basename() */
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
if (argc < 2 || argc > 3)
fatal("Usage: basename string [suffix]\n");
Index: Build/source/utils/m-tx/mtx-src/prepmx.c
===================================================================
--- Build/source/utils/m-tx/mtx-src/prepmx.c (revision 64952)
+++ Build/source/utils/m-tx/mtx-src/prepmx.c (revision 64953)
@@ -769,7 +769,7 @@
}
-main(int argc, Char *argv[])
+int main(int argc, Char *argv[])
{ /* ---- Main program ------------------------ */
PASCAL_MAIN(argc, argv);
strcpy(this_version, version);
Index: Build/source/utils/pmx/TLpatches/patch-01-main-ret
===================================================================
--- Build/source/utils/pmx/TLpatches/patch-01-main-ret (nonexistent)
+++ Build/source/utils/pmx/TLpatches/patch-01-main-ret (revision 64953)
@@ -0,0 +1,13 @@
+diff --git a/utils/pmx/pmx-src/libf2c/main.c b/utils/pmx/pmx-src/libf2c/main.c
+index 453974904..f485a0cd0 100644
+--- a/utils/pmx/pmx-src/libf2c/main.c
++++ b/utils/pmx/pmx-src/libf2c/main.c
+@@ -106,7 +106,7 @@ char **xargv;
+ #ifdef KR_headers
+ main(argc, argv) int argc; char **argv;
+ #else
+-main(int argc, char **argv)
++int main(int argc, char **argv)
+ #endif
+ {
+ xargc = argc;
Index: Build/source/utils/pmx/pmx-src/libf2c/main.c
===================================================================
--- Build/source/utils/pmx/pmx-src/libf2c/main.c (revision 64952)
+++ Build/source/utils/pmx/pmx-src/libf2c/main.c (revision 64953)
@@ -106,7 +106,7 @@
#ifdef KR_headers
main(argc, argv) int argc; char **argv;
#else
-main(int argc, char **argv)
+int main(int argc, char **argv)
#endif
{
xargc = argc;

35
texlive-base-c99-3.patch Normal file
View File

@ -0,0 +1,35 @@
Partial backport of this upstream revision:
------------------------------------------------------------------------
r65582 | hironobu | 2023-01-19 15:15:46 +0100 (Thu, 19 Jan 2023) | 1 line
synctexdir: update from GH
Relevant Git commit:
commit 2897465154892a7737dcc90e4d6a00a1d1b3922c
Author: Germán Poo-Caamaño <gpoo@gnome.org>
Date: Sat May 30 16:15:27 2020 -0400
Fix implicit declaration of vasprintf
Fix build when compiling with `-Werror=implicit-function-declaration`.
Index: Build/source/texk/web2c/synctexdir/synctex_parser.c
===================================================================
--- Build/source/texk/web2c/synctexdir/synctex_parser.c (revision 65581)
+++ Build/source/texk/web2c/synctexdir/synctex_parser.c (revision 65582)
@@ -83,6 +83,11 @@
* First level objects are sheets and forms, containing boxes, glues, kerns...
* The third tree allows to browse leaves according to tag and line.
*/
+/* Declare _GNU_SOURCE for accessing vasprintf. For MSC compiler, vasprintf is
+ * defined in this file
+ */
+#define _GNU_SOURCE
+
# if defined(SYNCTEX_USE_LOCAL_HEADER)
# include "synctex_parser_local.h"
# else

53
texlive-base-c99-4.patch Normal file
View File

@ -0,0 +1,53 @@
Fix the setsid-after-vfork configure check to avoid implicit
declarations of wait, exit. This ensures that the outcome of the
check does not change with compilers which do not support implicit
function declarations.
Submitted upstream:
<https://tug.org/pipermail/tex-live/2023-January/048833.html>
diff -up texlive-base-20220321/source/texk/xdvik/configure.c99-4 texlive-base-20220321/source/texk/xdvik/configure
--- texlive-base-20220321/source/texk/xdvik/configure.c99-4 2023-01-31 09:04:59.026325806 +0100
+++ texlive-base-20220321/source/texk/xdvik/configure 2023-01-31 09:05:14.250169332 +0100
@@ -16406,6 +16406,9 @@ else $as_nop
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
#ifdef HAVE_VFORK_H
#include <vfork.h>
#endif
@@ -16427,7 +16430,7 @@ main (void)
while (wait(&status) != child)
;
- exit(
+ _exit(
/* Was there some problem with vforking? */
child < 0
diff -up texlive-base-20220321/source/texk/xdvik/m4/xdvi-func-setsid-in-fork.m4.c99-4 texlive-base-20220321/source/texk/xdvik/m4/xdvi-func-setsid-in-fork.m4
--- texlive-base-20220321/source/texk/xdvik/m4/xdvi-func-setsid-in-fork.m4.c99-4 2023-01-31 08:45:31.417794738 +0100
+++ texlive-base-20220321/source/texk/xdvik/m4/xdvi-func-setsid-in-fork.m4 2023-01-31 08:45:43.901652431 +0100
@@ -22,6 +22,9 @@ AC_DEFUN([XDVI_FUNC_SETSID_IN_VFORK],
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
#ifdef HAVE_VFORK_H
#include <vfork.h>
#endif]],
@@ -40,7 +43,7 @@ AC_DEFUN([XDVI_FUNC_SETSID_IN_VFORK],
while (wait(&status) != child)
;
- exit(
+ _exit(
/* Was there some problem with vforking? */
child < 0

View File

@ -23,7 +23,7 @@
Name: %{shortname}-base
Version: %{source_date}
Release: 66%{?dist}
Release: 67%{?dist}
Epoch: 10
Summary: TeX formatting system
# The only files in the base package are directories, cache, and license texts
@ -506,6 +506,11 @@ Patch38: texlive-base-2022-dvisvgm-3.0.1.patch
# Fix issue with undefined vasprintf()
Patch39: texlive-base-20220321-vasprintf-fix.patch
Patch40: texlive-base-c99-1.patch
Patch41: texlive-base-c99-2.patch
Patch42: texlive-base-c99-3.patch
Patch43: texlive-base-c99-4.patch
# Can't do this because it causes everything else to be noarch
# BuildArch: noarch
BuildRequires: make
@ -7448,6 +7453,11 @@ done
# Fix issue with undefined vasprintf()
%patch39 -p1 -b .vasprintf
%patch40 -p1 -b .c99-1
%patch41 -p1 -b .c99-2
%patch42 -p1 -b .c99-3
%patch43 -p1 -b .c99-4
# Value here is "16" not "15" because we have a source0 at index 1.
# Source15 at index 16 is our first "normal" noarch source file.
# Also, this macro has to be here, not at the top, or it will not evaluate properly. :P
@ -10179,6 +10189,9 @@ yes | %{_bindir}/updmap-sys --quiet --syncwithtrees >/dev/null 2>&1 || :
%doc %{_texdir}/texmf-dist/doc/latex/yplan/
%changelog
* Tue Jan 31 2023 Florian Weimer <fweimer@redhat.com> - 10:20220321-67
- Various C99 compatibility fixes
* Mon Jan 30 2023 Tom Callaway <spot@fedoraproject.org> - 10:20220321-66
- conditionalize use of poppler (and disable it by default)
- fix issue where vasprintf() could be undefined in a build