Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix and check compilation with no features #876

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ jobs:
with:
key: ${{ matrix.TARGET }}

- run: cargo check --target ${{ matrix.TARGET }} --no-default-features
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I copied this over to #877 (with you as the commit author), hope that's ok,

env:
RUSTFLAGS: -D warnings
- run: cargo check --target ${{ matrix.TARGET }}
env:
RUSTFLAGS: -D warnings
Expand Down
1 change: 1 addition & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub struct Config {
pub base_address_shift: u64,
pub html_url: Option<url::Url>,
/// Path to YAML file with chip-specific settings
#[cfg(feature = "yaml")]
pub settings: Option<PathBuf>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would just ignore the settings file, even if it is configured, correct?
Wouldn't it be better to report an error instead, like I implemented in #877?

}

Expand Down
3 changes: 3 additions & 0 deletions src/generate/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
}
};

#[cfg(feature = "yaml")]
let settings = match config.settings.as_ref() {
Some(settings) => {
let file = std::fs::read_to_string(settings).context("could not read settings file")?;
Some(serde_yaml::from_str(&file).context("could not parse settings file")?)
}
None => None,
};
#[cfg(not(feature = "yaml"))]
let settings = None;

if config.target == Target::Msp430 {
out.extend(quote! {
Expand Down
Loading