Add settings::Stringwise.

This trait allows settings to be manipulated as strings, using descriptors and
constant hash-table lookups.

Amend gen_settings.py to generate the necessary constant tables.
This commit is contained in:
Jakob Stoklund Olesen
2016-08-09 11:52:36 -07:00
parent d152719d93
commit 07e851a222
3 changed files with 259 additions and 0 deletions

View File

@@ -1,5 +1,24 @@
//! RISC-V Settings.
use settings::{Descriptor, Detail, Stringwise, Result, Error};
use std::fmt;
// Include code generated by `meta/gen_settings.py`. This file contains a public `Settings` 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;
#[test]
fn display_default() {
let s = Settings::default();
assert_eq!(s.to_string(),
"[riscv]\n\
supports_m = false\n\
supports_a = false\n\
supports_f = false\n\
supports_d = false\n");
}
}