Skip to content

Incompatible pointer type with GCC 14 needs explicit cast #80

@djhoese

Description

@djhoese

The conda-forge package is now being built with GCC 14 which is more strict on pointer type arguments. It fails to compile pyhdf and an explicit cast is needed to fix it.

pyhdf/hdfext_wrap.c: In function '_SDgetcompress':
  pyhdf/hdfext_wrap.c:4119:36: error: passing argument 2 of 'SDgetcompress' from incompatible pointer type [-Wincompatible-pointer-types]
   4119 |     status = SDgetcompress(sds_id, comp_type, &c_info);
        |                                    ^~~~~~~~~
        |                                    |
        |                                    int32 * {aka int *}

https://github.com/djhoese/pyhdf-feedstock/blob/patch-sdgetcompress/recipe/patches/sdgetcompress_int.patch

diff -Naru pyhdf-0.11.6-orig/pyhdf/hdfext_wrap.c pyhdf-0.11.6-patch/pyhdf/hdfext_wrap.c
--- pyhdf-0.11.6-orig/pyhdf/hdfext_wrap.c	2025-01-04 22:02:24.000000000 -0600
+++ pyhdf-0.11.6-patch/pyhdf/hdfext_wrap.c	2025-08-30 21:30:54.109399554 -0500
@@ -4116,7 +4116,7 @@
 #ifdef NOCOMPRESS
     status = -1;
 #else
-    status = SDgetcompress(sds_id, comp_type, &c_info);
+    status = SDgetcompress(sds_id, (comp_coder_t *)comp_type, &c_info);
     switch (*comp_type)  {
         case COMP_CODE_NONE:
         case COMP_CODE_RLE :

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions