commit:     aecf0e611fd26ef621d8096459595cc6ccba3c49
Author:     Mario Haustein <mario.haustein <AT> hrz <DOT> tu-chemnitz <DOT> de>
AuthorDate: Tue Jan 23 07:12:36 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jan 24 13:37:35 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aecf0e61

media-gfx/transfig: fix modern C issues

Closes: https://bugs.gentoo.org/875419
Signed-off-by: Mario Haustein <mario.haustein <AT> hrz.tu-chemnitz.de>
Closes: https://github.com/gentoo/gentoo/pull/34971
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../transfig/files/transfig-3.2.5e-clang-17.patch  | 258 +++++++++++++++++++++
 media-gfx/transfig/transfig-3.2.5e-r2.ebuild       |   1 +
 2 files changed, 259 insertions(+)

diff --git a/media-gfx/transfig/files/transfig-3.2.5e-clang-17.patch 
b/media-gfx/transfig/files/transfig-3.2.5e-clang-17.patch
new file mode 100644
index 000000000000..a4b68f22e55e
--- /dev/null
+++ b/media-gfx/transfig/files/transfig-3.2.5e-clang-17.patch
@@ -0,0 +1,258 @@
+diff --git a/fig2dev/dev/genibmgl.c b/fig2dev/dev/genibmgl.c
+index a14b96f..e24b181 100644
+--- a/fig2dev/dev/genibmgl.c
++++ b/fig2dev/dev/genibmgl.c
+@@ -50,7 +50,7 @@
+ #include "fig2dev.h"
+ #include "object.h"
+ 
+-static set_style();
++static void set_style();
+ 
+ #define               FONTS                   35
+ #define               COLORS                  8
+@@ -458,7 +458,7 @@ F_compound *objects;
+           fprintf(tfp, "VS%.2f;\n", pen_speed);
+ }
+ 
+-static arc_tangent(x1, y1, x2, y2, direction, x, y)
++static void arc_tangent(x1, y1, x2, y2, direction, x, y)
+ double        x1, y1, x2, y2, *x, *y;
+ int   direction;
+ {
+@@ -474,7 +474,7 @@ int        direction;
+ 
+ /*    draw arrow heading from (x1, y1) to (x2, y2)    */
+ 
+-static draw_arrow_head(x1, y1, x2, y2, arrowht, arrowwid)
++static void draw_arrow_head(x1, y1, x2, y2, arrowht, arrowwid)
+ double        x1, y1, x2, y2, arrowht, arrowwid;
+ {
+       double  x, y, xb, yb, dx, dy, l, sina, cosa;
+@@ -512,7 +512,7 @@ double     x1, y1, x2, y2, arrowht, arrowwid;
+ /* 
+  * set_style - issue line style commands as appropriate
+  */
+-static set_style(style, length)
++static void set_style(style, length)
+ int   style;
+ double        length;
+ {
+@@ -567,7 +567,7 @@ double     length;
+  * set_width - issue line width commands as appropriate
+  *            NOTE: HPGL/2 command used
+  */
+-static set_width(w)
++static int set_width(w)
+     int       w;
+ {
+     static int current_width=-1;
+@@ -585,7 +585,7 @@ static set_width(w)
+ /* 
+  * set_color - issue line color commands as appropriate
+  */
+-static set_color(color)
++static void set_color(color)
+     int       color;
+ {
+     static    int     number           = 0;   /* 1 <= number <= 8             
*/
+@@ -604,7 +604,7 @@ static set_color(color)
+           }
+ }
+ 
+-static fill_polygon(pattern, color)
++static void fill_polygon(pattern, color)
+     int       pattern;
+     int       color;
+ {
+@@ -876,7 +876,7 @@ void genibmgl_line(l)
+ 
+ #define               THRESHOLD       .05     /* inch */
+ 
+-static bezier_spline(a0, b0, a1, b1, a2, b2, a3, b3)
++static void bezier_spline(a0, b0, a1, b1, a2, b2, a3, b3)
+     double    a0, b0, a1, b1, a2, b2, a3, b3;
+ {
+       double  x0, y0, x3, y3;
+@@ -932,7 +932,7 @@ F_spline   *s;
+                   s->for_arrow->ht/ppi, s->for_arrow->wid/ppi);
+       }
+ 
+-static quadratic_spline(a1, b1, a2, b2, a3, b3, a4, b4)
++static void quadratic_spline(a1, b1, a2, b2, a3, b3, a4, b4)
+ double        a1, b1, a2, b2, a3, b3, a4, b4;
+ {
+       double  x1, y1, x4, y4;
+diff --git a/fig2dev/dev/genpstex.c b/fig2dev/dev/genpstex.c
+index 7ab1fb5..8768d4e 100644
+--- a/fig2dev/dev/genpstex.c
++++ b/fig2dev/dev/genpstex.c
+@@ -42,6 +42,7 @@
+ #include "genpdf.h"
+ #include "object.h"
+ #include "texfonts.h"
++#include "setfigfont.h"
+ 
+ extern double rad2deg;
+ 
+@@ -105,7 +106,7 @@ static void genpstex_p_finalize_objects(int depth);
+ 
+ /*************************************************************************
+  *************************************************************************/
+-static
++static int
+ translate2(xp, yp)
+   int *xp, *yp;
+ {
+@@ -113,7 +114,7 @@ translate2(xp, yp)
+       *yp = (double)(TOP - *yp -1);
+       }
+ 
+-static
++static int
+ translate1_d(xp, yp)
+   double      *xp, *yp;
+ {
+@@ -121,7 +122,7 @@ translate1_d(xp, yp)
+       *yp = *yp + 1.0;
+       }
+ 
+-static
++static int
+ translate2_d(xp, yp)
+   double      *xp, *yp;
+ {
+diff --git a/fig2dev/dev/genshape.c b/fig2dev/dev/genshape.c
+index f59448d..b320605 100644
+--- a/fig2dev/dev/genshape.c
++++ b/fig2dev/dev/genshape.c
+@@ -97,7 +97,7 @@ struct shapegroup {
+ typedef struct shapegroup shapegroup;
+ 
+ static shapegroup *shapegroups;
+-static num_shapegroups=0;
++static int num_shapegroups=0;
+ 
+ 
+ static void alloc_arrays() {
+@@ -615,7 +615,7 @@ static intersect_point *intersect_points=NULL;
+ static int MAX_INTERSECTPOINTS=0;
+ #define INTERSECTPOINT_INC 100
+ 
+-static realloc_intersects(int minimum) {
++static void realloc_intersects(int minimum) {
+   while (minimum>=MAX_INTERSECTPOINTS) {
+     MAX_INTERSECTPOINTS+=INTERSECTPOINT_INC;
+     intersect_points=realloc(intersect_points, 
sizeof(intersect_points[0])*MAX_INTERSECTPOINTS);
+diff --git a/fig2dev/dev/readpcx.c b/fig2dev/dev/readpcx.c
+index 5b2d3d0..47270da 100644
+--- a/fig2dev/dev/readpcx.c
++++ b/fig2dev/dev/readpcx.c
+@@ -72,7 +72,7 @@ void dispbyte(unsigned char *ptr,int *xp,int *yp,int c,int 
w,int h,
+ 
+ void pcx_decode();
+ 
+-_read_pcx(pcxfile,pic)
++int _read_pcx(pcxfile,pic)
+     FILE      *pcxfile;
+     F_pic     *pic;
+ {
+diff --git a/fig2dev/fig2dev.c b/fig2dev/fig2dev.c
+index 93df432..a0b829e 100644
+--- a/fig2dev/fig2dev.c
++++ b/fig2dev/fig2dev.c
+@@ -373,7 +373,7 @@ grid_usage()
+      fprintf(stderr,"  Ignoring grid.\n");
+ }
+ 
+-main(argc, argv)
++void main(argc, argv)
+ int    argc;
+ char  *argv[];
+ {
+diff --git a/fig2dev/fig2dev.h b/fig2dev/fig2dev.h
+index 512cddf..346793f 100644
+--- a/fig2dev/fig2dev.h
++++ b/fig2dev/fig2dev.h
+@@ -160,6 +160,10 @@ extern Boolean    psencode_header_done; /* if we have 
already emitted PSencode head
+ extern Boolean        transp_header_done;   /* if we have already emitted 
transparent image header */
+ extern Boolean        grayonly;       /* convert colors to grayscale (-N 
option) */
+ 
++static void     arc_tangent(double x1, double y1, double x2, double y2, int 
direction, double *x, double *y);
++extern void    arc_tangent_int(double x1, double y1, double x2, double y2, 
int direction, int *x, int *y);
++extern int      depth_filter(int);
++
+ struct paperdef
+ {
+     char *name;                       /* name for paper size */
+diff --git a/fig2dev/latex_line.c b/fig2dev/latex_line.c
+index cede1d2..cef37d0 100644
+--- a/fig2dev/latex_line.c
++++ b/fig2dev/latex_line.c
+@@ -173,7 +173,7 @@ get_slope(dx, dy, sxp, syp, arrow)
+     if (dy < 0) *syp = -*syp;
+ }
+ 
+-latex_endpoint(x1, y1, x2, y2, xout, yout, arrow, magnet)
++void latex_endpoint(x1, y1, x2, y2, xout, yout, arrow, magnet)
+     int  x1, y1, x2, y2;
+     int  *xout, *yout;
+     int  arrow, magnet;
+diff --git a/transfig/sys.c b/transfig/sys.c
+index 8d78394..f2fc227 100644
+--- a/transfig/sys.c
++++ b/transfig/sys.c
+@@ -14,6 +14,12 @@
+  *
+  */
+ 
++#define _POSIX_SOURCE
++#include <fcntl.h>
++#include <sys/stat.h>
++#include <sys/types.h>
++#include <unistd.h>
++#undef _POSIX_SOURCE
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -41,7 +47,7 @@ char *sysls()
+   return sysbuf;
+ }
+ 
+-sysmv(file)
++void sysmv(file)
+ char *file;
+ {
+   sprintf(sysbuf, "%s~", file);
+diff --git a/transfig/transfig.c b/transfig/transfig.c
+index 798d05a..0688e84 100644
+--- a/transfig/transfig.c
++++ b/transfig/transfig.c
+@@ -26,6 +26,7 @@
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <string.h>
+ #include "patchlevel.h"
+ #include "transfig.h"
+ 
+@@ -87,7 +88,7 @@ char *iname[] = {
+       "ps",
+       "eps"};
+  
+-main(argc, argv)
++int main(argc, argv)
+ int argc;
+ char *argv[];
+ {
+diff --git a/transfig/transfig.h b/transfig/transfig.h
+index 6773e29..0bf0d50 100644
+--- a/transfig/transfig.h
++++ b/transfig/transfig.h
+@@ -56,3 +56,6 @@ extern char *txfile, *mkfile;
+ extern char *optarg;
+ extern int optind;
+ 
++extern void sysmv();
++extern void makefile();
++extern void texfile();

diff --git a/media-gfx/transfig/transfig-3.2.5e-r2.ebuild 
b/media-gfx/transfig/transfig-3.2.5e-r2.ebuild
index 1023a8bf3799..ebb7a376390f 100644
--- a/media-gfx/transfig/transfig-3.2.5e-r2.ebuild
+++ b/media-gfx/transfig/transfig-3.2.5e-r2.ebuild
@@ -40,6 +40,7 @@ PATCHES=(
        
"${WORKDIR}/${P}-gentoo-patchset/${PN}-3.2.5e-fprintf_format_warnings.patch"
        "${FILESDIR}/${PN}-3.2.5e-gcc10-fno-common.patch"
        "${FILESDIR}/${PN}-3.2.5e-clang.patch"
+       "${FILESDIR}/${PN}-3.2.5e-clang-17.patch"
 )
 
 DOCS=( README CHANGES LATEX.AND.XFIG NOTES )

Reply via email to