Skip to content

Commit a109537

Browse files
bors[bot]burrbull
andauthored
Merge #95
95: v0.8.1 r=therealprof a=burrbull r? @therealprof Also I've found and fixed bug in #69 Co-authored-by: Andrey Zgarbul <zgarbul.andrey@gmail.com>
2 parents 3d26691 + eab9690 commit a109537

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
## [v0.8.1] - 2019-11-03
11+
12+
- Fix: make `derive_from` module public
13+
- Fix: enumerated_values empty check
14+
1015
## [v0.8.0] - 2019-11-03
1116

1217
- [breaking-change] `RegisterClusterArrayInfo` renamed on `DimElement`
@@ -106,7 +111,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
106111
- Initial SVD parser
107112
- A `parse` utility function to parse the contents of a SVD file (XML)
108113

109-
[Unreleased]: https://github.com/rust-embedded/svd/compare/v0.8.0...HEAD
114+
[Unreleased]: https://github.com/rust-embedded/svd/compare/v0.8.1...HEAD
115+
[v0.8.1]: https://github.com/rust-embedded/svd/compare/v0.8.0...v0.8.1
110116
[v0.8.0]: https://github.com/rust-embedded/svd/compare/v0.7.0...v0.8.0
111117
[v0.7.0]: https://github.com/rust-embedded/svd/compare/v0.6.0...v0.7.0
112118
[v0.6.0]: https://github.com/rust-embedded/svd/compare/v0.5.2...v0.6.0

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ use encode::Encode;
4949
pub mod types;
5050

5151
#[cfg(feature = "derive-from")]
52-
mod derive_from;
52+
pub mod derive_from;
5353
#[cfg(feature = "derive-from")]
5454
pub use derive_from::DeriveFrom;
5555

src/svd/enumeratedvalues.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ impl Parse for EnumeratedValues {
3131

3232
fn parse(tree: &Element) -> Result<EnumeratedValues, SVDError> {
3333
assert_eq!(tree.name, "enumeratedValues");
34+
let derived_from = tree.attributes.get("derivedFrom").map(|s| s.to_owned());
35+
let is_derived = derived_from.is_some();
3436

3537
Ok(EnumeratedValues {
3638
name: tree.get_child_text_opt("name")?,
3739
usage: parse::optional::<Usage>("usage", tree)?,
38-
derived_from: tree.attributes.get("derivedFrom").map(|s| s.to_owned()),
40+
derived_from,
3941
values: {
4042
let values: Result<Vec<_>, _> = tree
4143
.children
@@ -62,7 +64,7 @@ impl Parse for EnumeratedValues {
6264
})
6365
.collect();
6466
let values = values?;
65-
if values.is_empty() {
67+
if values.is_empty() && !is_derived {
6668
return Err(SVDErrorKind::EmptyTag(tree.clone(), tree.name.clone()).into());
6769
}
6870
values

0 commit comments

Comments
 (0)