Skip to content

Commit 2f6b605

Browse files
authored
Merge pull request #12 from GuillaumeGomez/cold-attr
Add GCC_JIT_FN_ATTRIBUTE_COLD attribute
2 parents d6e5262 + 4cbd3f1 commit 2f6b605

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

gccjit_sys/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ pub enum gcc_jit_fn_attribute
263263
GCC_JIT_FN_ATTRIBUTE_TARGET,
264264
GCC_JIT_FN_ATTRIBUTE_USED,
265265
GCC_JIT_FN_ATTRIBUTE_VISIBILITY,
266+
GCC_JIT_FN_ATTRIBUTE_COLD,
266267
}
267268

268269
#[cfg(feature="master")]

src/function.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ pub enum FnAttribute<'a> {
5555
Target(&'a str),
5656
Used,
5757
Visibility(Visibility),
58+
Cold,
5859
}
5960

6061
#[cfg(feature="master")]
@@ -63,8 +64,11 @@ impl<'a> FnAttribute<'a> {
6364
match *self {
6465
FnAttribute::Target(target) => AttributeValue::String(target),
6566
FnAttribute::Visibility(visibility) => AttributeValue::String(visibility.as_str()),
66-
FnAttribute::AlwaysInline | FnAttribute::Inline | FnAttribute::NoInline | FnAttribute::Used =>
67-
AttributeValue::None,
67+
FnAttribute::AlwaysInline
68+
| FnAttribute::Inline
69+
| FnAttribute::NoInline
70+
| FnAttribute::Used
71+
| FnAttribute::Cold => AttributeValue::None,
6872
}
6973
}
7074

@@ -76,6 +80,7 @@ impl<'a> FnAttribute<'a> {
7680
FnAttribute::Target(_) => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_TARGET,
7781
FnAttribute::Used => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_USED,
7882
FnAttribute::Visibility(_) => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_VISIBILITY,
83+
FnAttribute::Cold => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_COLD,
7984
}
8085
}
8186
}

0 commit comments

Comments
 (0)