Skip to content

Fix incompatible pointer type passed to GEOSPolygonize_r - #1945

Merged
jorisvandenbossche merged 1 commit into
shapely:mainfrom
musicinmybrain:incompatible-pointer-type
Dec 4, 2023
Merged

jorisvandenbossche merged 1 commit into
shapely:mainfrom
musicinmybrain:incompatible-pointer-type

Conversation

@musicinmybrain

Copy link
Copy Markdown
Contributor

Fixes the following warning by improving const-correctness:

  src/ufuncs.c: In function ‘polygonize_func’:
  src/ufuncs.c:2205:51: warning: passing argument 2 of ‘GEOSPolygonize_r’ from incompatible pointer type [-Wincompatible-pointer-types]
   2205 |     GEOSGeometry* ret_ptr = GEOSPolygonize_r(ctx, geoms, n_geoms);
        |                                                   ^~~~~
        |                                                   |
        |                                                   GEOSGeometry ** {aka struct GEOSGeom_t **}
  In file included from src/geos.h:15,
                   from src/ufuncs.c:16:
  /usr/include/geos_c.h:979:31: note: expected ‘const GEOSGeometry * const*’ {aka ‘const struct GEOSGeom_t * const*’} but argument is of type ‘GEOSGeometry **’ {aka ‘struct GEOSGeom_t **’}
    979 |     const GEOSGeometry *const geoms[],
        |     ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~

With Fedora Linux’s PortingToModernC initiative, further described in this mailing list message, this warning will become an error.

@coveralls

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 7078121549

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.3%) to 88.019%

Totals Coverage Status
Change from base Build 6898857040: 0.3%
Covered Lines: 2586
Relevant Lines: 2938

💛 - Coveralls

@thesamesam

Copy link
Copy Markdown

FWIW, I still see:

src/ufuncs.c: In function ‘Ydd_b_p_func’:
src/ufuncs.c:436:23: warning: passing argument 2 of ‘func’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  436 |       ret = func(ctx, prepared_geom_tmp, in2, in3);
      |                       ^~~~~~~~~~~~~~~~~
src/ufuncs.c:436:23: note: expected ‘void *’ but argument is of type ‘const GEOSPreparedGeometry *’ {aka ‘const struct GEOSPrepGeom_t *’}

but that's less of an issue.

Comment thread src/ufuncs.c Resolved
@musicinmybrain

Copy link
Copy Markdown
Contributor Author

FWIW, I still see:

I agree; I still see several other warnings that it would be nice to fix. This PR only targets the “incompatible pointer type” warning.

@jorisvandenbossche
jorisvandenbossche merged commit 0545588 into shapely:main Dec 4, 2023
@jorisvandenbossche

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants