summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2023-01-14 07:49:18 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-01-16 10:42:07 +0000
commitde4432ba8b0dc7a427268e995cb04008aa7826c8 (patch)
tree077aae514d65ea236123228be800ffe2cf8a25f7
parentbe0cb1a7119b7e9cf2f1c89e73270b16ba4d1906 (diff)
downloadpoky-de4432ba8b0dc7a427268e995cb04008aa7826c8.tar.gz
groff: Drop use of `register` storage class
Backport a patch to make it work with c17 standard (From OE-Core rev: c209d8768dfbbbf4b9003a4fbb335d76b276e1a8) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-extended/groff/files/0001-Fix-code-style-issues.patch536
-rw-r--r--meta/recipes-extended/groff/groff_1.22.4.bb3
2 files changed, 538 insertions, 1 deletions
diff --git a/meta/recipes-extended/groff/files/0001-Fix-code-style-issues.patch b/meta/recipes-extended/groff/files/0001-Fix-code-style-issues.patch
new file mode 100644
index 0000000000..221490d6a3
--- /dev/null
+++ b/meta/recipes-extended/groff/files/0001-Fix-code-style-issues.patch
@@ -0,0 +1,536 @@
1From 99313d5c0ff35da6627e7dc985612f990ca64637 Mon Sep 17 00:00:00 2001
2From: "G. Branden Robinson" <g.branden.robinson@gmail.com>
3Date: Mon, 16 Aug 2021 12:37:22 +1000
4Subject: [PATCH] Fix code style issues.
5
6* src/preproc/grn/hgraph.cpp:
7* src/preproc/grn/hpoint.cpp:
8* src/preproc/grn/main.cpp:
9* src/preproc/grn/hdb.cpp: Drop use of `register` storage class.
10
11* src/preproc/grn/hgraph.cpp (len, HGPrintElt, picurve):
12* src/preproc/grn/hdb.cpp (DBRead): Wrap long lines.
13
14* src/preproc/grn/hgraph.cpp: Rename function from `Paramaterize` to
15 `Parameterize`.
16
17 (HGCurve): Update call site.
18
19* src/preproc/grn/main.cpp (add_file): Drop redundant cast in
20 `realloc()` call.
21
22 (conv, interpret): Use standard English in diagnostic messages.
23
24Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/groff.git/commit/?id=eead5f5cf1dedc6d180bdb34914d7157d39e270c]
25Signed-off-by: Khem Raj <raj.khem@gmail.com>
26---
27 src/preproc/grn/hdb.cpp | 20 +++---
28 src/preproc/grn/hgraph.cpp | 131 +++++++++++++++++++------------------
29 src/preproc/grn/hpoint.cpp | 2 +-
30 src/preproc/grn/main.cpp | 38 +++++------
31 4 files changed, 100 insertions(+), 91 deletions(-)
32
33diff --git a/src/preproc/grn/hdb.cpp b/src/preproc/grn/hdb.cpp
34index c61e099..2b4011b 100644
35--- a/src/preproc/grn/hdb.cpp
36+++ b/src/preproc/grn/hdb.cpp
37@@ -35,7 +35,7 @@ extern POINT *PTInit();
38 extern POINT *PTMakePoint(double x, double y, POINT ** pplist);
39
40
41-int DBGetType(register char *s);
42+int DBGetType(char *s);
43
44
45 /*
46@@ -61,7 +61,7 @@ DBCreateElt(int type,
47 char *text,
48 ELT **db)
49 {
50- register ELT *temp;
51+ ELT *temp = 0;
52
53 temp = (ELT *) malloc(sizeof(ELT));
54 temp->nextelt = *db;
55@@ -80,11 +80,11 @@ DBCreateElt(int type,
56 * pointer to that database.
57 */
58 ELT *
59-DBRead(register FILE *file)
60+DBRead(FILE *file)
61 {
62- register int i;
63- register int done; /* flag for input exhausted */
64- register double nx; /* x holder so x is not set before orienting */
65+ int i;
66+ int done; /* flag for input exhausted */
67+ double nx; /* x holder so x is not set before orienting */
68 int type; /* element type */
69 ELT *elist; /* pointer to the file's elements */
70 POINT *plist; /* pointer for reading in points */
71@@ -112,7 +112,9 @@ DBRead(register FILE *file)
72 /* if (fscanf(file,"%" MAXSTRING_S "s\n", string) == EOF) */
73 /* I changed the scanf format because the element */
74 /* can have two words (e.g. CURVE SPLINE) */
75- if (fscanf(file, "\n%" MAXSTRING_S "[^\n]%*[^\n]\n", string) == EOF) {
76+ if (fscanf(file, "\n%"
77+ MAXSTRING_S
78+ "[^\n]%*[^\n]\n", string) == EOF) {
79 error("'%1', error in file format", gremlinfile);
80 return (elist);
81 }
82@@ -209,7 +211,7 @@ DBRead(register FILE *file)
83 * New file format has literal names for element types.
84 */
85 int
86-DBGetType(register char *s)
87+DBGetType(char *s)
88 {
89 if (isdigit(s[0]) || (s[0] == '-')) /* old element format or EOF */
90 return (atoi(s));
91@@ -298,7 +300,7 @@ xscanf(FILE *f,
92 double *xp,
93 double *yp)
94 {
95- register int c, i, j, m, frac;
96+ int c, i, j, m, frac;
97 int iscale = 1, jscale = 1; /* x = i/scale, y=j/jscale */
98
99 while ((c = getc(f)) == ' ');
100diff --git a/src/preproc/grn/hgraph.cpp b/src/preproc/grn/hgraph.cpp
101index dbc0086..ad051ea 100644
102--- a/src/preproc/grn/hgraph.cpp
103+++ b/src/preproc/grn/hgraph.cpp
104@@ -14,7 +14,8 @@
105 #define PointsPerInterval 64
106 #define pi 3.14159265358979324
107 #define twopi (2.0 * pi)
108-#define len(a, b) groff_hypot((double)(b.x-a.x), (double)(b.y-a.y))
109+#define len(a, b) groff_hypot((double)(b.x-a.x), \
110+ (double)(b.y-a.y))
111
112
113 extern int dotshifter; /* for the length of dotted curves */
114@@ -48,7 +49,7 @@ extern double adj4;
115 extern int res;
116
117 void HGSetFont(int font, int size);
118-void HGPutText(int justify, POINT pnt, register char *string);
119+void HGPutText(int justify, POINT pnt, char *string);
120 void HGSetBrush(int mode);
121 void tmove2(int px, int py);
122 void doarc(POINT cp, POINT sp, int angle);
123@@ -58,10 +59,10 @@ void drawwig(POINT * ptr, int type);
124 void HGtline(int x1, int y1);
125 void deltax(double x);
126 void deltay(double y);
127-void HGArc(register int cx, register int cy, int px, int py, int angle);
128-void picurve(register int *x, register int *y, int npts);
129+void HGArc(int cx, int cy, int px, int py, int angle);
130+void picurve(int *x, int *y, int npts);
131 void HGCurve(int *x, int *y, int numpoints);
132-void Paramaterize(int x[], int y[], double h[], int n);
133+void Parameterize(int x[], int y[], double h[], int n);
134 void PeriodicSpline(double h[], int z[],
135 double dz[], double d2z[], double d3z[],
136 int npoints);
137@@ -83,10 +84,10 @@ void
138 HGPrintElt(ELT *element,
139 int /* baseline */)
140 {
141- register POINT *p1;
142- register POINT *p2;
143- register int length;
144- register int graylevel;
145+ POINT *p1;
146+ POINT *p2;
147+ int length;
148+ int graylevel;
149
150 if (!DBNullelt(element) && !Nullpoint((p1 = element->ptlist))) {
151 /* p1 always has first point */
152@@ -168,7 +169,8 @@ HGPrintElt(ELT *element,
153
154 if (polyfill == FILL || polyfill == BOTH) {
155 /* do the interior */
156- char command = (polyfill == BOTH && element->brushf) ? 'p' : 'P';
157+ char command = (polyfill == BOTH && element->brushf)
158+ ? 'p' : 'P';
159
160 /* include outline, if there is one and */
161 /* the -p flag was set */
162@@ -278,7 +280,7 @@ HGPrintElt(ELT *element,
163 void
164 HGPutText(int justify,
165 POINT pnt,
166- register char *string)
167+ char *string)
168 {
169 int savelasty = lasty; /* vertical motion for text is to be */
170 /* ignored. Save current y here */
171@@ -387,7 +389,7 @@ HGSetFont(int font,
172 void
173 HGSetBrush(int mode)
174 {
175- register int printed = 0;
176+ int printed = 0;
177
178 if (linmod != style[--mode]) {
179 /* Groff doesn't understand \Ds, so we take it out */
180@@ -417,7 +419,7 @@ HGSetBrush(int mode)
181 void
182 deltax(double x)
183 {
184- register int ix = (int) (x * troffscale);
185+ int ix = (int) (x * troffscale);
186
187 printf(" %du", ix - lastx);
188 lastx = ix;
189@@ -437,7 +439,7 @@ deltax(double x)
190 void
191 deltay(double y)
192 {
193- register int iy = (int) (y * troffscale);
194+ int iy = (int) (y * troffscale);
195
196 printf(" %du", iy - lastyline);
197 lastyline = iy;
198@@ -457,8 +459,8 @@ void
199 tmove2(int px,
200 int py)
201 {
202- register int dx;
203- register int dy;
204+ int dx;
205+ int dy;
206
207 if ((dy = py - lasty)) {
208 printf("\\v'%du'", dy);
209@@ -483,10 +485,10 @@ tmove2(int px,
210 void
211 tmove(POINT * ptr)
212 {
213- register int ix = (int) (ptr->x * troffscale);
214- register int iy = (int) (ptr->y * troffscale);
215- register int dx;
216- register int dy;
217+ int ix = (int) (ptr->x * troffscale);
218+ int iy = (int) (ptr->y * troffscale);
219+ int dx;
220+ int dy;
221
222 if ((dy = iy - lasty)) {
223 printf(".sp %du\n", dy);
224@@ -547,7 +549,7 @@ void
225 drawwig(POINT * ptr,
226 int type)
227 {
228- register int npts; /* point list index */
229+ int npts; /* point list index */
230 int x[MAXPOINTS], y[MAXPOINTS]; /* point list */
231
232 for (npts = 1; !Nullpoint(ptr); ptr = PTNextPoint(ptr), npts++) {
233@@ -574,20 +576,20 @@ drawwig(POINT * ptr,
234 *----------------------------------------------------------------------------*/
235
236 void
237-HGArc(register int cx,
238- register int cy,
239+HGArc(int cx,
240+ int cy,
241 int px,
242 int py,
243 int angle)
244 {
245 double xs, ys, resolution, fullcircle;
246 int m;
247- register int mask;
248- register int extent;
249- register int nx;
250- register int ny;
251- register int length;
252- register double epsilon;
253+ int mask;
254+ int extent;
255+ int nx;
256+ int ny;
257+ int length;
258+ double epsilon;
259
260 xs = px - cx;
261 ys = py - cy;
262@@ -633,15 +635,15 @@ HGArc(register int cx,
263 *----------------------------------------------------------------------------*/
264
265 void
266-picurve(register int *x,
267- register int *y,
268+picurve(int *x,
269+ int *y,
270 int npts)
271 {
272- register int nseg; /* effective resolution for each curve */
273- register int xp; /* current point (and temporary) */
274- register int yp;
275- int pxp, pyp; /* previous point (to make lines from) */
276- int i; /* inner curve segment traverser */
277+ int nseg; /* effective resolution for each curve */
278+ int xp; /* current point (and temporary) */
279+ int yp;
280+ int pxp, pyp; /* previous point (to make lines from) */
281+ int i; /* inner curve segment traverser */
282 int length = 0;
283 double w; /* position factor */
284 double t1, t2, t3; /* calculation temps */
285@@ -671,7 +673,8 @@ picurve(register int *x,
286 /* 'nseg' is the number of line */
287 /* segments that will be drawn for */
288 /* each curve segment. */
289- nseg = (int) ((double) (nseg + (int) groff_hypot((double) xp, (double) yp)) /
290+ nseg = (int) ((double) (nseg + (int) groff_hypot((double) xp,
291+ (double) yp)) /
292 res * PointsPerInterval);
293
294 for (i = 1; i < nseg; i++) {
295@@ -710,10 +713,10 @@ HGCurve(int *x,
296 double h[MAXPOINTS], dx[MAXPOINTS], dy[MAXPOINTS];
297 double d2x[MAXPOINTS], d2y[MAXPOINTS], d3x[MAXPOINTS], d3y[MAXPOINTS];
298 double t, t2, t3;
299- register int j;
300- register int k;
301- register int nx;
302- register int ny;
303+ int j;
304+ int k;
305+ int nx;
306+ int ny;
307 int lx, ly;
308 int length = 0;
309
310@@ -725,7 +728,7 @@ HGCurve(int *x,
311 * Solve for derivatives of the curve at each point separately for x and y
312 * (parametric).
313 */
314- Paramaterize(x, y, h, numpoints);
315+ Parameterize(x, y, h, numpoints);
316
317 /* closed curve */
318 if ((x[1] == x[numpoints]) && (y[1] == y[numpoints])) {
319@@ -771,15 +774,15 @@ HGCurve(int *x,
320 *----------------------------------------------------------------------------*/
321
322 void
323-Paramaterize(int x[],
324+Parameterize(int x[],
325 int y[],
326 double h[],
327 int n)
328 {
329- register int dx;
330- register int dy;
331- register int i;
332- register int j;
333+ int dx;
334+ int dy;
335+ int i;
336+ int j;
337 double u[MAXPOINTS];
338
339 for (i = 1; i <= n; ++i) {
340@@ -937,9 +940,9 @@ NaturalEndSpline(double h[], /* parameterization */
341 *----------------------------------------------------------------------------*/
342
343 void
344-change(register int x,
345- register int y,
346- register int vis)
347+change(int x,
348+ int y,
349+ int vis)
350 {
351 static int length = 0;
352
353@@ -967,17 +970,17 @@ void
354 HGtline(int x_1,
355 int y_1)
356 {
357- register int x_0 = lastx;
358- register int y_0 = lasty;
359- register int dx;
360- register int dy;
361- register int oldcoord;
362- register int res1;
363- register int visible;
364- register int res2;
365- register int xinc;
366- register int yinc;
367- register int dotcounter;
368+ int x_0 = lastx;
369+ int y_0 = lasty;
370+ int dx;
371+ int dy;
372+ int oldcoord;
373+ int res1;
374+ int visible;
375+ int res2;
376+ int xinc;
377+ int yinc;
378+ int dotcounter;
379
380 if (linmod == SOLID) {
381 line(x_1, y_1);
382@@ -1045,4 +1048,8 @@ HGtline(int x_1,
383 change(x_1, y_1, 0);
384 }
385
386-/* EOF */
387+// Local Variables:
388+// fill-column: 72
389+// mode: C++
390+// End:
391+// vim: set cindent noexpandtab shiftwidth=2 textwidth=72:
392diff --git a/src/preproc/grn/hpoint.cpp b/src/preproc/grn/hpoint.cpp
393index b581cb0..77bfc9d 100644
394--- a/src/preproc/grn/hpoint.cpp
395+++ b/src/preproc/grn/hpoint.cpp
396@@ -32,7 +32,7 @@ PTMakePoint(double x,
397 double y,
398 POINT **pplist)
399 {
400- register POINT *pt;
401+ POINT *pt;
402
403 if (Nullpoint(pt = *pplist)) { /* empty list */
404 *pplist = (POINT *) malloc(sizeof(POINT));
405diff --git a/src/preproc/grn/main.cpp b/src/preproc/grn/main.cpp
406index 833fd60..d1887b6 100644
407--- a/src/preproc/grn/main.cpp
408+++ b/src/preproc/grn/main.cpp
409@@ -88,7 +88,7 @@ extern "C" const char *Version_string;
410
411 extern void HGPrintElt(ELT *element, int baseline);
412 extern ELT *DBInit();
413-extern ELT *DBRead(register FILE *file);
414+extern ELT *DBRead(FILE *file);
415 extern POINT *PTInit();
416 extern POINT *PTMakePoint(double x, double y, POINT **pplist);
417
418@@ -231,9 +231,9 @@ int compatibility_flag = FALSE; /* TRUE if in compatibility mode */
419
420 void getres();
421 int doinput(FILE *fp);
422-void conv(register FILE *fp, int baseline);
423+void conv(FILE *fp, int baseline);
424 void savestate();
425-int has_polygon(register ELT *elist);
426+int has_polygon(ELT *elist);
427 void interpret(char *line);
428
429
430@@ -256,7 +256,7 @@ add_file(char **file,
431 {
432 if (*count >= *cur_size) {
433 *cur_size += FILE_SIZE_INCR;
434- file = (char **) realloc((char **) file, *cur_size * sizeof(char *));
435+ file = (char **) realloc(file, *cur_size * sizeof(char *));
436 if (file == NULL) {
437 fatal("unable to extend file array");
438 }
439@@ -283,9 +283,9 @@ main(int argc,
440 {
441 setlocale(LC_NUMERIC, "C");
442 program_name = argv[0];
443- register FILE *fp;
444- register int k;
445- register char c;
446+ FILE *fp;
447+ int k;
448+ char c;
449 int gfil = 0;
450 char **file = NULL;
451 int file_cur_size = INIT_FILE_SIZE;
452@@ -466,7 +466,7 @@ doinput(FILE *fp)
453 void
454 initpic()
455 {
456- register int i;
457+ int i;
458
459 for (i = 0; i < STYLES; i++) { /* line thickness defaults */
460 thick[i] = defthick[i];
461@@ -511,12 +511,12 @@ initpic()
462 *----------------------------------------------------------------------------*/
463
464 void
465-conv(register FILE *fp,
466+conv(FILE *fp,
467 int baseline)
468 {
469- register FILE *gfp = NULL; /* input file pointer */
470- register int done = 0; /* flag to remember if finished */
471- register ELT *e; /* current element pointer */
472+ FILE *gfp = NULL; /* input file pointer */
473+ int done = 0; /* flag to remember if finished */
474+ ELT *e; /* current element pointer */
475 ELT *PICTURE; /* whole picture data base pointer */
476 double temp; /* temporary calculating area */
477 /* POINT ptr; */ /* coordinates of a point to pass to 'mov' */
478@@ -543,7 +543,7 @@ conv(register FILE *fp,
479
480 if (!gremlinfile[0]) {
481 if (!setdefault)
482- error("at line %1: no picture filename.\n", baseline);
483+ error("no picture file name at line %1", baseline);
484 return;
485 }
486 char *path;
487@@ -577,7 +577,7 @@ conv(register FILE *fp,
488 } /* here, troffscale is the */
489 /* picture's scaling factor */
490 if (pointscale) {
491- register int i; /* do pointscaling here, when */
492+ int i; /* do pointscaling here, when */
493 /* scale is known, before output */
494 for (i = 0; i < SIZES; i++)
495 tsize[i] = (int) (troffscale * (double) tsize[i] + 0.5);
496@@ -700,7 +700,7 @@ conv(register FILE *fp,
497 void
498 savestate()
499 {
500- register int i;
501+ int i;
502
503 for (i = 0; i < STYLES; i++) /* line thickness defaults */
504 defthick[i] = thick[i];
505@@ -761,8 +761,8 @@ interpret(char *line)
506 {
507 char str1[MAXINLINE];
508 char str2[MAXINLINE];
509- register char *chr;
510- register int i;
511+ char *chr;
512+ int i;
513 double par;
514
515 str2[0] = '\0';
516@@ -811,7 +811,7 @@ interpret(char *line)
517
518 if (str2[0] < '0') {
519 nofont:
520- error("no fontname specified in line %1", linenum);
521+ error("no font name specified in line %1", linenum);
522 break;
523 }
524 if (str1[1] == 't')
525@@ -935,7 +935,7 @@ interpret(char *line)
526 */
527
528 int
529-has_polygon(register ELT *elist)
530+has_polygon(ELT *elist)
531 {
532 while (!DBNullelt(elist)) {
533 if (elist->type == POLYGON)
534--
5352.39.0
536
diff --git a/meta/recipes-extended/groff/groff_1.22.4.bb b/meta/recipes-extended/groff/groff_1.22.4.bb
index b281544aab..244c0e1625 100644
--- a/meta/recipes-extended/groff/groff_1.22.4.bb
+++ b/meta/recipes-extended/groff/groff_1.22.4.bb
@@ -12,7 +12,8 @@ SRC_URI = "${GNU_MIRROR}/groff/groff-${PV}.tar.gz \
12 file://groff-not-search-fonts-on-build-host.patch \ 12 file://groff-not-search-fonts-on-build-host.patch \
13 file://0001-support-musl.patch \ 13 file://0001-support-musl.patch \
14 file://0001-Include-config.h.patch \ 14 file://0001-Include-config.h.patch \
15 file://0001-Make-manpages-mulitlib-identical.patch \ 15 file://0001-Make-manpages-mulitlib-identical.patch \
16 file://0001-Fix-code-style-issues.patch \
16" 17"
17 18
18SRC_URI[md5sum] = "08fb04335e2f5e73f23ea4c3adbf0c5f" 19SRC_URI[md5sum] = "08fb04335e2f5e73f23ea4c3adbf0c5f"