Skip to content

Commit 9b9bca0

Browse files
committed
Make deprecation warning compatible with MSVC
1 parent 2b5c7de commit 9b9bca0

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

include/b2nd.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ extern "C" {
3535
extern "C" {
3636
#endif
3737

38+
#if defined(_MSC_VER)
39+
#define B2ND_DEPRECATED(msg) __declspec(deprecated(msg))
40+
#elif defined(__GNUC__) || defined(__clang__)
41+
#define B2ND_DEPRECATED(msg) __attribute__((deprecated(msg)))
42+
#else
43+
#define B2ND_DEPRECATED(msg)
44+
#endif
3845

3946
/* The version for metalayer format; starts from 0 and it must not exceed 127 */
4047
#define B2ND_METALAYER_VERSION 0
@@ -569,14 +576,13 @@ BLOSC_EXPORT int b2nd_deserialize_meta(const uint8_t *smeta, int32_t smeta_len,
569576
* destination arrays before using this function, as it does not perform these
570577
* checks itself.
571578
*/
579+
B2ND_DEPRECATED("Use b2nd_copy_buffer2 instead.")
572580
BLOSC_EXPORT int b2nd_copy_buffer(int8_t ndim,
573581
uint8_t itemsize,
574582
const void *src, const int64_t *src_pad_shape,
575583
const int64_t *src_start, const int64_t *src_stop,
576584
void *dst, const int64_t *dst_pad_shape,
577-
const int64_t *dst_start)
578-
__attribute__((deprecated("Use b2nd_copy_buffer2 instead")));
579-
585+
const int64_t *dst_start);
580586

581587
/**
582588
* @brief Copy a slice of a source array into another array. The arrays have
@@ -596,9 +602,9 @@ BLOSC_EXPORT int b2nd_copy_buffer(int8_t ndim,
596602
*
597603
* @return An error code.
598604
*
599-
* @note This is a version of b2nd_copy_buffer that uses signed 32-bit integers for
600-
* copying data. This is useful when the data is stored in a buffer that uses
601-
* itemsizes that are larger than 255 bytes.
605+
* @note This is a version of (now deprecated) b2nd_copy_buffer() that uses
606+
* signed 32-bit integers for copying data. This is useful when data is stored
607+
* in a buffer that uses itemsizes that are larger than 255 bytes.
602608
*
603609
* @note Please make sure that slice boundaries fit within the source and
604610
* destination arrays before using this function, as it does not perform these

tests/b2nd/test_b2nd_full.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ CUTEST_TEST_TEST(full) {
5858
blosc2_remove_urlpath(urlpath);
5959

6060
blosc2_cparams cparams = BLOSC2_CPARAMS_DEFAULTS;
61-
cparams.nthreads = 1;
61+
cparams.nthreads = 2;
6262
cparams.typesize = typesize;
6363
blosc2_storage b2_storage = {.cparams=&cparams};
6464

@@ -125,7 +125,7 @@ CUTEST_TEST_TEST(full) {
125125
break;
126126
default:
127127
// Fill a buffer with fill_value and compare with buffer_dest
128-
for (uint32_t j = 0; j < typesize; ++j) {
128+
for (int32_t j = 0; j < typesize; ++j) {
129129
buffer_fill[j] = fill_value;
130130
}
131131
// Compare buffer_fill with buffer_dest

0 commit comments

Comments
 (0)