Add a settings::Builder data type.
- Move detail data structures into a settings::detail module to avoid polluting the settings namespace. - Rename generated data types to 'Flags' in anticipation of computed predicate flags that can't be set. The Flags struct is immutable. - Use a settings::Builder struct to manipulate settings, then pass it to Flags::new().
This commit is contained in:
@@ -1,20 +1,21 @@
|
||||
//! RISC-V Settings.
|
||||
|
||||
use settings::{Descriptor, Detail, Stringwise, Result, Error};
|
||||
use settings::{detail, Builder};
|
||||
use std::fmt;
|
||||
|
||||
// Include code generated by `meta/gen_settings.py`. This file contains a public `Settings` struct
|
||||
// Include code generated by `meta/gen_settings.py`. This file contains a public `Flags` struct
|
||||
// with an impl for all of the settings defined in `meta/cretonne/settings.py`.
|
||||
include!(concat!(env!("OUT_DIR"), "/settings-riscv.rs"));
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::Settings;
|
||||
use super::{builder, Flags};
|
||||
|
||||
#[test]
|
||||
fn display_default() {
|
||||
let s = Settings::default();
|
||||
assert_eq!(s.to_string(),
|
||||
let b = builder();
|
||||
let f = Flags::new(b);
|
||||
assert_eq!(f.to_string(),
|
||||
"[riscv]\n\
|
||||
supports_m = false\n\
|
||||
supports_a = false\n\
|
||||
|
||||
Reference in New Issue
Block a user