]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/rust/ast/rust-macro.cc
Update copyright years.
[thirdparty/gcc.git] / gcc / rust / ast / rust-macro.cc
1 // Copyright (C) 2020-2024 Free Software Foundation, Inc.
2
3 // This file is part of GCC.
4
5 // GCC is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU General Public License as published by the Free
7 // Software Foundation; either version 3, or (at your option) any later
8 // version.
9
10 // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 // for more details.
14
15 // You should have received a copy of the GNU General Public License
16 // along with GCC; see the file COPYING3. If not see
17 // <http://www.gnu.org/licenses/>.
18
19 #include "rust-macro.h"
20
21 namespace Rust {
22 namespace AST {
23
24 BuiltinMacro
25 builtin_macro_from_string (const std::string &identifier)
26 {
27 if (identifier == "assert")
28 return BuiltinMacro::Assert;
29
30 if (identifier == "file")
31 return BuiltinMacro::File;
32
33 if (identifier == "line")
34 return BuiltinMacro::Line;
35
36 if (identifier == "column")
37 return BuiltinMacro::Column;
38
39 if (identifier == "include_bytes")
40 return BuiltinMacro::IncludeBytes;
41
42 if (identifier == "include_str")
43 return BuiltinMacro::IncludeStr;
44
45 if (identifier == "compile_error")
46 return BuiltinMacro::CompileError;
47
48 if (identifier == "concat")
49 return BuiltinMacro::Concat;
50
51 if (identifier == "env")
52 return BuiltinMacro::Env;
53
54 if (identifier == "cfg")
55 return BuiltinMacro::Cfg;
56
57 if (identifier == "include")
58 return BuiltinMacro::Include;
59
60 gcc_unreachable ();
61 }
62
63 } // namespace AST
64 } // namespace Rust