From 477c555476244cff4809e79ae204a6fe90b07033 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Wed, 26 Oct 2016 10:48:14 +0800 Subject: Expand - Add a stubbed impl of some rustc-internal macros --- Makefile | 1 + src/expand/rustc_diagnostics.cpp | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/expand/rustc_diagnostics.cpp diff --git a/Makefile b/Makefile index 33733f64..52216f24 100644 --- a/Makefile +++ b/Makefile @@ -69,6 +69,7 @@ OBJ += expand/concat.o expand/stringify.o expand/file_line.o OBJ += expand/derive.o expand/lang_item.o OBJ += expand/std_prelude.o expand/crate_tags.o OBJ += expand/include.o +OBJ += expand/rustc_diagnostics.o OBJ += macro_rules/mod.o macro_rules/eval.o macro_rules/parse.o OBJ += resolve/use.o resolve/index.o resolve/absolute.o OBJ += hir/from_ast.o hir/from_ast_expr.o diff --git a/src/expand/rustc_diagnostics.cpp b/src/expand/rustc_diagnostics.cpp new file mode 100644 index 00000000..e9990a93 --- /dev/null +++ b/src/expand/rustc_diagnostics.cpp @@ -0,0 +1,30 @@ +/* + * MRustC - Rust Compiler + * - By John Hodge (Mutabah/thePowersGang) + * + * expand/rustc_diagnostics.cpp + * - Stubbed handling for __register_diagnostic and __diagnostic_used + */ +#include +#include // TokenTree etc + +class CExpanderRegisterDiagnostic: + public ExpandProcMacro +{ + ::std::unique_ptr expand(const Span& sp, const AST::Crate& crate, const ::std::string& ident, const TokenTree& tt, AST::Module& mod) override + { + return box$( TTStreamO(TokenTree()) ); + } +}; +class CExpanderDiagnosticUsed: + public ExpandProcMacro +{ + ::std::unique_ptr expand(const Span& sp, const AST::Crate& crate, const ::std::string& ident, const TokenTree& tt, AST::Module& mod) override + { + return box$( TTStreamO(TokenTree()) ); + } +}; + +STATIC_MACRO("__register_diagnostic", CExpanderRegisterDiagnostic) +STATIC_MACRO("__diagnostic_used", CExpanderDiagnosticUsed) + -- cgit v1.2.3