File tree Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ This changelog tracks the Rust `svdtools` project. See
11
11
* Strip ` alternateRegister ` too
12
12
* Add ` modifiedWriteValues ` and ` readAction ` field patch (#156 )
13
13
* Fix #144
14
+ * Flag to check for errors after patching
14
15
15
16
## [ v0.3.6] 2023-11-01
16
17
Original file line number Diff line number Diff line change @@ -29,6 +29,10 @@ enum Command {
29
29
#[ clap( long) ]
30
30
format_config : Option < PathBuf > ,
31
31
32
+ /// Check for errors after patching
33
+ #[ clap( long) ]
34
+ post_validate : bool ,
35
+
32
36
/// When a patch error happens print formatted yaml with all rules included
33
37
#[ clap( long) ]
34
38
show_patch_on_error : bool ,
@@ -125,10 +129,14 @@ impl Command {
125
129
yaml_file,
126
130
out_path,
127
131
format_config,
132
+ post_validate,
128
133
show_patch_on_error,
129
134
enum_derive,
130
135
} => {
131
136
let mut config = svdtools:: patch:: Config :: default ( ) ;
137
+ if * post_validate {
138
+ config. post_validate = svd_rs:: ValidateLevel :: Strict ;
139
+ }
132
140
config. show_patch_on_error = * show_patch_on_error;
133
141
if let Some ( enum_derive) = enum_derive. as_ref ( ) {
134
142
config. enum_derive = * enum_derive;
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ const VAL_LVL: ValidateLevel = ValidateLevel::Weak;
34
34
#[ non_exhaustive]
35
35
#[ derive( Clone , Debug ) ]
36
36
pub struct Config {
37
+ pub post_validate : ValidateLevel ,
37
38
pub show_patch_on_error : bool ,
38
39
pub enum_derive : EnumAutoDerive ,
39
40
pub update_fields : bool ,
@@ -56,6 +57,7 @@ pub enum EnumAutoDerive {
56
57
impl Default for Config {
57
58
fn default ( ) -> Self {
58
59
Self {
60
+ post_validate : ValidateLevel :: Disabled ,
59
61
show_patch_on_error : false ,
60
62
enum_derive : Default :: default ( ) ,
61
63
update_fields : true ,
@@ -115,6 +117,8 @@ pub fn process_file(
115
117
}
116
118
} ) ?;
117
119
120
+ svd. validate_all ( config. post_validate ) ?;
121
+
118
122
// SVD should now be updated, write it out
119
123
let config = get_encoder_config ( format_config) ?;
120
124
let svd_out = svd_encoder:: encode_with_config ( & svd, & config) ?;
You can’t perform that action at this time.
0 commit comments