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

Add minimal preprocessor for assembly files #458

Merged
merged 1 commit into from
Aug 6, 2021
Merged

Conversation

jhand2
Copy link
Contributor

@jhand2 jhand2 commented Jul 13, 2021

In order to support macro definitions and code reuse in oreboot
assembly, add a minimal preprocessor library. This library only supports
the "#include" and "#define" preprocessor directives and has no
toolchain-specific dependencies.

Signed-off-by: Jordan Hand jhand@google.com

@jhand2 jhand2 force-pushed the rpp branch 2 times, most recently from 55c8ac7 to f8c96e9 Compare July 17, 2021 01:48
@rjoleary
Copy link
Contributor

Don't forget to run cargo fmt!

@rjoleary
Copy link
Contributor

This looks good. Just needs a cargo fmt.

@jhand2
Copy link
Contributor Author

jhand2 commented Jul 27, 2021

This looks good. Just needs a cargo fmt.

Thanks, done!

Comment on lines 69 to 77
let key = match parts.next() {
Some(k) => k,
None => {
return Err(ParsingError::new(
String::from("#define has no name"),
ctx.line_num,
))
}
};
Copy link

@LingMan LingMan Jul 29, 2021

Choose a reason for hiding this comment

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

Looks like this could be written a bit shorter like this:

let key = parts.next().ok_or_else(|| ParsingError::new(...))?;

Similarly in other places in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion! Done.

@jhand2 jhand2 force-pushed the rpp branch 2 times, most recently from b29ed9c to fdedc86 Compare July 30, 2021 00:13
In order to support macro definitions and code reuse in oreboot
assembly, add a minimal preprocessor library. This library only supports
the "#include" and "#define" preprocessor directives and has no
toolchain-specific dependencies.

Signed-off-by: Jordan Hand <jhand@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants