science/silo: fix build with clang 15

During an exp-run for llvm 15 (see bug 265425), it turned out that
science/silo failed to build with clang 15:

  /wrkdirs/usr/ports/science/silo/work/Silo-4.11-68-g819658e/src/hdf5_drv/silo_hdf5.c:1869:13: error: incompatible integer to pointer conversion passing 'char' to parameter of type 'const char *'; take the address with & [-Wint-conversion]
              DB_OBJ_CASE(DB_CURVE, DBcurve_mt, npts?1:1, yvarname)
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /wrkdirs/usr/ports/science/silo/work/Silo-4.11-68-g819658e/src/hdf5_drv/silo_hdf5.c:1812:36: note: expanded from macro 'DB_OBJ_CASE'
              (*dsnames)[i] = strdup(m.MEMNAME[i]);                \
                              ~~~~~~~^~~~~~~~~~~~~
  /wrkdirs/usr/ports/science/silo/work/Silo-4.11-68-g819658e/src/silo/silo_private.h:939:35: note: expanded from macro 'strdup'
  #define strdup(s) _db_safe_strdup(s)
                                    ^
  /wrkdirs/usr/ports/science/silo/work/.build/include/silo.h:2214:68: note: passing argument to parameter here
  SILO_API extern char *                 _db_safe_strdup(const char *);
                                                                     ^

This turns out to be a bug in silo, which I reported upstream in
https://github.com/LLNL/Silo/issues/296, and which was fixed in
https://github.com/LLNL/Silo/commit/be29ddf.

PR:		268864
Approved by:	yuri (maintainer)
MFH:		2023Q1
This commit is contained in:
Dimitry Andric 2023-01-10 19:15:27 +01:00
parent 1a366f89b2
commit 85723e5e46

View File

@ -0,0 +1,44 @@
commit be29ddf0352bc8e5a7eecc8772a3acb64dfde18c
Author: miller86 <miller86@llnl.gov>
Date: Fri Dec 2 19:00:20 2022 -0800
fix obj-case-macro
diff --git src/hdf5_drv/silo_hdf5.c src/hdf5_drv/silo_hdf5.c
index 17af250..c45d689 100644
--- src/hdf5_drv/silo_hdf5.c
+++ src/hdf5_drv/silo_hdf5.c
@@ -1809,7 +1809,7 @@ db_hdf5_cwg(DBfile *_dbfile)
*dscount = m.MEMCNT; \
*dsnames = (char **) calloc(*dscount, sizeof(char**)); \
for (i = 0; i < *dscount; i++) \
- (*dsnames)[i] = strdup(m.MEMNAME[i]); \
+ (*dsnames)[i] = strdup(m.MEMNAME); \
break; \
}
@@ -1857,15 +1857,15 @@ db_hdf5_get_obj_dsnames(DBfile *_dbfile, char const *name, int *dscount, char **
switch(_objtype)
{
- DB_OBJ_CASE(DB_QUADVAR, DBquadvar_mt, nvals, value)
- /*DB_OBJ_CASE(DB_QUAD_RECT, DBquadmesh_mt, nspace, coord) wont work for rect case */
- DB_OBJ_CASE(DB_QUAD_CURV, DBquadmesh_mt, nspace, coord)
- DB_OBJ_CASE(DB_QUADMESH, DBquadmesh_mt, nspace, coord)
- DB_OBJ_CASE(DB_UCDVAR, DBucdvar_mt, nvals, value)
- DB_OBJ_CASE(DB_UCDMESH, DBucdmesh_mt, ndims, coord)
- DB_OBJ_CASE(DB_POINTVAR, DBpointvar_mt, nvals, data)
- DB_OBJ_CASE(DB_POINTMESH, DBpointmesh_mt, ndims, coord)
- DB_OBJ_CASE(DB_CSGVAR, DBcsgvar_mt, nvals, vals)
+ DB_OBJ_CASE(DB_QUADVAR, DBquadvar_mt, nvals, value[i])
+ /*DB_OBJ_CASE(DB_QUAD_RECT, DBquadmesh_mt, nspace, coord[i]) wont work for rect case */
+ DB_OBJ_CASE(DB_QUAD_CURV, DBquadmesh_mt, nspace, coord[i])
+ DB_OBJ_CASE(DB_QUADMESH, DBquadmesh_mt, nspace, coord[i])
+ DB_OBJ_CASE(DB_UCDVAR, DBucdvar_mt, nvals, value[i])
+ DB_OBJ_CASE(DB_UCDMESH, DBucdmesh_mt, ndims, coord[i])
+ DB_OBJ_CASE(DB_POINTVAR, DBpointvar_mt, nvals, data[i])
+ DB_OBJ_CASE(DB_POINTMESH, DBpointmesh_mt, ndims, coord[i])
+ DB_OBJ_CASE(DB_CSGVAR, DBcsgvar_mt, nvals, vals[i])
DB_OBJ_CASE(DB_CURVE, DBcurve_mt, npts?1:1, yvarname)
}
H5Tclose(o);