Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] GDAL OGR header causes enumerator range pedantic warning #4585

Open
wenzeslaus opened this issue Oct 24, 2024 · 2 comments
Open

[Bug] GDAL OGR header causes enumerator range pedantic warning #4585

wenzeslaus opened this issue Oct 24, 2024 · 2 comments
Labels
bug Something isn't working C Related code is in C

Comments

@wenzeslaus
Copy link
Member

Describe the bug

Compilation results in a lot of warnings coming from the include of a GDAL OGR header file with GCC 13 and C GNU 17.

Including gdal/ogr_core.h results in multiple warning: ISO C restricts enumerator values to range of ‘int’ before C2X [-Wpedantic].

To reproduce

This comes from multiple directories, e.g., include/grass/vect. I'm not sure what exact combination of versions and flags is causing this besides the obvious -Wpedantic.

Expected behavior

While the code is external to the project, the compilation output is full of the warnings. It seems that updating to -std=gnu2x solves the issue as the warning suggests, so maybe we can just wait.

Screenshots

In file included from /usr/include/gdal/ogr_api.h:45,
                 from /home/vpetras/Projects/grass/code/grass/dist.x86_64-pc-linux-gnu/include/grass/vect/dig_structs.h:27,
                 from /home/vpetras/Projects/grass/code/grass/dist.x86_64-pc-linux-gnu/include/grass/vect/digit.h:3,
                 from /home/vpetras/Projects/grass/code/grass/dist.x86_64-pc-linux-gnu/include/grass/vector.h:4,
                 from point.c:21:
/usr/include/gdal/ogr_core.h:512:19: warning: ISO C restricts enumerator values to range of ‘int’ before C2X [-Wpedantic]
  512 |     wkbPoint25D = 0x80000001,             /**< 2.5D extension as per 99-402 */
      |                   ^~~~~~~~~~
/usr/include/gdal/ogr_core.h:513:24: warning: ISO C restricts enumerator values to range of ‘int’ before C2X [-Wpedantic]
  513 |     wkbLineString25D = 0x80000002,        /**< 2.5D extension as per 99-402 */
      |                        ^~~~~~~~~~
/usr/include/gdal/ogr_core.h:514:21: warning: ISO C restricts enumerator values to range of ‘int’ before C2X [-Wpedantic]
  514 |     wkbPolygon25D = 0x80000003,           /**< 2.5D extension as per 99-402 */
      |                     ^~~~~~~~~~
/usr/include/gdal/ogr_core.h:515:24: warning: ISO C restricts enumerator values to range of ‘int’ before C2X [-Wpedantic]
  515 |     wkbMultiPoint25D = 0x80000004,        /**< 2.5D extension as per 99-402 */
      |                        ^~~~~~~~~~
/usr/include/gdal/ogr_core.h:516:29: warning: ISO C restricts enumerator values to range of ‘int’ before C2X [-Wpedantic]
  516 |     wkbMultiLineString25D = 0x80000005,   /**< 2.5D extension as per 99-402 */
      |                             ^~~~~~~~~~
/usr/include/gdal/ogr_core.h:517:26: warning: ISO C restricts enumerator values to range of ‘int’ before C2X [-Wpedantic]
  517 |     wkbMultiPolygon25D = 0x80000006,      /**< 2.5D extension as per 99-402 */
      |                          ^~~~~~~~~~
/usr/include/gdal/ogr_core.h:518:32: warning: ISO C restricts enumerator values to range of ‘int’ before C2X [-Wpedantic]
  518 |     wkbGeometryCollection25D = 0x80000007 /**< 2.5D extension as per 99-402 */
      |                                ^~~~~~~~~~
             ^~~~~~~~~~

System description

  • Ubuntu 24.04.1 LTS (noble)
  • gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0
  • -std=gnu17
  • main branch
@wenzeslaus wenzeslaus added bug Something isn't working C Related code is in C labels Oct 24, 2024
@nilason
Copy link
Contributor

nilason commented Oct 24, 2024

This is reported upstream with OSGeo/gdal#2322. This is circumvented on Mac CI runner with:

export CPPFLAGS="-isystem${CONDA_PREFIX}/include"

Unfortunately we also have it in our code:

SF_POINT25D = 0x80000001, /* 2.5D extension as per 99-402 */
SF_LINESTRING25D = 0x80000002, /* 2.5D extension as per 99-402 */
SF_POLYGON25D = 0x80000003, /* 2.5D extension as per 99-402 */
SF_MULTIPOINT25D = 0x80000004, /* 2.5D extension as per 99-402 */
SF_MULTILINESTRING25D = 0x80000005, /* 2.5D extension as per 99-402 */
SF_MULTIPOLYGON25D = 0x80000006, /* 2.5D extension as per 99-402 */
SF_GEOMETRYCOLLECTION25D = 0x80000007 /* 2.5D extension as per 99-402 */

@rouault
Copy link
Member

rouault commented Oct 26, 2024

(planned to be addressed in GDAL 3.10 per OSGeo/gdal#11133)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working C Related code is in C
Projects
None yet
Development

No branches or pull requests

3 participants