Skip to content

Commit b810b31

Browse files
committed
Replace hdf5_1_2_3 cfg flags with feature="1.2.3"
1 parent 42268f1 commit b810b31

32 files changed

+440
-418
lines changed

build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn main() {
1010
"DEP_HDF5_MSVC_DLL_INDIRECTION" => "h5_dll_indirection".into(),
1111
key if key.starts_with("DEP_HDF5_VERSION_") => {
1212
let version = key.trim_start_matches("DEP_HDF5_VERSION_");
13-
format!("hdf5_{}", version)
13+
format!("feature=\"{}\"", version.replace("_", "."))
1414
}
1515
_ => continue,
1616
};

hdf5-sys/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ impl Config {
616616
vs.extend((0..=7).map(|v| Version::new(1, 10, v))); // 1.10.[0-7]
617617
vs.push(Version::new(1, 12, 0)); // 1.12.0
618618
for v in vs.into_iter().filter(|&v| version >= v) {
619-
println!("cargo:rustc-cfg=hdf5_{}_{}_{}", v.major, v.minor, v.micro);
619+
println!("cargo:rustc-cfg=feature=\"{}.{}.{}\"", v.major, v.minor, v.micro);
620620
println!("cargo:version_{}_{}_{}=1", v.major, v.minor, v.micro);
621621
}
622622
if self.header.have_stdbool_h {

hdf5-sys/src/h5.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ pub type hsize_t = c_ulonglong;
1212
pub type hssize_t = c_longlong;
1313
pub type haddr_t = uint64_t;
1414

15-
#[cfg(all(hdf5_1_10_0, h5_have_stdbool_h))]
15+
#[cfg(all(feature = "1.10.0", h5_have_stdbool_h))]
1616
pub type hbool_t = u8;
17-
#[cfg(any(not(hdf5_1_10_0), not(h5_have_stdbool_h)))]
17+
#[cfg(any(not(feature = "1.10.0"), not(h5_have_stdbool_h)))]
1818
pub type hbool_t = c_uint;
1919

2020
#[repr(C)]
@@ -71,23 +71,23 @@ extern "C" {
7171
pub fn H5check_version(majnum: c_uint, minnum: c_uint, relnum: c_uint) -> herr_t;
7272
}
7373

74-
#[cfg(hdf5_1_8_13)]
74+
#[cfg(feature = "1.8.13")]
7575
extern "C" {
7676
pub fn H5free_memory(mem: *mut c_void) -> herr_t;
7777
}
7878

79-
#[cfg(hdf5_1_8_15)]
79+
#[cfg(feature = "1.8.15")]
8080
extern "C" {
8181
pub fn H5allocate_memory(size: size_t, clear: hbool_t) -> *mut c_void;
8282
pub fn H5resize_memory(mem: *mut c_void, size: size_t) -> *mut c_void;
8383
}
8484

85-
#[cfg(hdf5_1_8_16)]
85+
#[cfg(feature = "1.8.16")]
8686
extern "C" {
8787
pub fn H5is_library_threadsafe(is_ts: *mut hbool_t) -> herr_t;
8888
}
8989

90-
#[cfg(all(hdf5_1_10_7, not(hdf5_1_12_0)))]
90+
#[cfg(all(feature = "1.10.7", not(feature = "1.12.0")))]
9191
#[repr(C)]
9292
pub struct H5_alloc_stats_t {
9393
total_alloc_bytes: c_ulonglong,
@@ -99,7 +99,7 @@ pub struct H5_alloc_stats_t {
9999
peak_alloc_blocks_count: size_t,
100100
}
101101

102-
#[cfg(all(hdf5_1_10_7, not(hdf5_1_12_0)))]
102+
#[cfg(all(feature = "1.10.7", not(feature = "1.12.0")))]
103103
extern "C" {
104104
pub fn H5get_alloc_stats(stats: *mut H5_alloc_stats_t) -> herr_t;
105105
pub fn H5get_free_list_sizes(

hdf5-sys/src/h5ac.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ pub struct H5AC_cache_config_t {
4545
pub epochs_before_eviction: c_int,
4646
pub apply_empty_reserve: hbool_t,
4747
pub empty_reserve: c_double,
48-
#[cfg(not(hdf5_1_10_0))]
48+
#[cfg(not(feature = "1.10.0"))]
4949
pub dirty_bytes_threshold: c_int,
50-
#[cfg(hdf5_1_10_0)]
50+
#[cfg(feature = "1.10.0")]
5151
pub dirty_bytes_threshold: size_t,
5252
pub metadata_write_strategy: c_int,
5353
}
@@ -58,7 +58,7 @@ impl Default for H5AC_cache_config_t {
5858
}
5959
}
6060

61-
#[cfg(hdf5_1_10_1)]
61+
#[cfg(feature = "1.10.1")]
6262
mod hdf5_1_10_1 {
6363
use super::*;
6464

@@ -78,5 +78,5 @@ mod hdf5_1_10_1 {
7878
}
7979
}
8080

81-
#[cfg(hdf5_1_10_1)]
81+
#[cfg(feature = "1.10.1")]
8282
pub use self::hdf5_1_10_1::*;

hdf5-sys/src/h5d.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub const H5D_CHUNK_CACHE_NBYTES_DEFAULT: size_t = !0;
1616

1717
pub const H5D_CHUNK_CACHE_W0_DEFAULT: c_float = -1.0;
1818

19-
#[cfg(not(hdf5_1_10_0))]
19+
#[cfg(not(feature = "1.10.0"))]
2020
#[repr(C)]
2121
#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
2222
pub enum H5D_layout_t {
@@ -134,15 +134,15 @@ pub type H5D_operator_t = Option<
134134
) -> herr_t,
135135
>;
136136

137-
#[cfg(hdf5_1_8_11)]
137+
#[cfg(feature = "1.8.11")]
138138
pub type H5D_scatter_func_t = Option<
139139
extern "C" fn(
140140
src_buf: *mut *const c_void,
141141
src_buf_bytes_used: *mut size_t,
142142
op_data: *mut c_void,
143143
) -> herr_t,
144144
>;
145-
#[cfg(hdf5_1_8_11)]
145+
#[cfg(feature = "1.8.11")]
146146
pub type H5D_gather_func_t = Option<
147147
extern "C" fn(
148148
dst_buf: *const c_void,
@@ -180,7 +180,7 @@ extern "C" {
180180
buf: *mut c_void, type_id: hid_t, space_id: hid_t, op: H5D_operator_t,
181181
operator_data: *mut c_void,
182182
) -> herr_t;
183-
#[cfg_attr(hdf5_1_12_0, deprecated(note = "deprecated in HDF5 1.12.0, use H5Treclaim"))]
183+
#[cfg_attr(feature = "1.12.0", deprecated(note = "deprecated in HDF5 1.12.0, use H5Treclaim"))]
184184
pub fn H5Dvlen_reclaim(
185185
type_id: hid_t, space_id: hid_t, plist_id: hid_t, buf: *mut c_void,
186186
) -> herr_t;
@@ -201,7 +201,7 @@ extern "C" {
201201
pub fn H5Dopen1(file_id: hid_t, name: *const c_char) -> hid_t;
202202
}
203203

204-
#[cfg(hdf5_1_8_11)]
204+
#[cfg(feature = "1.8.11")]
205205
extern "C" {
206206
pub fn H5Dscatter(
207207
op: H5D_scatter_func_t, op_data: *mut c_void, type_id: hid_t, dst_space_id: hid_t,
@@ -213,7 +213,7 @@ extern "C" {
213213
) -> herr_t;
214214
}
215215

216-
#[cfg(hdf5_1_10_0)]
216+
#[cfg(feature = "1.10.0")]
217217
mod hdf5_1_10_0 {
218218
use super::*;
219219

@@ -260,10 +260,10 @@ mod hdf5_1_10_0 {
260260
}
261261
}
262262

263-
#[cfg(hdf5_1_10_0)]
263+
#[cfg(feature = "1.10.0")]
264264
pub use self::hdf5_1_10_0::*;
265265

266-
#[cfg(hdf5_1_10_3)]
266+
#[cfg(feature = "1.10.3")]
267267
extern "C" {
268268
pub fn H5Dread_chunk(
269269
dset_id: hid_t, dxpl_id: hid_t, offset: *const hsize_t, filters: *mut u32, buf: *mut c_void,
@@ -274,7 +274,7 @@ extern "C" {
274274
) -> herr_t;
275275
}
276276

277-
#[cfg(hdf5_1_10_5)]
277+
#[cfg(feature = "1.10.5")]
278278
extern "C" {
279279
pub fn H5Dget_chunk_info(
280280
dset_id: hid_t, fspace_id: hid_t, index: hsize_t, offset: *mut hsize_t,

hdf5-sys/src/h5f.rs

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ pub use self::H5F_close_degree_t::*;
55
pub use self::H5F_libver_t::*;
66
pub use self::H5F_mem_t::*;
77
pub use self::H5F_scope_t::*;
8-
#[cfg(not(hdf5_1_10_0))]
8+
#[cfg(not(feature = "1.10.0"))]
99
pub use {
1010
H5F_info1_t as H5F_info_t, H5F_info1_t__sohm as H5F_info_t__sohm, H5Fget_info1 as H5Fget_info,
1111
};
12-
#[cfg(hdf5_1_10_0)]
12+
#[cfg(feature = "1.10.0")]
1313
pub use {
1414
H5F_info2_t as H5F_info_t, H5F_info2_t__free as H5F_info_t__free,
1515
H5F_info2_t__sohm as H5F_info_t__sohm, H5F_info2_t__super as H5F_info_t__super,
@@ -20,7 +20,7 @@ use crate::internal_prelude::*;
2020

2121
use crate::h5ac::H5AC_cache_config_t;
2222

23-
#[cfg_attr(hdf5_1_10_0, deprecated(note = "deprecated in HDF5 1.10.0"))]
23+
#[cfg_attr(feature = "1.10.0", deprecated(note = "deprecated in HDF5 1.10.0"))]
2424
pub const H5F_ACC_DEBUG: c_uint = 0x0000;
2525

2626
/* these flags call H5check() in the C library */
@@ -68,7 +68,7 @@ impl Default for H5F_close_degree_t {
6868
}
6969
}
7070

71-
#[cfg_attr(hdf5_1_10_0, deprecated(note = "deprecated in HDF5 1.10.0, use H5F_info2_t"))]
71+
#[cfg_attr(feature = "1.10.0", deprecated(note = "deprecated in HDF5 1.10.0, use H5F_info2_t"))]
7272
#[repr(C)]
7373
#[derive(Debug, Copy, Clone)]
7474
pub struct H5F_info1_t {
@@ -82,7 +82,7 @@ impl Default for H5F_info1_t {
8282
}
8383
}
8484

85-
#[cfg_attr(hdf5_1_10_0, deprecated(note = "deprecated in HDF5 1.10.0, use H5F_info2_t"))]
85+
#[cfg_attr(feature = "1.10.0", deprecated(note = "deprecated in HDF5 1.10.0, use H5F_info2_t"))]
8686
#[repr(C)]
8787
#[derive(Debug, Copy, Clone)]
8888
pub struct H5F_info1_t__sohm {
@@ -110,15 +110,15 @@ pub enum H5F_mem_t {
110110
H5FD_MEM_NTYPES = 7,
111111
}
112112

113-
#[cfg(not(hdf5_1_10_2))]
113+
#[cfg(not(feature = "1.10.2"))]
114114
#[repr(C)]
115115
#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
116116
pub enum H5F_libver_t {
117117
H5F_LIBVER_EARLIEST = 0,
118118
H5F_LIBVER_LATEST = 1,
119119
}
120120

121-
#[cfg(hdf5_1_10_2)]
121+
#[cfg(feature = "1.10.2")]
122122
#[repr(C)]
123123
#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
124124
pub enum H5F_libver_t {
@@ -129,7 +129,7 @@ pub enum H5F_libver_t {
129129
H5F_LIBVER_NBOUNDS = 3,
130130
}
131131

132-
#[cfg(hdf5_1_10_2)]
132+
#[cfg(feature = "1.10.2")]
133133
pub const H5F_LIBVER_LATEST: H5F_libver_t = H5F_LIBVER_V110;
134134

135135
impl Default for H5F_libver_t {
@@ -145,7 +145,7 @@ extern "C" {
145145
)]
146146
pub fn H5Fset_latest_format(file_id: hid_t, latest_format: hbool_t) -> herr_t;
147147
pub fn H5Fis_hdf5(filename: *const c_char) -> htri_t;
148-
#[cfg(hdf5_1_12_0)]
148+
#[cfg(feature = "1.12.0")]
149149
pub fn H5Fis_accessible(container_name: *const c_char, fapl_id: hid_t) -> htri_t;
150150
pub fn H5Fcreate(
151151
filename: *const c_char, flags: c_uint, create_plist: hid_t, access_plist: hid_t,
@@ -154,12 +154,12 @@ extern "C" {
154154
pub fn H5Freopen(file_id: hid_t) -> hid_t;
155155
pub fn H5Fflush(object_id: hid_t, scope: H5F_scope_t) -> herr_t;
156156
pub fn H5Fclose(file_id: hid_t) -> herr_t;
157-
#[cfg(hdf5_1_12_0)]
157+
#[cfg(feature = "1.12.0")]
158158
pub fn H5Fdelete(filename: *const c_char, fapl_id: hid_t) -> herr_t;
159159
pub fn H5Fget_create_plist(file_id: hid_t) -> hid_t;
160160
pub fn H5Fget_access_plist(file_id: hid_t) -> hid_t;
161161
pub fn H5Fget_intent(file_id: hid_t, intent: *mut c_uint) -> herr_t;
162-
#[cfg(hdf5_1_12_0)]
162+
#[cfg(feature = "1.12.0")]
163163
pub fn H5Fget_fileno(file_id: hid_t, fileno: *mut c_ulong) -> herr_t;
164164
pub fn H5Fget_obj_count(file_id: hid_t, types: c_uint) -> ssize_t;
165165
pub fn H5Fget_obj_ids(
@@ -181,23 +181,23 @@ extern "C" {
181181
pub fn H5Fget_name(obj_id: hid_t, name: *mut c_char, size: size_t) -> ssize_t;
182182
}
183183

184-
#[cfg(hdf5_1_8_7)]
184+
#[cfg(feature = "1.8.7")]
185185
extern "C" {
186186
pub fn H5Fclear_elink_file_cache(file_id: hid_t) -> herr_t;
187187
}
188188

189-
#[cfg(hdf5_1_8_9)]
189+
#[cfg(feature = "1.8.9")]
190190
extern "C" {
191191
pub fn H5Fget_file_image(file_id: hid_t, buf_ptr: *mut c_void, buf_len: size_t) -> ssize_t;
192192
}
193193

194-
#[cfg(all(hdf5_1_8_9, h5_have_parallel))]
194+
#[cfg(all(feature = "1.8.9", h5_have_parallel))]
195195
extern "C" {
196196
pub fn H5Fset_mpi_atomicity(file_id: hid_t, flag: hbool_t) -> herr_t;
197197
pub fn H5Fget_mpi_atomicity(file_id: hid_t, flag: *mut hbool_t) -> herr_t;
198198
}
199199

200-
#[cfg(hdf5_1_10_0)]
200+
#[cfg(feature = "1.10.0")]
201201
mod hdf5_1_10_0 {
202202
use super::*;
203203

@@ -318,15 +318,18 @@ mod hdf5_1_10_0 {
318318
}
319319

320320
extern "C" {
321-
#[cfg_attr(hdf5_1_10_0, deprecated(note = "deprecated in HDF5 1.10.0, use H5Fget_info2"))]
322-
#[cfg_attr(not(hdf5_1_10_0), link_name = "H5Fget_info")]
321+
#[cfg_attr(
322+
feature = "1.10.0",
323+
deprecated(note = "deprecated in HDF5 1.10.0, use H5Fget_info2")
324+
)]
325+
#[cfg_attr(not(feature = "1.10.0"), link_name = "H5Fget_info")]
323326
pub fn H5Fget_info1(obj_id: hid_t, finfo: *mut H5F_info1_t) -> herr_t;
324327
}
325328

326-
#[cfg(hdf5_1_10_0)]
329+
#[cfg(feature = "1.10.0")]
327330
pub use self::hdf5_1_10_0::*;
328331

329-
#[cfg(hdf5_1_10_1)]
332+
#[cfg(feature = "1.10.1")]
330333
mod hdf5_1_10_1 {
331334
use super::*;
332335

@@ -360,10 +363,10 @@ mod hdf5_1_10_1 {
360363
}
361364
}
362365

363-
#[cfg(hdf5_1_10_1)]
366+
#[cfg(feature = "1.10.1")]
364367
pub use self::hdf5_1_10_1::*;
365368

366-
#[cfg(hdf5_1_10_5)]
369+
#[cfg(feature = "1.10.5")]
367370
extern "C" {
368371
pub fn H5Fget_dset_no_attrs_hint(file_id: hid_t, minimize: *mut hbool_t) -> herr_t;
369372
pub fn H5Fset_dset_no_attrs_hint(file_id: hid_t, minimize: hbool_t) -> herr_t;

hdf5-sys/src/h5fd.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub const H5FD_FEAT_DIRTY_SBLK_LOAD: c_uint = 0x00000040;
6767
pub const H5FD_FEAT_POSIX_COMPAT_HANDLE: c_uint = 0x00000080;
6868
pub const H5FD_FEAT_ALLOW_FILE_IMAGE: c_uint = 0x00000400;
6969
pub const H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS: c_uint = 0x00000800;
70-
#[cfg(hdf5_1_10_2)]
70+
#[cfg(feature = "1.10.2")]
7171
pub const H5FD_FEAT_DEFAULT_VFD_COMPATIBLE: c_uint = 0x00008000;
7272

7373
/* Flags for H5Pset_fapl_log() */
@@ -262,7 +262,7 @@ pub enum H5FD_file_image_op_t {
262262
H5FD_FILE_IMAGE_OP_FILE_CLOSE = 7,
263263
}
264264

265-
#[cfg(hdf5_1_8_9)]
265+
#[cfg(feature = "1.8.9")]
266266
#[repr(C)]
267267
#[derive(Debug, Copy, Clone)]
268268
pub struct H5FD_file_image_callbacks_t {
@@ -302,7 +302,7 @@ pub struct H5FD_file_image_callbacks_t {
302302
pub udata: *mut c_void,
303303
}
304304

305-
#[cfg(hdf5_1_8_9)]
305+
#[cfg(feature = "1.8.9")]
306306
impl Default for H5FD_file_image_callbacks_t {
307307
fn default() -> Self {
308308
unsafe { mem::zeroed() }
@@ -362,13 +362,13 @@ extern "C" {
362362
pub fn H5FD_direct_init() -> hid_t;
363363
}
364364

365-
#[cfg(hdf5_1_10_0)]
365+
#[cfg(feature = "1.10.0")]
366366
extern "C" {
367367
pub fn H5FDlock(file: *mut H5FD_t, rw: hbool_t) -> herr_t;
368368
pub fn H5FDunlock(file: *mut H5FD_t) -> herr_t;
369369
}
370370

371-
#[cfg(hdf5_1_10_6)]
371+
#[cfg(feature = "1.10.6")]
372372
pub mod hdfs {
373373
use super::*;
374374
pub const H5FD__CURR_HDFS_FAPL_T_VERSION: c_uint = 1;
@@ -393,7 +393,7 @@ pub mod hdfs {
393393
}
394394
}
395395

396-
#[cfg(hdf5_1_10_6)]
396+
#[cfg(feature = "1.10.6")]
397397
pub mod ros3 {
398398
use super::*;
399399
pub const H5FD_CURR_ROS3_FAPL_T_VERSION: c_uint = 1;
@@ -417,7 +417,7 @@ pub mod ros3 {
417417
}
418418
}
419419

420-
#[cfg(all(hdf5_1_10_7, not(hdf5_1_12_0)))]
420+
#[cfg(all(feature = "1.10.7", not(feature = "1.12.0")))]
421421
pub mod splitter {
422422
use super::*;
423423

@@ -447,7 +447,7 @@ pub mod splitter {
447447
}
448448
}
449449

450-
#[cfg(hdf5_1_10_2)]
450+
#[cfg(feature = "1.10.2")]
451451
extern "C" {
452452
pub fn H5FDdriver_query(driver_id: hid_t, flags: *mut c_ulong) -> herr_t;
453453
}

0 commit comments

Comments
 (0)