Skip to content

Allow merging of statics generated by format!() #15871

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

Merged
merged 1 commit into from
Jul 22, 2014
Merged
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
7 changes: 6 additions & 1 deletion src/libsyntax/ext/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,19 @@ impl<'a, 'b> Context<'a, 'b> {
/// These attributes are applied to all statics that this syntax extension
/// will generate.
fn static_attrs(&self) -> Vec<ast::Attribute> {
// Flag statics as `inline` so LLVM can merge duplicate globals as much
// as possible (which we're generating a whole lot of).
let unnamed = self.ecx.meta_word(self.fmtsp, InternedString::new("inline"));
let unnamed = self.ecx.attribute(self.fmtsp, unnamed);

// Do not warn format string as dead code
let dead_code = self.ecx.meta_word(self.fmtsp,
InternedString::new("dead_code"));
let allow_dead_code = self.ecx.meta_list(self.fmtsp,
InternedString::new("allow"),
vec!(dead_code));
let allow_dead_code = self.ecx.attribute(self.fmtsp, allow_dead_code);
return vec!(allow_dead_code);
return vec!(unnamed, allow_dead_code);
}

fn rtpath(&self, s: &str) -> Vec<ast::Ident> {
Expand Down