Skip to content

Commit

Permalink
Make deprecation warning compatible with MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescAlted committed Feb 18, 2025
1 parent 2b5c7de commit 9b9bca0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
18 changes: 12 additions & 6 deletions include/b2nd.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ extern "C" {
extern "C" {
#endif

#if defined(_MSC_VER)
#define B2ND_DEPRECATED(msg) __declspec(deprecated(msg))
#elif defined(__GNUC__) || defined(__clang__)
#define B2ND_DEPRECATED(msg) __attribute__((deprecated(msg)))
#else
#define B2ND_DEPRECATED(msg)
#endif

/* The version for metalayer format; starts from 0 and it must not exceed 127 */
#define B2ND_METALAYER_VERSION 0
Expand Down Expand Up @@ -569,14 +576,13 @@ BLOSC_EXPORT int b2nd_deserialize_meta(const uint8_t *smeta, int32_t smeta_len,
* destination arrays before using this function, as it does not perform these
* checks itself.
*/
B2ND_DEPRECATED("Use b2nd_copy_buffer2 instead.")
BLOSC_EXPORT int b2nd_copy_buffer(int8_t ndim,
uint8_t itemsize,
const void *src, const int64_t *src_pad_shape,
const int64_t *src_start, const int64_t *src_stop,
void *dst, const int64_t *dst_pad_shape,
const int64_t *dst_start)
__attribute__((deprecated("Use b2nd_copy_buffer2 instead")));

const int64_t *dst_start);

/**
* @brief Copy a slice of a source array into another array. The arrays have
Expand All @@ -596,9 +602,9 @@ BLOSC_EXPORT int b2nd_copy_buffer(int8_t ndim,
*
* @return An error code.
*
* @note This is a version of b2nd_copy_buffer that uses signed 32-bit integers for
* copying data. This is useful when the data is stored in a buffer that uses
* itemsizes that are larger than 255 bytes.
* @note This is a version of (now deprecated) b2nd_copy_buffer() that uses
* signed 32-bit integers for copying data. This is useful when data is stored
* in a buffer that uses itemsizes that are larger than 255 bytes.
*
* @note Please make sure that slice boundaries fit within the source and
* destination arrays before using this function, as it does not perform these
Expand Down
4 changes: 2 additions & 2 deletions tests/b2nd/test_b2nd_full.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ CUTEST_TEST_TEST(full) {
blosc2_remove_urlpath(urlpath);

blosc2_cparams cparams = BLOSC2_CPARAMS_DEFAULTS;
cparams.nthreads = 1;
cparams.nthreads = 2;
cparams.typesize = typesize;
blosc2_storage b2_storage = {.cparams=&cparams};

Expand Down Expand Up @@ -125,7 +125,7 @@ CUTEST_TEST_TEST(full) {
break;
default:
// Fill a buffer with fill_value and compare with buffer_dest
for (uint32_t j = 0; j < typesize; ++j) {
for (int32_t j = 0; j < typesize; ++j) {
buffer_fill[j] = fill_value;
}
// Compare buffer_fill with buffer_dest
Expand Down

0 comments on commit 9b9bca0

Please sign in to comment.