Opened 3 years ago

Closed 11 months ago

#62917 closed defect (fixed)

h4h5tools @2.2.3_10: error: implicit declaration of function 'close' is invalid in C99

Reported by: cooljeanius (Eric Gallager) Owned by: kencu (Ken)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: catalina bigsur monterey ventura Cc:
Port: h4h5tools

Description

Another victim of -Werror=implicit-function-declaration being on by default now:

/usr/bin/clang -DPACKAGE_NAME=\"H4H5Tools\" -DPACKAGE_TARNAME=\"h4h5tools\" -DPACKAGE_VERSION=\"2.2.3\" -DPACKAGE_STRING=\"H4H5Tools\ 2.2.3\" -DPACKAGE_BUGREPORT=\"help@hdfgroup.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"h4h5tools\" -DVERSION=\"2.2.3\" -DSTDC_HEADERS=1 -DHAVE_HDF5_H=1 -DHAVE_LIBHDF5=1 -DHAVE_LIBHDF5_HL=1 -DHAVE_LIBGCTP=1 -DHAVE_LIBHDFEOS=1 -I.   -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -I/opt/local/include  -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -arch x86_64 -MT h4toh5eos.o -MD -MP -MF .deps/h4toh5eos.Tpo -c -o h4toh5eos.o h4toh5eos.c
H4TOH5I.c:250:14: warning: overflow in expression; result is 2147483647 with type 'int' [-Winteger-overflow]
    new_id = H4TOH5I_MAKE(grp, grp_ptr->nextid);
             ^
H4TOH5I.c:106:21: note: expanded from macro 'H4TOH5I_MAKE'
                             ((hid_t)(i)&ID_MASK))
                                         ^
H4TOH5I.c:85:31: note: expanded from macro 'ID_MASK'
#define ID_MASK         ((1<<ID_BITS)-1)
                                     ^
