Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cortex-m-fork
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Per Lindgren
cortex-m-fork
Commits
4f9664c5
Commit
4f9664c5
authored
7 years ago
by
Jorge Aparicio
Browse files
Options
Downloads
Patches
Plain Diff
address review comments
parent
74045f24
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/macros.rs
+8
-5
8 additions, 5 deletions
src/macros.rs
with
8 additions
and
5 deletions
src/macros.rs
+
8
−
5
View file @
4f9664c5
...
...
@@ -23,7 +23,7 @@ macro_rules! iprintln {
};
}
/// Macro to create a
n
statically allocated value
/// Macro to create a
mutable reference to a
statically allocated value
///
/// This macro returns a value with type `Option<&'static mut $ty>`. `Some($expr)` will be returned
/// the first time the macro is executed; further calls will return `None`. To avoid `unwrap`ping a
...
...
@@ -32,10 +32,13 @@ macro_rules! iprintln {
///
/// # Example
///
/// ``` ignore
/// ``` no_run
/// #[macro_use(singleton)]
/// extern crate cortex_m;
///
/// fn main() {
/// // OK if `main` is executed only once
/// let x: &'static mut bool = s
tatic_
!(: bool = false).unwrap();
/// let x: &'static mut bool = s
ingleton
!(: bool = false).unwrap();
///
/// let y = alias();
/// // BAD this second call to `alias` will definitively `panic!`
...
...
@@ -43,11 +46,11 @@ macro_rules! iprintln {
/// }
///
/// fn alias() -> &'static mut bool {
/// s
tatic_
!(: bool = false).unwrap()
/// s
ingleton
!(: bool = false).unwrap()
/// }
/// ```
#[macro_export]
macro_rules!
s
tatic_
{
macro_rules!
s
ingleton
{
(:
$ty:ty
=
$expr:expr
)
=>
{
$crate
::
interrupt
::
free
(|
_
|
unsafe
{
static
mut
USED
:
bool
=
false
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment