Skip to content

Commit 77061bb

Browse files
Merge pull request nexusformat#383 from chrisemblhh/attribute_deprecated
Warn when using deprecated NAPI functions
2 parents 135aa66 + 0e93ae3 commit 77061bb

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

bindings/cpp/NeXusFile.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ namespace NeXus {
129129
* This is a deprecated function.
130130
* \param com The compression type.
131131
*/
132-
void compress(NXcompression comp);
132+
void compress(NXcompression comp) NEXUS_DEPRECATED_FUNCTION;
133133

134134
/**
135135
* Initialize the pending group search to start again.

include/napi.h

+8-2
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,12 @@ typedef struct {
258258
*
259259
*/
260260

261+
#if (defined(__GNUC__) || defined(__clang__))
262+
#define NEXUS_DEPRECATED_FUNCTION __attribute__((deprecated))
263+
#else
264+
#define NEXUS_DEPRECATED_FUNCTION
265+
#endif
266+
261267
#ifdef __cplusplus
262268
extern "C" {
263269
#endif /* __cplusplus */
@@ -429,7 +435,7 @@ extern NXstatus NXcompmakedata64 (NXhandle handle, CONSTCHAR* label, int dataty
429435
* \li NX_COMP_HUF Huffmann encoding (only HDF-4)
430436
* \ingroup c_readwrite
431437
*/
432-
extern NXstatus NXcompress (NXhandle handle, int compr_type);
438+
extern NXstatus NXcompress (NXhandle handle, int compr_type) NEXUS_DEPRECATED_FUNCTION;
433439

434440
/**
435441
* Open access to a dataset. After this call it is possible to write and read data or
@@ -626,7 +632,7 @@ extern NXstatus NXgetslab64(NXhandle handle, void* data, const int64_t start[]
626632
* \return NX_OK on success, NX_ERROR in the case of an error, NX_EOD when there are no more items.
627633
* \ingroup c_readwrite
628634
*/
629-
extern NXstatus NXgetnextattr(NXhandle handle, NXname pName, int *iLength, int *iType);
635+
extern NXstatus NXgetnextattr(NXhandle handle, NXname pName, int *iLength, int *iType) NEXUS_DEPRECATED_FUNCTION;
630636

631637
/**
632638
* Read an attribute containing a single string or numerical value.

0 commit comments

Comments
 (0)