[PROJ] build failure with GCC 9.1.0
Dechaux Eric CEN (BCQ STIG)
eric.dechaux at gendarmerie.interieur.gouv.fr
Wed Sep 25 00:54:46 PDT 2019
Le 24/09/2019 à 15:37, Even Rouault a écrit :
> Hi
>
>> Could it comes from my buildbox (Solaris 11.4.12) ?
> Definitely a Solaris specific thing.
> Should hopefully be fixed by https://github.com/OSGeo/PROJ/pull/1637
> Can you confirm this patch fixes the issue ?
I am afraid it is not enough. Please find attached 4 additional patches :
- proj-6.2.0-hanato.gpatch and proj-6.2.0-mbtfpp.gpatch
In files src/projections/hatano.cpp and src/projections/mbtfpp.cpp,
change the CS define to CSz in order to avoid overriding the CS system
definition
- proj-6.2.0-isea.gpatch :
In file src/projections/isea.cpp, change the quad variable name as it is
overriding another system definition
$ grep quad /usr/include/sys/types.h
typedef struct _quad { int val[2]; } quad_t; /* used by UFS */
typedef quad_t quad; /* used by UFS */
- proj-6.2.0-io.gpatch
In file src/iso19111/io.cpp, change another class name that override the
CS system define
$ gegrep '[[:space:]]CS[[:space:]]' /usr/include/sys/regset.h
#define CS 15
With those changes, 6.2.0 build and check properly on Solaris 11.4.12
and GCC 9.1.
Note : I quite understood what I changed in the first 3 patches. Not
sure in the last one. Can you please review it ?
Regards.
--
Eric
-------------- next part --------------
--- proj-6.2.0.orig/src/projections/mbtfpp.cpp 2019-05-06 07:12:09.000000000 +0200
+++ proj-6.2.0/src/projections/mbtfpp.cpp 2019-09-24 17:42:27.416670200 +0200
@@ -7,7 +7,7 @@
PROJ_HEAD(mbtfpp, "McBride-Thomas Flat-Polar Parabolic") "\n\tCyl, Sph";
-#define CS .95257934441568037152
+#define CSy .95257934441568037152
#define FXC .92582009977255146156
#define FYC 3.40168025708304504493
#define C23 .66666666666666666666
@@ -19,7 +19,7 @@
PJ_XY xy = {0.0,0.0};
(void) P;
- lp.phi = asin(CS * sin(lp.phi));
+ lp.phi = asin(CSy * sin(lp.phi));
xy.x = FXC * lp.lam * (2. * cos(C23 * lp.phi) - 1.);
xy.y = FYC * sin(C13 * lp.phi);
return xy;
@@ -41,7 +41,7 @@
lp.phi = asin(lp.phi);
lp.lam = xy.x / ( FXC * (2. * cos(C23 * (lp.phi *= 3.)) - 1.) );
- if (fabs(lp.phi = sin(lp.phi) / CS) >= 1.) {
+ if (fabs(lp.phi = sin(lp.phi) / CSy) >= 1.) {
if (fabs(lp.phi) > ONEEPS) {
proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION);
return lp;
-------------- next part --------------
--- proj-6.2.0.orig/src/projections/isea.cpp 2019-05-06 07:12:09.000000000 +0200
+++ proj-6.2.0/src/projections/isea.cpp 2019-09-24 17:48:13.835557603 +0200
@@ -668,10 +668,10 @@
/* convert projected triangle coords to quad xy coords, return quad number */
static int isea_ptdd(int tri, struct isea_pt *pt) {
- int downtri, quad;
+ int downtri, quadz;
downtri = (((tri - 1) / 5) % 2 == 1);
- quad = ((tri - 1) % 5) + ((tri - 1) / 10) * 5 + 1;
+ quadz = ((tri - 1) % 5) + ((tri - 1) / 10) * 5 + 1;
isea_rotate(pt, downtri ? 240.0 : 60.0);
if (downtri) {
@@ -679,10 +679,10 @@
/* pt->y += cos(30.0 * M_PI / 180.0); */
pt->y += .86602540378443864672;
}
- return quad;
+ return quadz;
}
-static int isea_dddi_ap3odd(struct isea_dgg *g, int quad, struct isea_pt *pt,
+static int isea_dddi_ap3odd(struct isea_dgg *g, int quadz, struct isea_pt *pt,
struct isea_pt *di)
{
struct isea_pt v;
@@ -715,40 +715,40 @@
* you want to test for max coords for the next quad in the same
* "row" first to get the case where both are max
*/
- if (quad <= 5) {
+ if (quadz <= 5) {
if (d == 0 && i == maxcoord) {
/* north pole */
- quad = 0;
+ quadz = 0;
d = 0;
i = 0;
} else if (i == maxcoord) {
/* upper right in next quad */
- quad += 1;
- if (quad == 6)
- quad = 1;
+ quadz += 1;
+ if (quadz == 6)
+ quadz = 1;
i = maxcoord - d;
d = 0;
} else if (d == maxcoord) {
/* lower right in quad to lower right */
- quad += 5;
+ quadz += 5;
d = 0;
}
- } else if (quad >= 6) {
+ } else if (quadz >= 6) {
if (i == 0 && d == maxcoord) {
/* south pole */
- quad = 11;
+ quadz = 11;
d = 0;
i = 0;
} else if (d == maxcoord) {
/* lower right in next quad */
- quad += 1;
- if (quad == 11)
- quad = 6;
+ quadz += 1;
+ if (quadz == 11)
+ quadz = 6;
d = maxcoord - i;
i = 0;
} else if (i == maxcoord) {
/* upper right in quad to upper right */
- quad = (quad - 4) % 5;
+ quadz = (quadz - 4) % 5;
i = 0;
}
}
@@ -756,11 +756,11 @@
di->x = d;
di->y = i;
- g->quad = quad;
- return quad;
+ g->quad = quadz;
+ return quadz;
}
-static int isea_dddi(struct isea_dgg *g, int quad, struct isea_pt *pt,
+static int isea_dddi(struct isea_dgg *g, int quadz, struct isea_pt *pt,
struct isea_pt *di) {
struct isea_pt v;
double hexwidth;
@@ -768,7 +768,7 @@
struct hex h;
if (g->aperture == 3 && g->resolution % 2 != 0) {
- return isea_dddi_ap3odd(g, quad, pt, di);
+ return isea_dddi_ap3odd(g, quadz, pt, di);
}
/* todo might want to do this as an iterated loop */
if (g->aperture >0) {
@@ -793,41 +793,41 @@
hex_iso(&h);
/* we may actually be on another quad */
- if (quad <= 5) {
+ if (quadz <= 5) {
if (h.x == 0 && h.z == -sidelength) {
/* north pole */
- quad = 0;
+ quadz = 0;
h.z = 0;
h.y = 0;
h.x = 0;
} else if (h.z == -sidelength) {
- quad = quad + 1;
- if (quad == 6)
- quad = 1;
+ quadz = quadz + 1;
+ if (quadz == 6)
+ quadz = 1;
h.y = sidelength - h.x;
h.z = h.x - sidelength;
h.x = 0;
} else if (h.x == sidelength) {
- quad += 5;
+ quadz += 5;
h.y = -h.z;
h.x = 0;
}
- } else if (quad >= 6) {
+ } else if (quadz >= 6) {
if (h.z == 0 && h.x == sidelength) {
/* south pole */
- quad = 11;
+ quadz = 11;
h.x = 0;
h.y = 0;
h.z = 0;
} else if (h.x == sidelength) {
- quad = quad + 1;
- if (quad == 11)
- quad = 6;
+ quadz = quadz + 1;
+ if (quadz == 11)
+ quadz = 6;
h.x = h.y + sidelength;
h.y = 0;
h.z = -h.x;
} else if (h.y == -sidelength) {
- quad -= 4;
+ quadz -= 4;
h.y = 0;
h.z = -h.x;
}
@@ -835,35 +835,35 @@
di->x = h.x;
di->y = -h.z;
- g->quad = quad;
- return quad;
+ g->quad = quadz;
+ return quadz;
}
static int isea_ptdi(struct isea_dgg *g, int tri, struct isea_pt *pt,
struct isea_pt *di) {
struct isea_pt v;
- int quad;
+ int quadz;
v = *pt;
- quad = isea_ptdd(tri, &v);
- quad = isea_dddi(g, quad, &v, di);
- return quad;
+ quadz = isea_ptdd(tri, &v);
+ quadz = isea_dddi(g, quadz, &v, di);
+ return quadz;
}
/* q2di to seqnum */
-static long isea_disn(struct isea_dgg *g, int quad, struct isea_pt *di) {
+static long isea_disn(struct isea_dgg *g, int quadz, struct isea_pt *di) {
long sidelength;
long sn, height;
long hexes;
- if (quad == 0) {
+ if (quadz == 0) {
g->serial = 1;
return g->serial;
}
/* hexes in a quad */
hexes = lround(pow(static_cast<double>(g->aperture), static_cast<double>(g->resolution)));
- if (quad == 11) {
+ if (quadz == 11) {
g->serial = 1 + 10 * hexes + 1;
return g->serial;
}
@@ -871,11 +871,11 @@
height = lround(floor((pow(g->aperture, (g->resolution - 1) / 2.0))));
sn = ((long)di->x) * height;
sn += ((long)di->y) / height;
- sn += (quad - 1) * hexes;
+ sn += (quadz - 1) * hexes;
sn += 2;
} else {
sidelength = lround((pow(g->aperture, g->resolution / 2.0)));
- sn = lround(floor(((quad - 1) * hexes + sidelength * di->x + di->y + 2)));
+ sn = lround(floor(((quadz - 1) * hexes + sidelength * di->x + di->y + 2)));
}
g->serial = sn;
@@ -894,15 +894,15 @@
long sidelength;
long d, i, x, y;
#endif
- int quad;
+ int quadz;
- quad = isea_ptdi(g, tri, pt, &v);
+ quadz = isea_ptdi(g, tri, pt, &v);
if( v.x < (INT_MIN >> 4) || v.x > (INT_MAX >> 4) )
{
throw "Invalid shift";
}
- hex->x = ((int)v.x << 4) + quad;
+ hex->x = ((int)v.x << 4) + quadz;
hex->y = v.y;
return 1;
@@ -914,16 +914,16 @@
if (g->aperture == 3 && g->resolution % 2 != 0) {
long offset = lround((pow(3.0, g->resolution - 1) + 0.5));
- d += offset * ((g->quad-1) % 5);
- i += offset * ((g->quad-1) % 5);
+ d += offset * ((g->quadz-1) % 5);
+ i += offset * ((g->quadz-1) % 5);
- if (quad == 0) {
+ if (quadz == 0) {
d = 0;
i = offset;
- } else if (quad == 11) {
+ } else if (quadz == 11) {
d = 2 * offset;
i = 0;
- } else if (quad > 5) {
+ } else if (quadz > 5) {
d += offset;
}
-------------- next part --------------
--- proj-6.2.0.orig/src/iso19111/io.cpp 2019-08-27 00:10:15.000000000 +0200
+++ proj-6.2.0/src/iso19111/io.cpp 2019-09-24 17:19:25.975914267 +0200
@@ -4444,12 +4444,12 @@
}
template <class TargetCRS, class DatumBuilderType,
- class CS = CoordinateSystem>
+ class CSM = CoordinateSystem>
util::nn<std::shared_ptr<TargetCRS>> buildCRS(const json &j,
DatumBuilderType f) {
auto datum = (this->*f)(getObject(j, "datum"));
auto cs = buildCS(getObject(j, "coordinate_system"));
- auto csCast = util::nn_dynamic_pointer_cast<CS>(cs);
+ auto csCast = util::nn_dynamic_pointer_cast<CSM>(cs);
if (!csCast) {
throw ParsingException("coordinate_system not of expected type");
}
@@ -4457,7 +4457,7 @@
NN_NO_CHECK(csCast));
}
- template <class TargetCRS, class BaseCRS, class CS = CoordinateSystem>
+ template <class TargetCRS, class BaseCRS, class CSM = CoordinateSystem>
util::nn<std::shared_ptr<TargetCRS>> buildDerivedCRS(const json &j) {
auto baseCRSObj = create(getObject(j, "base_crs"));
auto baseCRS = util::nn_dynamic_pointer_cast<BaseCRS>(baseCRSObj);
@@ -4465,7 +4465,7 @@
throw ParsingException("base_crs not of expected type");
}
auto cs = buildCS(getObject(j, "coordinate_system"));
- auto csCast = util::nn_dynamic_pointer_cast<CS>(cs);
+ auto csCast = util::nn_dynamic_pointer_cast<CSM>(cs);
if (!csCast) {
throw ParsingException("coordinate_system not of expected type");
}
-------------- next part --------------
--- proj-6.2.0.orig/src/projections/hatano.cpp 2019-05-06 07:12:09.000000000 +0200
+++ proj-6.2.0/src/projections/hatano.cpp 2019-09-24 17:41:51.900833050 +0200
@@ -11,7 +11,7 @@
#define EPS 1e-7
#define ONETOL 1.000001
#define CN 2.67595
-#define CS 2.43763
+#define CSz 2.43763
#define RCN 0.37369906014686373063
#define RCS 0.41023453108141924738
#define FYCN 1.75859
@@ -28,7 +28,7 @@
int i;
(void) P;
- c = sin(lp.phi) * (lp.phi < 0. ? CS : CN);
+ c = sin(lp.phi) * (lp.phi < 0. ? CSz : CN);
for (i = NITER; i; --i) {
lp.phi -= th1 = (lp.phi + sin(lp.phi) - c) / (1. + cos(lp.phi));
if (fabs(th1) < EPS) break;
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: avertissement.txt
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20190925/3d65f280/attachment.txt>
More information about the PROJ
mailing list