[gcc r14-7542] gccrs: libproc_macro: Put all structures in a namespace
Arthur Cohen
cohenarthur@gcc.gnu.org
Tue Jan 16 17:42:59 GMT 2024
https://gcc.gnu.org/g:e112189800b7af8e1c3ef35f8de55c0c58dec740
commit r14-7542-ge112189800b7af8e1c3ef35f8de55c0c58dec740
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date: Tue Apr 25 12:42:47 2023 +0200
gccrs: libproc_macro: Put all structures in a namespace
Put all functions and structures in a Procmacro namespace to avoid
spilling names in any other namespace.
libgrust/ChangeLog:
* libproc_macro/group.cc (Group::drop): Add Procmacro
namespace.
* libproc_macro/group.h: Likewise.
* libproc_macro/ident.cc (Ident::drop): Likewise.
* libproc_macro/ident.h (Ident__clone): Likewise.
* libproc_macro/literal.cc (Literal::make_isize):
Likewise.
* libproc_macro/literal.h (Literal__from_string):
Likewise.
* libproc_macro/punct.cc (Punct::make_punct): Likewise.
* libproc_macro/punct.h: Likewise.
* libproc_macro/tokenstream.cc (TokenStream__drop):
Likewise.
* libproc_macro/tokenstream.h (TokenStream__drop):
Likewise.
* libproc_macro/tokentree.cc (TokenTree::drop):
Likewise.
* libproc_macro/tokentree.h: Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diff:
---
libgrust/libproc_macro/group.cc | 2 ++
libgrust/libproc_macro/group.h | 2 ++
libgrust/libproc_macro/ident.cc | 2 ++
libgrust/libproc_macro/ident.h | 2 ++
libgrust/libproc_macro/literal.cc | 2 ++
libgrust/libproc_macro/literal.h | 2 ++
libgrust/libproc_macro/punct.cc | 2 ++
libgrust/libproc_macro/punct.h | 2 ++
libgrust/libproc_macro/tokenstream.cc | 2 ++
libgrust/libproc_macro/tokenstream.h | 2 ++
libgrust/libproc_macro/tokentree.cc | 2 ++
libgrust/libproc_macro/tokentree.h | 2 ++
12 files changed, 24 insertions(+)
diff --git a/libgrust/libproc_macro/group.cc b/libgrust/libproc_macro/group.cc
index c5948ed03c7..9394387f636 100644
--- a/libgrust/libproc_macro/group.cc
+++ b/libgrust/libproc_macro/group.cc
@@ -22,6 +22,7 @@
#include "group.h"
+namespace ProcMacro {
namespace Group {
Group
@@ -37,3 +38,4 @@ Group::drop (Group *g)
}
} // namespace Group
+} // namespace ProcMacro
diff --git a/libgrust/libproc_macro/group.h b/libgrust/libproc_macro/group.h
index bf2a23ff3ec..51913253550 100644
--- a/libgrust/libproc_macro/group.h
+++ b/libgrust/libproc_macro/group.h
@@ -25,6 +25,7 @@
#include "tokenstream.h"
+namespace ProcMacro {
namespace Group {
enum Delimiter
@@ -47,5 +48,6 @@ public:
};
} // namespace Group
+} // namespace ProcMacro
#endif /* ! GROUP_H */
diff --git a/libgrust/libproc_macro/ident.cc b/libgrust/libproc_macro/ident.cc
index 0bed2a8e7d4..6fe8676d45f 100644
--- a/libgrust/libproc_macro/ident.cc
+++ b/libgrust/libproc_macro/ident.cc
@@ -23,6 +23,7 @@
#include <cstring>
+namespace ProcMacro {
namespace Ident {
extern "C" {
@@ -84,3 +85,4 @@ Ident::drop (Ident *ident)
}
} // namespace Ident
+} // namespace ProcMacro
diff --git a/libgrust/libproc_macro/ident.h b/libgrust/libproc_macro/ident.h
index 0e21275863e..0c89185f306 100644
--- a/libgrust/libproc_macro/ident.h
+++ b/libgrust/libproc_macro/ident.h
@@ -26,6 +26,7 @@
#include <cstdint>
#include <string>
+namespace ProcMacro {
namespace Ident {
struct Ident
@@ -61,5 +62,6 @@ Ident__clone (const Ident *ident);
}
} // namespace Ident
+} // namespace ProcMacro
#endif /* ! IDENT_H */
diff --git a/libgrust/libproc_macro/literal.cc b/libgrust/libproc_macro/literal.cc
index d4977533a90..13b97a9417d 100644
--- a/libgrust/libproc_macro/literal.cc
+++ b/libgrust/libproc_macro/literal.cc
@@ -24,6 +24,7 @@
#include <cstring>
#include <cstdlib>
+namespace ProcMacro {
namespace Literal {
void
@@ -289,3 +290,4 @@ Literal::make_isize (std::int64_t value, bool suffixed)
}
} // namespace Literal
+} // namespace ProcMacro
diff --git a/libgrust/libproc_macro/literal.h b/libgrust/libproc_macro/literal.h
index 2c61231e8b2..15d40e06620 100644
--- a/libgrust/libproc_macro/literal.h
+++ b/libgrust/libproc_macro/literal.h
@@ -27,6 +27,7 @@
#include <string>
#include <vector>
+namespace ProcMacro {
namespace Literal {
enum UnsignedTag
{
@@ -207,5 +208,6 @@ Literal__from_string (const unsigned char *str, std::uint64_t len,
Literal *lit);
}
} // namespace Literal
+} // namespace ProcMacro
#endif /* ! LITERAL_H */
diff --git a/libgrust/libproc_macro/punct.cc b/libgrust/libproc_macro/punct.cc
index 67d35fec5a8..762d6424f94 100644
--- a/libgrust/libproc_macro/punct.cc
+++ b/libgrust/libproc_macro/punct.cc
@@ -23,6 +23,7 @@
#include "punct.h"
#include <cstdlib>
+namespace ProcMacro {
namespace Punct {
Punct
@@ -32,3 +33,4 @@ Punct::make_punct (std::uint32_t ch, Spacing spacing)
}
} // namespace Punct
+} // namespace ProcMacro
diff --git a/libgrust/libproc_macro/punct.h b/libgrust/libproc_macro/punct.h
index 0e5e42f674d..b9098b1e279 100644
--- a/libgrust/libproc_macro/punct.h
+++ b/libgrust/libproc_macro/punct.h
@@ -25,6 +25,7 @@
#include <cstdint>
+namespace ProcMacro {
namespace Punct {
enum Spacing
@@ -43,5 +44,6 @@ public:
};
} // namespace Punct
+} // namespace ProcMacro
#endif /* ! PUNCT_H */
diff --git a/libgrust/libproc_macro/tokenstream.cc b/libgrust/libproc_macro/tokenstream.cc
index 921cc22bf13..68e72666691 100644
--- a/libgrust/libproc_macro/tokenstream.cc
+++ b/libgrust/libproc_macro/tokenstream.cc
@@ -25,6 +25,7 @@
#include <cstring>
+namespace ProcMacro {
namespace TokenStream {
TokenStream
@@ -117,3 +118,4 @@ TokenStream__drop (TokenStream *stream)
}
} // namespace TokenStream
+} // namespace ProcMacro
diff --git a/libgrust/libproc_macro/tokenstream.h b/libgrust/libproc_macro/tokenstream.h
index 909e6f441b2..ac88f8047e3 100644
--- a/libgrust/libproc_macro/tokenstream.h
+++ b/libgrust/libproc_macro/tokenstream.h
@@ -26,6 +26,7 @@
#include <cstdint>
#include <vector>
+namespace ProcMacro {
namespace TokenTree {
struct TokenTree;
}
@@ -73,5 +74,6 @@ extern "C" void
TokenStream__drop (TokenStream *stream);
} // namespace TokenStream
+} // namespace ProcMacro
#endif /* ! TOKENSTREAM_H */
diff --git a/libgrust/libproc_macro/tokentree.cc b/libgrust/libproc_macro/tokentree.cc
index 924e50c6f3b..408828ba1f2 100644
--- a/libgrust/libproc_macro/tokentree.cc
+++ b/libgrust/libproc_macro/tokentree.cc
@@ -22,6 +22,7 @@
#include "tokentree.h"
+namespace ProcMacro {
namespace TokenTree {
TokenTree
@@ -76,3 +77,4 @@ TokenTree::drop (TokenTree *tt)
}
} // namespace TokenTree
+} // namespace ProcMacro
diff --git a/libgrust/libproc_macro/tokentree.h b/libgrust/libproc_macro/tokentree.h
index 86fc5eb2688..ada1557efd9 100644
--- a/libgrust/libproc_macro/tokentree.h
+++ b/libgrust/libproc_macro/tokentree.h
@@ -28,6 +28,7 @@
#include "punct.h"
#include "literal.h"
+namespace ProcMacro {
namespace TokenTree {
enum TokenTreeTag
@@ -61,5 +62,6 @@ public:
};
} // namespace TokenTree
+} // namespace ProcMacro
#endif /* ! TOKENTREE_H */
More information about the Gcc-cvs
mailing list