Rollup merge of #111647 - klensy:cstr, r=oli-obk
use c literals in compiler and library Use c literals #108801 in compiler and library currently blocked on: * <strike>rustfmt: don't know how to format c literals</strike> nope, nightly one works. * <strike>bootstrap</strike> r? `@ghost` `@rustbot` blocked
This commit is contained in:
commit
a3b639ce43
23 changed files with 73 additions and 97 deletions
|
@ -8,7 +8,6 @@ use crate::llvm::{self, True};
|
|||
use crate::type_::Type;
|
||||
use crate::type_of::LayoutLlvmExt;
|
||||
use crate::value::Value;
|
||||
use cstr::cstr;
|
||||
use rustc_codegen_ssa::traits::*;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs};
|
||||
|
@ -482,9 +481,9 @@ impl<'ll> StaticMethods for CodegenCx<'ll, '_> {
|
|||
.all(|&byte| byte == 0);
|
||||
|
||||
let sect_name = if all_bytes_are_zero {
|
||||
cstr!("__DATA,__thread_bss")
|
||||
c"__DATA,__thread_bss"
|
||||
} else {
|
||||
cstr!("__DATA,__thread_data")
|
||||
c"__DATA,__thread_data"
|
||||
};
|
||||
llvm::LLVMSetSection(g, sect_name.as_ptr());
|
||||
}
|
||||
|
@ -513,7 +512,7 @@ impl<'ll> StaticMethods for CodegenCx<'ll, '_> {
|
|||
let val = llvm::LLVMMetadataAsValue(self.llcx, meta);
|
||||
llvm::LLVMAddNamedMetadataOperand(
|
||||
self.llmod,
|
||||
"wasm.custom_sections\0".as_ptr().cast(),
|
||||
c"wasm.custom_sections".as_ptr().cast(),
|
||||
val,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue