[gcc r14-7853] gccrs: Move callbacked function in a new namespace

Arthur Cohen cohenarthur@gcc.gnu.org
Tue Jan 16 18:04:12 GMT 2024


https://gcc.gnu.org/g:6d1adb5c393814fd800c0fcf153204b6bf9ba417

commit r14-7853-g6d1adb5c393814fd800c0fcf153204b6bf9ba417
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Thu Jul 27 15:22:48 2023 +0200

    gccrs: Move callbacked function in a new namespace
    
    Move the function registered as a callback in a new anonymous namespace
    in order to group every callback in the future under the same namespace.
    
    gcc/rust/ChangeLog:
    
            * expand/rust-proc-macro.cc: Remove static modifier and move to
            an anonymous namespace.
    
    Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>

Diff:
---
 gcc/rust/expand/rust-proc-macro.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/rust/expand/rust-proc-macro.cc b/gcc/rust/expand/rust-proc-macro.cc
index 9fee4bb03bd..c664e20ecbc 100644
--- a/gcc/rust/expand/rust-proc-macro.cc
+++ b/gcc/rust/expand/rust-proc-macro.cc
@@ -26,7 +26,9 @@ namespace Rust {
 
 const std::string PROC_MACRO_DECL_PREFIX = "__gccrs_proc_macro_decls_";
 
-static ProcMacro::TokenStream
+namespace {
+
+ProcMacro::TokenStream
 tokenstream_from_string (std::string &data, bool &lex_error)
 {
   // FIXME: Insert location pointing to call site in tokens
@@ -56,6 +58,8 @@ static_assert (
 	       ProcMacro::from_str_function_t>::value,
   "Registration callback signature not synced, check proc macro internals.");
 
+} // namespace
+
 template <typename Symbol, typename Callback>
 bool
 register_callback (void *handle, Symbol, std::string symbol_name,


More information about the Gcc-cvs mailing list