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
1111* Strip ` alternateRegister ` too
1212* Add ` modifiedWriteValues ` and ` readAction ` field patch (#156 )
1313* Fix #144
14+ * Flag to check for errors after patching
1415
1516## [ v0.3.6] 2023-11-01
1617
Original file line number Diff line number Diff line change @@ -29,6 +29,10 @@ enum Command {
2929 #[ clap( long) ]
3030 format_config : Option < PathBuf > ,
3131
32+ /// Check for errors after patching
33+ #[ clap( long) ]
34+ post_validate : bool ,
35+
3236 /// When a patch error happens print formatted yaml with all rules included
3337 #[ clap( long) ]
3438 show_patch_on_error : bool ,
@@ -125,10 +129,14 @@ impl Command {
125129 yaml_file,
126130 out_path,
127131 format_config,
132+ post_validate,
128133 show_patch_on_error,
129134 enum_derive,
130135 } => {
131136 let mut config = svdtools:: patch:: Config :: default ( ) ;
137+ if * post_validate {
138+ config. post_validate = svd_rs:: ValidateLevel :: Strict ;
139+ }
132140 config. show_patch_on_error = * show_patch_on_error;
133141 if let Some ( enum_derive) = enum_derive. as_ref ( ) {
134142 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;
3434#[ non_exhaustive]
3535#[ derive( Clone , Debug ) ]
3636pub struct Config {
37+ pub post_validate : ValidateLevel ,
3738 pub show_patch_on_error : bool ,
3839 pub enum_derive : EnumAutoDerive ,
3940 pub update_fields : bool ,
@@ -56,6 +57,7 @@ pub enum EnumAutoDerive {
5657impl Default for Config {
5758 fn default ( ) -> Self {
5859 Self {
60+ post_validate : ValidateLevel :: Disabled ,
5961 show_patch_on_error : false ,
6062 enum_derive : Default :: default ( ) ,
6163 update_fields : true ,
@@ -115,6 +117,8 @@ pub fn process_file(
115117 }
116118 } ) ?;
117119
120+ svd. validate_all ( config. post_validate ) ?;
121+
118122 // SVD should now be updated, write it out
119123 let config = get_encoder_config ( format_config) ?;
120124 let svd_out = svd_encoder:: encode_with_config ( & svd, & config) ?;
You can’t perform that action at this time.
0 commit comments