diff options
author | Simon Cook <simon.cook@embecosm.com> | 2022-04-12 16:45:56 +0200 |
---|---|---|
committer | Simon Cook <simon.cook@embecosm.com> | 2022-04-12 16:45:56 +0200 |
commit | 1a3f38a2b0b7a1d13a934952f74a4a910035e72b (patch) | |
tree | d9528e076ff348fc2401f296e63fcb0695bccea4 /gcc | |
parent | 68458036c81d141a3899ac4e6ec6ddf0fdfde174 (diff) | |
download | gcc-1a3f38a2b0b7a1d13a934952f74a4a910035e72b.zip gcc-1a3f38a2b0b7a1d13a934952f74a4a910035e72b.tar.gz gcc-1a3f38a2b0b7a1d13a934952f74a4a910035e72b.tar.bz2 |
rust: Allow gccrs to build on x86_64-apple-darwin with clang/libc++
This makes changes to the includes such that gccrs can be built with
clang/libc++, and for x86_64-apple-darwin. Similarly, a couple of
changes have been made to creating MacroInvocations and wrapping into
ExprOrStmts for libc++ compatibility.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/ast/rust-path.h | 3 | ||||
-rw-r--r-- | gcc/rust/backend/rust-mangle.cc | 1 | ||||
-rw-r--r-- | gcc/rust/expand/rust-macro-builtins.h | 6 | ||||
-rw-r--r-- | gcc/rust/hir/tree/rust-hir-path.h | 3 | ||||
-rw-r--r-- | gcc/rust/lex/rust-lex.cc | 2 | ||||
-rw-r--r-- | gcc/rust/lex/rust-lex.h | 4 | ||||
-rw-r--r-- | gcc/rust/lex/rust-token.h | 3 | ||||
-rw-r--r-- | gcc/rust/lint/rust-lint-marklive.h | 1 | ||||
-rw-r--r-- | gcc/rust/lint/rust-lint-scan-deadcode.h | 1 | ||||
-rw-r--r-- | gcc/rust/parse/rust-cfg-parser.h | 4 | ||||
-rw-r--r-- | gcc/rust/parse/rust-parse-impl.h | 10 | ||||
-rw-r--r-- | gcc/rust/parse/rust-parse.h | 5 | ||||
-rw-r--r-- | gcc/rust/rust-buffered-queue.h | 3 | ||||
-rw-r--r-- | gcc/rust/rust-session-manager.h | 2 | ||||
-rw-r--r-- | gcc/rust/rust-system.h | 2 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-hir-type-check-util.h | 2 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-tycheck-dump.h | 3 | ||||
-rw-r--r-- | gcc/rust/util/fnv-hash.h | 3 | ||||
-rw-r--r-- | gcc/rust/util/rust-abi.h | 2 | ||||
-rw-r--r-- | gcc/rust/util/rust-base62.cc | 2 | ||||
-rw-r--r-- | gcc/rust/util/rust-base62.h | 2 | ||||
-rw-r--r-- | gcc/rust/util/rust-inline-visitor.h | 3 | ||||
-rw-r--r-- | gcc/rust/util/rust-make-unique.h | 2 |
23 files changed, 22 insertions, 47 deletions
diff --git a/gcc/rust/ast/rust-path.h b/gcc/rust/ast/rust-path.h index a189872..593f979 100644 --- a/gcc/rust/ast/rust-path.h +++ b/gcc/rust/ast/rust-path.h @@ -23,9 +23,6 @@ #include "rust-ast.h" -#include <string> -#include <vector> - namespace Rust { namespace AST { diff --git a/gcc/rust/backend/rust-mangle.cc b/gcc/rust/backend/rust-mangle.cc index 82f643a..c0aea02 100644 --- a/gcc/rust/backend/rust-mangle.cc +++ b/gcc/rust/backend/rust-mangle.cc @@ -1,7 +1,6 @@ #include "rust-mangle.h" #include "fnv-hash.h" #include "rust-base62.h" -#include <algorithm> // FIXME: Rename those to legacy_* static const std::string kMangledSymbolPrefix = "_ZN"; diff --git a/gcc/rust/expand/rust-macro-builtins.h b/gcc/rust/expand/rust-macro-builtins.h index a581af4..3f4bf37 100644 --- a/gcc/rust/expand/rust-macro-builtins.h +++ b/gcc/rust/expand/rust-macro-builtins.h @@ -59,6 +59,12 @@ * of the `Mappings` class. */ +/* If assert is defined as a macro this file will not parse, so undefine this + before continuing. */ +#ifdef assert +#undef assert +#endif + namespace Rust { class MacroBuiltin { diff --git a/gcc/rust/hir/tree/rust-hir-path.h b/gcc/rust/hir/tree/rust-hir-path.h index 99f4f0b..84096ce 100644 --- a/gcc/rust/hir/tree/rust-hir-path.h +++ b/gcc/rust/hir/tree/rust-hir-path.h @@ -21,9 +21,6 @@ #include "rust-hir.h" -#include <string> -#include <vector> - namespace Rust { namespace HIR { diff --git a/gcc/rust/lex/rust-lex.cc b/gcc/rust/lex/rust-lex.cc index f620e15..ea09ac2 100644 --- a/gcc/rust/lex/rust-lex.cc +++ b/gcc/rust/lex/rust-lex.cc @@ -23,8 +23,6 @@ #include "rust-linemap.h" #include "safe-ctype.h" -#include <sstream> // for ostringstream - namespace Rust { // TODO: move to separate compilation unit? // overload += for uint32_t to allow 32-bit encoded utf-8 to be added diff --git a/gcc/rust/lex/rust-lex.h b/gcc/rust/lex/rust-lex.h index 039c783..e01d86d 100644 --- a/gcc/rust/lex/rust-lex.h +++ b/gcc/rust/lex/rust-lex.h @@ -23,10 +23,6 @@ #include "rust-buffered-queue.h" #include "rust-token.h" -#include <cstdio> -#include <utility> -#include <tuple> - namespace Rust { // Simple wrapper for FILE* that simplifies destruction. struct RAIIFile diff --git a/gcc/rust/lex/rust-token.h b/gcc/rust/lex/rust-token.h index bbc6d5d..3fa46a2 100644 --- a/gcc/rust/lex/rust-token.h +++ b/gcc/rust/lex/rust-token.h @@ -19,9 +19,6 @@ #ifndef RUST_TOKEN_H #define RUST_TOKEN_H -#include <string> -#include <memory> - #include "rust-linemap.h" #include "rust-codepoint.h" diff --git a/gcc/rust/lint/rust-lint-marklive.h b/gcc/rust/lint/rust-lint-marklive.h index d0ab2b4..aeecda5 100644 --- a/gcc/rust/lint/rust-lint-marklive.h +++ b/gcc/rust/lint/rust-lint-marklive.h @@ -19,7 +19,6 @@ #ifndef RUST_HIR_LIVENESS #define RUST_HIR_LIVENESS -#include <set> #include "rust-hir-full-decls.h" #include "rust-hir-map.h" #include "rust-lint-marklive-base.h" diff --git a/gcc/rust/lint/rust-lint-scan-deadcode.h b/gcc/rust/lint/rust-lint-scan-deadcode.h index 00114f2..591cb30 100644 --- a/gcc/rust/lint/rust-lint-scan-deadcode.h +++ b/gcc/rust/lint/rust-lint-scan-deadcode.h @@ -19,7 +19,6 @@ #ifndef RUST_HIR_SCAN_DEADCODE #define RUST_HIR_SCAN_DEADCODE -#include <set> #include "rust-hir-full-decls.h" #include "rust-hir-map.h" #include "rust-lint-marklive.h" diff --git a/gcc/rust/parse/rust-cfg-parser.h b/gcc/rust/parse/rust-cfg-parser.h index bf4ed4d..895e058 100644 --- a/gcc/rust/parse/rust-cfg-parser.h +++ b/gcc/rust/parse/rust-cfg-parser.h @@ -18,11 +18,9 @@ along with GCC; see the file COPYING3. If not see #define RUST_CFG_PARSER_H #include "config.h" -#include "system.h" +#include "rust-system.h" #include "coretypes.h" -#include <string> - namespace Rust { /** * Parse a `key` or `key="value"` pair given to the `-frust-cfg` compiler diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index 48c39de..e352836 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -11923,8 +11923,7 @@ Parser<ManagedTokenSource>::parse_path_based_stmt_or_expr ( std::unique_ptr<AST::MacroInvocation> stmt ( new AST::MacroInvocation (std::move (invoc_data), std::move (outer_attrs), - stmt_or_expr_loc), - true); + stmt_or_expr_loc, true)); return ExprOrStmt (std::move (stmt)); } @@ -11932,8 +11931,7 @@ Parser<ManagedTokenSource>::parse_path_based_stmt_or_expr ( std::unique_ptr<AST::MacroInvocation> expr ( new AST::MacroInvocation (std::move (invoc_data), std::move (outer_attrs), - stmt_or_expr_loc), - false); + stmt_or_expr_loc, false)); return ExprOrStmt (std::move (expr)); } else @@ -12244,8 +12242,8 @@ Parser<ManagedTokenSource>::parse_macro_invocation_maybe_semi ( std::unique_ptr<AST::MacroInvocation> stmt ( new AST::MacroInvocation (std::move (invoc_data), - std::move (outer_attrs), macro_locus), - true); + std::move (outer_attrs), macro_locus, + true)); return ExprOrStmt (std::move (stmt)); } diff --git a/gcc/rust/parse/rust-parse.h b/gcc/rust/parse/rust-parse.h index 945bce7..fcfcf18 100644 --- a/gcc/rust/parse/rust-parse.h +++ b/gcc/rust/parse/rust-parse.h @@ -40,6 +40,11 @@ struct ExprOrStmt // statement constructor ExprOrStmt (std::unique_ptr<AST::Stmt> stmt) : stmt (std::move (stmt)) {} + // macro constructor + ExprOrStmt (std::unique_ptr<AST::MacroInvocation> macro) + : expr (std::move (macro)) + {} + // Returns whether this object is in an error state. bool is_error () const { diff --git a/gcc/rust/rust-buffered-queue.h b/gcc/rust/rust-buffered-queue.h index 83b4f04..39f3506 100644 --- a/gcc/rust/rust-buffered-queue.h +++ b/gcc/rust/rust-buffered-queue.h @@ -19,9 +19,6 @@ #ifndef RUST_BUFFERED_QUEUE_H #define RUST_BUFFERED_QUEUE_H -#include <vector> -#include <utility> - #include "rust-system.h" namespace Rust { diff --git a/gcc/rust/rust-session-manager.h b/gcc/rust/rust-session-manager.h index c5420db..8fcc5dd 100644 --- a/gcc/rust/rust-session-manager.h +++ b/gcc/rust/rust-session-manager.h @@ -24,7 +24,7 @@ #include "rust-backend.h" #include "config.h" -#include "system.h" +#include "rust-system.h" #include "coretypes.h" #include "options.h" diff --git a/gcc/rust/rust-system.h b/gcc/rust/rust-system.h index 063e5d0..3a60023 100644 --- a/gcc/rust/rust-system.h +++ b/gcc/rust/rust-system.h @@ -41,6 +41,8 @@ #include <deque> #include <functional> #include <memory> +#include <utility> +#include <fstream> // Rust frontend requires C++11 minimum, so will have unordered_map and set #include <unordered_map> diff --git a/gcc/rust/typecheck/rust-hir-type-check-util.h b/gcc/rust/typecheck/rust-hir-type-check-util.h index 9cd5e3b..1a4b17a 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-util.h +++ b/gcc/rust/typecheck/rust-hir-type-check-util.h @@ -19,7 +19,7 @@ #ifndef RUST_HIR_TYPE_CHECK_UTIL_H #define RUST_HIR_TYPE_CHECK_UTIL_H -#include <functional> +#include "rust-system.h" #include "rust-hir-visitor.h" namespace Rust { diff --git a/gcc/rust/typecheck/rust-tycheck-dump.h b/gcc/rust/typecheck/rust-tycheck-dump.h index 53daa42..70f0b11 100644 --- a/gcc/rust/typecheck/rust-tycheck-dump.h +++ b/gcc/rust/typecheck/rust-tycheck-dump.h @@ -22,9 +22,6 @@ #include "rust-hir-type-check-base.h" #include "rust-hir-full.h" -#include <fstream> -#include <sstream> - namespace Rust { namespace Resolver { diff --git a/gcc/rust/util/fnv-hash.h b/gcc/rust/util/fnv-hash.h index 18d7301..78e54c9 100644 --- a/gcc/rust/util/fnv-hash.h +++ b/gcc/rust/util/fnv-hash.h @@ -19,9 +19,6 @@ #ifndef RUST_FNV_HASH_H #define RUST_FNV_HASH_H -#include <cstdint> -#include <cstddef> - namespace Rust { namespace Hash { diff --git a/gcc/rust/util/rust-abi.h b/gcc/rust/util/rust-abi.h index 04224ee..2bd5ff0 100644 --- a/gcc/rust/util/rust-abi.h +++ b/gcc/rust/util/rust-abi.h @@ -17,7 +17,7 @@ #ifndef RUST_ABI_OPTIONS_H #define RUST_ABI_OPTIONS_H -#include <string> +#include "rust-system.h" namespace Rust { diff --git a/gcc/rust/util/rust-base62.cc b/gcc/rust/util/rust-base62.cc index ee82dce..bdab233 100644 --- a/gcc/rust/util/rust-base62.cc +++ b/gcc/rust/util/rust-base62.cc @@ -18,8 +18,6 @@ #include "rust-base62.h" -#include <algorithm> - namespace Rust { std::string diff --git a/gcc/rust/util/rust-base62.h b/gcc/rust/util/rust-base62.h index 5b88de8..fa610d3 100644 --- a/gcc/rust/util/rust-base62.h +++ b/gcc/rust/util/rust-base62.h @@ -19,7 +19,7 @@ #ifndef RUST_BASE62_H #define RUST_BASE62_H -#include <string> +#include "rust-system.h" namespace Rust { diff --git a/gcc/rust/util/rust-inline-visitor.h b/gcc/rust/util/rust-inline-visitor.h index 18920d9..105a67b 100644 --- a/gcc/rust/util/rust-inline-visitor.h +++ b/gcc/rust/util/rust-inline-visitor.h @@ -22,9 +22,6 @@ #ifndef RUST_INLINE_VISITOR #define RUST_INLINE_VISITOR -#include <utility> -#include <type_traits> - namespace Rust { // Wrapper for the target Visitor we're matching against. diff --git a/gcc/rust/util/rust-make-unique.h b/gcc/rust/util/rust-make-unique.h index 4698b7d..5f098d2 100644 --- a/gcc/rust/util/rust-make-unique.h +++ b/gcc/rust/util/rust-make-unique.h @@ -1,8 +1,6 @@ #ifndef RUST_MAKE_UNIQUE_H #define RUST_MAKE_UNIQUE_H -#include <memory> - namespace Rust { template <typename T, typename... Ts> |