Skip to content

Commit 6795dc8

Browse files
committed
Use GCC's __attribute__((deprecated)) to warn when using deprecated NAPI functions
Use #ifdef __GNUC__ so that building on other compilers doesn't get broken
1 parent b597c27 commit 6795dc8

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

include/napi.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,12 @@ typedef struct {
270270
*
271271
*/
272272

273+
#ifdef __GNUC__
274+
#define NEXUS_DEPRECATED_FUNCTION __attribute__((deprecated))
275+
#else
276+
#define NEXUS_DEPRECATED_FUNCTION
277+
#endif
278+
273279
#ifdef __cplusplus
274280
extern "C" {
275281
#endif /* __cplusplus */
@@ -441,7 +447,7 @@ extern NXstatus NXcompmakedata64 (NXhandle handle, CONSTCHAR* label, int dataty
441447
* \li NX_COMP_HUF Huffmann encoding (only HDF-4)
442448
* \ingroup c_readwrite
443449
*/
444-
extern NXstatus NXcompress (NXhandle handle, int compr_type);
450+
extern NXstatus NXcompress (NXhandle handle, int compr_type) NEXUS_DEPRECATED_FUNCTION;
445451

446452
/**
447453
* Open access to a dataset. After this call it is possible to write and read data or
@@ -638,7 +644,7 @@ extern NXstatus NXgetslab64(NXhandle handle, void* data, const int64_t start[]
638644
* \return NX_OK on success, NX_ERROR in the case of an error, NX_EOD when there are no more items.
639645
* \ingroup c_readwrite
640646
*/
641-
extern NXstatus NXgetnextattr(NXhandle handle, NXname pName, int *iLength, int *iType);
647+
extern NXstatus NXgetnextattr(NXhandle handle, NXname pName, int *iLength, int *iType) NEXUS_DEPRECATED_FUNCTION;
642648

643649
/**
644650
* Read an attribute containing a single string or numerical value.

0 commit comments

Comments
 (0)