H4TOH5I.c:272:40: warning: overflow in expression; result is 2147483647 with type 'int' [-Winteger-overflow]
    if (grp_ptr->nextid > (h4toh5_uint)ID_MASK) {
                                       ^
H4TOH5I.c:85:31: note: expanded from macro 'ID_MASK'
#define ID_MASK         ((1<<ID_BITS)-1)
                                     ^
H4TOH5I.c:288:30: warning: overflow in expression; result is 2147483647 with type 'int' [-Winteger-overflow]
        for (i=grp_ptr->reserved; i<ID_MASK; i++) {
                                    ^
H4TOH5I.c:85:31: note: expanded from macro 'ID_MASK'
#define ID_MASK         ((1<<ID_BITS)-1)
                                     ^
H4TOH5I.c:290:39: warning: overflow in expression; result is 2147483647 with type 'int' [-Winteger-overflow]
            if (grp_ptr->nextid>(h4toh5_uint)ID_MASK) {
                                             ^
H4TOH5I.c:85:31: note: expanded from macro 'ID_MASK'
#define ID_MASK         ((1<<ID_BITS)-1)
                                     ^
H4TOH5I.c:295:16: warning: overflow in expression; result is 2147483647 with type 'int' [-Winteger-overflow]
            next_id = H4TOH5I_MAKE(grp, grp_ptr->nextid);
                      ^
H4TOH5I.c:106:21: note: expanded from macro 'H4TOH5I_MAKE'
                             ((hid_t)(i)&ID_MASK))
                                         ^
H4TOH5I.c:85:31: note: expanded from macro 'ID_MASK'
#define ID_MASK         ((1<<ID_BITS)-1)
                                     ^
H4TOH5I.c:308:22: warning: overflow in expression; result is 2147483647 with type 'int' [-Winteger-overflow]
        if (i>=(h4toh5_uint)ID_MASK) {
                            ^
H4TOH5I.c:85:31: note: expanded from macro 'ID_MASK'
#define ID_MASK         ((1<<ID_BITS)-1)
                                     ^
H4TOH5I.c:250:14: warning: shift count >= width of type [-Wshift-count-overflow]
    new_id = H4TOH5I_MAKE(grp, grp_ptr->nextid);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
H4TOH5I.c:106:21: note: expanded from macro 'H4TOH5I_MAKE'
                             ((hid_t)(i)&ID_MASK))
                                         ^~~~~~~
H4TOH5I.c:85:21: note: expanded from macro 'ID_MASK'
#define ID_MASK         ((1<<ID_BITS)-1)
                           ^ ~~~~~~~
H4TOH5I.c:272:40: warning: shift count >= width of type [-Wshift-count-overflow]
    if (grp_ptr->nextid > (h4toh5_uint)ID_MASK) {
                                       ^~~~~~~
H4TOH5I.c:85:21: note: expanded from macro 'ID_MASK'
#define ID_MASK         ((1<<ID_BITS)-1)
                           ^ ~~~~~~~
H4TOH5I.c:288:30: warning: shift count >= width of type [-Wshift-count-overflow]
        for (i=grp_ptr->reserved; i<ID_MASK; i++) {
                                    ^~~~~~~
H4TOH5I.c:85:21: note: expanded from macro 'ID_MASK'
#define ID_MASK         ((1<<ID_BITS)-1)
                           ^ ~~~~~~~
H4TOH5I.c:290:39: warning: shift count >= width of type [-Wshift-count-overflow]
            if (grp_ptr->nextid>(h4toh5_uint)ID_MASK) {
                                             ^~~~~~~
H4TOH5I.c:85:21: note: expanded from macro 'ID_MASK'
#define ID_MASK         ((1<<ID_BITS)-1)
                           ^ ~~~~~~~
H4TOH5I.c:295:16: warning: shift count >= width of type [-Wshift-count-overflow]
            next_id = H4TOH5I_MAKE(grp, grp_ptr->nextid);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
H4TOH5I.c:106:21: note: expanded from macro 'H4TOH5I_MAKE'
                             ((hid_t)(i)&ID_MASK))
                                         ^~~~~~~
H4TOH5I.c:85:21: note: expanded from macro 'ID_MASK'
#define ID_MASK         ((1<<ID_BITS)-1)
                           ^ ~~~~~~~
H4TOH5I.c:308:22: warning: shift count >= width of type [-Wshift-count-overflow]
        if (i>=(h4toh5_uint)ID_MASK) {
                            ^~~~~~~
H4TOH5I.c:85:21: note: expanded from macro 'ID_MASK'
#define ID_MASK         ((1<<ID_BITS)-1)
                           ^ ~~~~~~~
h4toh5main.c:1372:5: error: implicit declaration of function 'close' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    close(fid);
    ^
1 error generated.
h4toh5vdata.c:1720:30: warning: comparison of array 'svdattr_name' not equal to a null pointer is always true [-Wtautological-pointer-compare]
    if (field_index != -1 && svdattr_name != NULL) {
                             ^~~~~~~~~~~~    ~~~~
h4toh5image.c:1946:16: warning: if statement has empty body [-Wempty-body]
    if(!found) ;
               ^
h4toh5image.c:1946:16: note: put the semicolon on a separate line to silence this warning
make[2]: *** [h4toh5main.o] Error 1
make[2]: *** Waiting for unfinished jobs....
h4toh5util.c:3015:8: warning: comparison of array 'sdsname' not equal to a null pointer is always true [-Wtautological-pointer-compare]
    if(sdsname != NULL) {
       ^~~~~~~    ~~~~
h4toh5util.c:3026:8: warning: comparison of array 'sdsname' not equal to a null pointer is always true [-Wtautological-pointer-compare]
    if(sdsname != NULL){
       ^~~~~~~    ~~~~
h4toh5util.c:3051:9: warning: comparison of array 'sdsname' equal to a null pointer is always false [-Wtautological-pointer-compare]
    if (sdsname == NULL || check_sdsname !=0){
        ^~~~~~~    ~~~~
h4toh5util.c:3158:8: warning: comparison of array 'imagename' not equal to a null pointer is always true [-Wtautological-pointer-compare]
    if(imagename != NULL) {
       ^~~~~~~~~    ~~~~
h4toh5util.c:3169:8: warning: comparison of array 'imagename' not equal to a null pointer is always true [-Wtautological-pointer-compare]
    if(imagename != NULL){
       ^~~~~~~~~    ~~~~
h4toh5util.c:3194:9: warning: comparison of array 'imagename' equal to a null pointer is always false [-Wtautological-pointer-compare]
    if (imagename == NULL || check_imagename !=0){
        ^~~~~~~~~    ~~~~
h4toh5util.c:3289:8: warning: comparison of array 'vdataname' not equal to a null pointer is always true [-Wtautological-pointer-compare]
    if(vdataname != NULL) {
       ^~~~~~~~~    ~~~~
h4toh5util.c:3300:8: warning: comparison of array 'vdataname' not equal to a null pointer is always true [-Wtautological-pointer-compare]
    if(vdataname != NULL){
       ^~~~~~~~~    ~~~~
h4toh5util.c:3325:9: warning: comparison of array 'vdataname' equal to a null pointer is always false [-Wtautological-pointer-compare]
    if (vdataname == NULL || check_vdataname !=0){
        ^~~~~~~~~    ~~~~
h4toh5eos.c:1048:67: warning: incompatible function pointer types passing 'intn (int32, const char *, int32 *, int32 *, int32 *, char *)' (aka 'int (int, const char *, int *, int *, int *, char *)') to parameter of type 'intn (*)(int32, char *, int32 *, int32 *, int32 *, char *)' (aka 'int (*)(int, char *, int *, int *, int *, char *)') [-Wincompatible-function-pointer-types]
    return get_fieldinfo(h4toh5id, gdid, GDnentries, GDinqfields, GDfieldinfo, GDreadfield, GDgetfillvalue, 0, fields);
                                                                  ^~~~~~~~~~~
h4toh5eos.c:730:147: note: passing argument to parameter 'fldinfo' here
static int get_fieldinfo(hid_t h4toh5id, int32 id, int32 (*entries)(int32, int32, int32 *), int32 (*inq)(int32, char *, int32 *, int32 *), intn (*fldinfo)(int32, char *, int32 *, int32 *, int32 *, char *), intn (*readfld)(int32, char *, int32 *, int32 *, int32 *, VOIDP), intn (*getfill)(int32, char *, VOIDP), int geofield, fieldinfoalloc *fields)
                                                                                                                                                  ^
h4toh5eos.c:1048:80: warning: incompatible function pointer types passing 'intn (int32, const char *, int32 *, int32 *, int32 *, VOIDP)' (aka 'int (int, const char *, int *, int *, int *, void *)') to parameter of type 'intn (*)(int32, char *, int32 *, int32 *, int32 *, VOIDP)' (aka 'int (*)(int, char *, int *, int *, int *, void *)') [-Wincompatible-function-pointer-types]
    return get_fieldinfo(h4toh5id, gdid, GDnentries, GDinqfields, GDfieldinfo, GDreadfield, GDgetfillvalue, 0, fields);
                                                                               ^~~~~~~~~~~
h4toh5eos.c:730:214: note: passing argument to parameter 'readfld' here
static int get_fieldinfo(hid_t h4toh5id, int32 id, int32 (*entries)(int32, int32, int32 *), int32 (*inq)(int32, char *, int32 *, int32 *), intn (*fldinfo)(int32, char *, int32 *, int32 *, int32 *, char *), intn (*readfld)(int32, char *, int32 *, int32 *, int32 *, VOIDP), intn (*getfill)(int32, char *, VOIDP), int geofield, fieldinfoalloc *fields)
                                                                                                                                                                                                                     ^
h4toh5eos.c:1194:99: warning: incompatible function pointer types passing 'intn (int32, const char *, int32 *, int32 *, int32 *, char *)' (aka 'int (int, const char *, int *, int *, int *, char *)') to parameter of type 'intn (*)(int32, char *, int32 *, int32 *, int32 *, char *)' (aka 'int (*)(int, char *, int *, int *, int *, char *)') [-Wincompatible-function-pointer-types]
    return get_fieldinfo(h4toh5id, swid, SWnentries, geofield ? SWinqgeofields : SWinqdatafields, SWfieldinfo, SWreadfield, SWgetfillvalue, geofield, fields);
                                                                                                  ^~~~~~~~~~~
h4toh5eos.c:730:147: note: passing argument to parameter 'fldinfo' here
static int get_fieldinfo(hid_t h4toh5id, int32 id, int32 (*entries)(int32, int32, int32 *), int32 (*inq)(int32, char *, int32 *, int32 *), intn (*fldinfo)(int32, char *, int32 *, int32 *, int32 *, char *), intn (*readfld)(int32, char *, int32 *, int32 *, int32 *, VOIDP), intn (*getfill)(int32, char *, VOIDP), int geofield, fieldinfoalloc *fields)
                                                                                                                                                  ^
h4toh5eos.c:1194:112: warning: incompatible function pointer types passing 'intn (int32, const char *, int32 *, int32 *, int32 *, VOIDP)' (aka 'int (int, const char *, int *, int *, int *, void *)') to parameter of type 'intn (*)(int32, char *, int32 *, int32 *, int32 *, VOIDP)' (aka 'int (*)(int, char *, int *, int *, int *, void *)') [-Wincompatible-function-pointer-types]
    return get_fieldinfo(h4toh5id, swid, SWnentries, geofield ? SWinqgeofields : SWinqdatafields, SWfieldinfo, SWreadfield, SWgetfillvalue, geofield, fields);
                                                                                                               ^~~~~~~~~~~
h4toh5eos.c:730:214: note: passing argument to parameter 'readfld' here
static int get_fieldinfo(hid_t h4toh5id, int32 id, int32 (*entries)(int32, int32, int32 *), int32 (*inq)(int32, char *, int32 *, int32 *), intn (*fldinfo)(int32, char *, int32 *, int32 *, int32 *, char *), intn (*readfld)(int32, char *, int32 *, int32 *, int32 *, VOIDP), intn (*getfill)(int32, char *, VOIDP), int geofield, fieldinfoalloc *fields)
                                                                                                                                                                                                                     ^
h4toh5eos.c:1194:125: warning: incompatible function pointer types passing 'intn (int32, const char *, VOIDP)' (aka 'int (int, const char *, void *)') to parameter of type 'intn (*)(int32, char *, VOIDP)' (aka 'int (*)(int, char *, void *)') [-Wincompatible-function-pointer-types]
    return get_fieldinfo(h4toh5id, swid, SWnentries, geofield ? SWinqgeofields : SWinqdatafields, SWfieldinfo, SWreadfield, SWgetfillvalue, geofield, fields);
                                                                                                                            ^~~~~~~~~~~~~~
h4toh5eos.c:730:280: note: passing argument to parameter 'getfill' here
static int get_fieldinfo(hid_t h4toh5id, int32 id, int32 (*entries)(int32, int32, int32 *), int32 (*inq)(int32, char *, int32 *, int32 *), intn (*fldinfo)(int32, char *, int32 *, int32 *, int32 *, char *), intn (*readfld)(int32, char *, int32 *, int32 *, int32 *, VOIDP), intn (*getfill)(int32, char *, VOIDP), int geofield, fieldinfoalloc *fields)
                                                                                                                                                                                                                                                                                       ^
h4toh5eos.c:1199:54: warning: incompatible function pointer types passing 'intn (int32, const char *, int32 *, int32 *)' (aka 'int (int, const char *, int *, int *)') to parameter of type 'intn (*)(int32, char *, int32 *, int32 *)' (aka 'int (*)(int, char *, int *, int *)') [-Wincompatible-function-pointer-types]
    return get_attribute(h4toh5id, swid, SWinqattrs, SWattrinfo, SWreadattr, attrs);
                                                     ^~~~~~~~~~
h4toh5eos.c:829:97: note: passing argument to parameter 'attrinfo' here
static int get_attribute(hid_t h4toh5id, int32 id, int32 (*inq)(int32, char *, int32 *), intn (*attrinfo)(int32, char *, int32 *, int32 *), intn (*readattr)(int32, char *, VOIDP), attributealloc *attrs)
                                                                                                ^
h4toh5eos.c:1199:66: warning: incompatible function pointer types passing 'intn (int32, const char *, VOIDP)' (aka 'int (int, const char *, void *)') to parameter of type 'intn (*)(int32, char *, VOIDP)' (aka 'int (*)(int, char *, void *)') [-Wincompatible-function-pointer-types]
    return get_attribute(h4toh5id, swid, SWinqattrs, SWattrinfo, SWreadattr, attrs);
                                                                 ^~~~~~~~~~
h4toh5eos.c:829:148: note: passing argument to parameter 'readattr' here
static int get_attribute(hid_t h4toh5id, int32 id, int32 (*inq)(int32, char *, int32 *), intn (*attrinfo)(int32, char *, int32 *, int32 *), intn (*readattr)(int32, char *, VOIDP), attributealloc *attrs)
                                                                                                                                                   ^
h4toh5sds.c:5708:52: warning: if statement has empty body [-Wempty-body]
        if(SDgetfillvalue(sds_id,fill_value)==FAIL);
                                                   ^
h4toh5sds.c:5708:52: note: put the semicolon on a separate line to silence this warning
h4toh5sds.c:6579:16: warning: if statement has empty body [-Wempty-body]
    if(!found) ;
               ^
h4toh5sds.c:6579:16: note: put the semicolon on a separate line to silence this warning
h4toh5sds.c:6827:12: error: implicit declaration of function 'H5DSattach_scale' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        if(H5DSattach_scale(h5dset_id,h5_scale_id,sdsdim_index) <0) {
           ^
h4toh5sds.c:6846:12: error: implicit declaration of function 'H5DSattach_scale' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        if(H5DSattach_scale(h5dset_id,h5_scale_id,sdsdim_index) <0) {
           ^
h4toh5sds.c:6940:12: error: implicit declaration of function 'H5DSattach_scale' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        if(H5DSattach_scale(h5dset_id,h5_scale_id,sdsdim_index) <0) {
           ^
h4toh5sds.c:6974:12: error: implicit declaration of function 'H5DSattach_scale' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        if(H5DSattach_scale(h5dset_id,h5_scale_id,sdsdim_index) <0) {
           ^
h4toh5sds.c:7040:12: error: implicit declaration of function 'H5DSattach_scale' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        if(H5DSattach_scale(h5dset_id,h5_scale_id,sdsdim_index)<0) {
           ^
h4toh5sds.c:7057:12: error: implicit declaration of function 'H5DSattach_scale' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        if(H5DSattach_scale(h5dset_id,h5_scale_id,sdsdim_index)<0) {
           ^
h4toh5sds.c:7269:8: error: implicit declaration of function 'H5DSset_scale' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if(H5DSset_scale(h5dim_dset,h5dim_rel_path)<0) {
       ^
12 warnings generated.
h4toh5sds.c:7269:8: note: did you mean 'H5Dget_space'?
/opt/local/include/H5Dpublic.h:138:14: note: 'H5Dget_space' declared here
H5_DLL hid_t H5Dget_space(hid_t dset_id);
             ^
h4toh5sds.c:7402:8: error: implicit declaration of function 'H5DSset_scale' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if(H5DSset_scale(h5scale_id,h5dim_abo_path)<0) {
       ^
h4toh5sds.c:7580:8: error: implicit declaration of function 'H5DSset_scale' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if(H5DSset_scale(h5_dsetid,h5dim_abo_path)<0) {
       ^
mv -f .deps/H4TOH5I.Tpo .deps/H4TOH5I.Po
2 warnings and 9 errors generated.
make[2]: *** [h4toh5sds.o] Error 1
mv -f .deps/h4toh5pal.Tpo .deps/h4toh5pal.Po
1 warning generated.
mv -f .deps/h4toh5image.Tpo .deps/h4toh5image.Po
mv -f .deps/h4toh5vgroup.Tpo .deps/h4toh5vgroup.Po
1 warning generated.
mv -f .deps/h4toh5vdata.Tpo .deps/h4toh5vdata.Po
mv -f .deps/h4toh5anno.Tpo .deps/h4toh5anno.Po
9 warnings generated.
mv -f .deps/h4toh5util.Tpo .deps/h4toh5util.Po
7 warnings generated.
mv -f .deps/h4toh5eos.Tpo .deps/h4toh5eos.Po
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_h4h5tools/h4h5tools/work/h4h5tools-2.2.3/lib/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_h4h5tools/h4h5tools/work/h4h5tools-2.2.3/lib'
make: *** [all-recursive] Error 1
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_h4h5tools/h4h5tools/work/h4h5tools-2.2.3'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_h4h5tools/h4h5tools/work/h4h5tools-2.2.3" && /usr/bin/make -j16 -w all 
Exit code: 2
Error: Failed to build h4h5tools: command execution failed
DEBUG: Error code: CHILDSTATUS 58911 2

Change History (3)

comment:1 Changed 11 months ago by ryandesign (Ryan Carsten Schmidt)

Keywords: monterey ventura added
Version: 2.6.42.8.1

comment:2 Changed 11 months ago by kencu (Ken)

See:

https://github.com/macports/macports-ports/pull/18955

I don't use this software at all, but I had a few minutes and the changes in the PR fix the build in a logical fashion.

I can't find the upstream place to open an issue / PR for these changes, after 5 minutes looking, however.

comment:3 Changed 11 months ago by kencu (Ken)

Owner: set to kencu
Resolution: fixed
Status: newclosed

In 7b03a9b7bf92befb67311403582cec505735fd59/macports-ports (master):

h4h5tools: fix build on newer systems

closes: #62917

Note: See TracTickets for help on using tickets.