Skip to content

Commit 1a3f38a

Browse files
committed
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.
1 parent 6845803 commit 1a3f38a

23 files changed

+22
-47
lines changed

gcc/rust/ast/rust-path.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323

2424
#include "rust-ast.h"
2525

26-
#include <string>
27-
#include <vector>
28-
2926
namespace Rust {
3027
namespace AST {
3128

gcc/rust/backend/rust-mangle.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "rust-mangle.h"
22
#include "fnv-hash.h"
33
#include "rust-base62.h"
4-
#include <algorithm>
54

65
// FIXME: Rename those to legacy_*
76
static const std::string kMangledSymbolPrefix = "_ZN";

gcc/rust/expand/rust-macro-builtins.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@
5959
* of the `Mappings` class.
6060
*/
6161

62+
/* If assert is defined as a macro this file will not parse, so undefine this
63+
before continuing. */
64+
#ifdef assert
65+
#undef assert
66+
#endif
67+
6268
namespace Rust {
6369
class MacroBuiltin
6470
{

gcc/rust/hir/tree/rust-hir-path.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121

2222
#include "rust-hir.h"
2323

24-
#include <string>
25-
#include <vector>
26-
2724
namespace Rust {
2825
namespace HIR {
2926

gcc/rust/lex/rust-lex.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#include "rust-linemap.h"
2424
#include "safe-ctype.h"
2525

26-
#include <sstream> // for ostringstream
27-
2826
namespace Rust {
2927
// TODO: move to separate compilation unit?
3028
// overload += for uint32_t to allow 32-bit encoded utf-8 to be added

gcc/rust/lex/rust-lex.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
#include "rust-buffered-queue.h"
2424
#include "rust-token.h"
2525

26-
#include <cstdio>
27-
#include <utility>
28-
#include <tuple>
29-
3026
namespace Rust {
3127
// Simple wrapper for FILE* that simplifies destruction.
3228
struct RAIIFile

gcc/rust/lex/rust-token.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
#ifndef RUST_TOKEN_H
2020
#define RUST_TOKEN_H
2121

22-
#include <string>
23-
#include <memory>
24-
2522
#include "rust-linemap.h"
2623
#include "rust-codepoint.h"
2724

gcc/rust/lint/rust-lint-marklive.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#ifndef RUST_HIR_LIVENESS
2020
#define RUST_HIR_LIVENESS
2121

22-
#include <set>
2322
#include "rust-hir-full-decls.h"
2423
#include "rust-hir-map.h"
2524
#include "rust-lint-marklive-base.h"

gcc/rust/lint/rust-lint-scan-deadcode.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#ifndef RUST_HIR_SCAN_DEADCODE
2020
#define RUST_HIR_SCAN_DEADCODE
2121

22-
#include <set>
2322
#include "rust-hir-full-decls.h"
2423
#include "rust-hir-map.h"
2524
#include "rust-lint-marklive.h"

gcc/rust/parse/rust-cfg-parser.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@ along with GCC; see the file COPYING3. If not see
1818
#define RUST_CFG_PARSER_H
1919

2020
#include "config.h"
21-
#include "system.h"
21+
#include "rust-system.h"
2222
#include "coretypes.h"
2323

24-
#include <string>
25-
2624
namespace Rust {
2725
/**
2826
* Parse a `key` or `key="value"` pair given to the `-frust-cfg` compiler

0 commit comments

Comments
 (0)