mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 14:59:39 +02:00
gccrs: Remove global_asm and non_global_asm handler
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (MacroBuiltin::global_asm_handler): Remove global_asm and non_global_asm handler (MacroBuiltin::nonglobal_asm_handler): Likewise. (MacroBuiltin::asm_handler): Likewise. * expand/rust-macro-builtins.cc (enum class): Likewise. (inline_asm_maker): Likewise. * expand/rust-macro-builtins.h: Likewise.
This commit is contained in:
@@ -307,20 +307,9 @@ parse_format_string (Parser<MacroInvocLexer> &parser, TokenId last_token_id)
|
||||
}
|
||||
|
||||
tl::optional<AST::Fragment>
|
||||
MacroBuiltin::global_asm_handler (location_t invoc_locus,
|
||||
AST::MacroInvocData &invoc)
|
||||
MacroBuiltin::asm_handler (location_t invoc_locus, AST::MacroInvocData &invoc,
|
||||
bool is_global_asm)
|
||||
{
|
||||
// Just to clarify the code
|
||||
bool is_global_asm = true;
|
||||
return parse_asm (invoc_locus, invoc, is_global_asm);
|
||||
}
|
||||
|
||||
tl::optional<AST::Fragment>
|
||||
MacroBuiltin::nonglobal_asm_handler (location_t invoc_locus,
|
||||
AST::MacroInvocData &invoc)
|
||||
{
|
||||
// Just to clarify the code
|
||||
bool is_global_asm = false;
|
||||
return parse_asm (invoc_locus, invoc, is_global_asm);
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,22 @@ format_args_maker (AST::FormatArgs::Newline nl)
|
||||
};
|
||||
}
|
||||
|
||||
enum class isGlobalAsm
|
||||
{
|
||||
Yes,
|
||||
No,
|
||||
};
|
||||
|
||||
AST::MacroTranscriberFunc
|
||||
inline_asm_maker (isGlobalAsm is_global_asm)
|
||||
{
|
||||
bool global_asm = is_global_asm == isGlobalAsm::Yes ? true : false;
|
||||
|
||||
return [global_asm] (location_t loc, AST::MacroInvocData &invoc) {
|
||||
return MacroBuiltin::asm_handler (loc, invoc, global_asm);
|
||||
};
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, AST::MacroTranscriberFunc>
|
||||
MacroBuiltin::builtin_transcribers = {
|
||||
{"assert", MacroBuiltin::assert_handler},
|
||||
@@ -108,8 +124,8 @@ std::unordered_map<std::string, AST::MacroTranscriberFunc>
|
||||
{"include", MacroBuiltin::include_handler},
|
||||
{"format_args", format_args_maker (AST::FormatArgs::Newline::No)},
|
||||
{"format_args_nl", format_args_maker (AST::FormatArgs::Newline::Yes)},
|
||||
{"asm", MacroBuiltin::nonglobal_asm_handler},
|
||||
{"global_asm", MacroBuiltin::global_asm_handler},
|
||||
{"asm", inline_asm_maker (isGlobalAsm::No)},
|
||||
{"global_asm", inline_asm_maker (isGlobalAsm::Yes)},
|
||||
/* Unimplemented macro builtins */
|
||||
{"option_env", MacroBuiltin::sorry},
|
||||
{"concat_idents", MacroBuiltin::sorry},
|
||||
|
||||
@@ -159,11 +159,9 @@ public:
|
||||
static tl::optional<AST::Fragment> line_handler (location_t invoc_locus,
|
||||
AST::MacroInvocData &invoc);
|
||||
|
||||
static tl::optional<AST::Fragment>
|
||||
nonglobal_asm_handler (location_t invoc_locus, AST::MacroInvocData &invoc);
|
||||
|
||||
static tl::optional<AST::Fragment>
|
||||
global_asm_handler (location_t invoc_locus, AST::MacroInvocData &invoc);
|
||||
static tl::optional<AST::Fragment> asm_handler (location_t invoc_locus,
|
||||
AST::MacroInvocData &invoc,
|
||||
bool is_global_asm);
|
||||
|
||||
static tl::optional<AST::Fragment>
|
||||
format_args_handler (location_t invoc_locus, AST::MacroInvocData &invoc,
|
||||
|
||||
Reference in New Issue
Block a user