diff options
| author | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-06-08 16:58:53 +0800 |
|---|---|---|
| committer | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-06-08 16:58:53 +0800 |
| commit | 4e7c29d1588fadf19a98476b5adf5ce84ed8076d (patch) | |
| tree | 4aca189bb48e789d39baf0c5e6d568e6b41da51c /rcc-legacy/include/rcc/error.h | |
| parent | 06a63b80effa4793f6c51ba827829655d6caf149 (diff) | |
| download | rcc-project-4e7c29d1588fadf19a98476b5adf5ce84ed8076d.tar.gz rcc-project-4e7c29d1588fadf19a98476b5adf5ce84ed8076d.tar.xz | |
[legacy] Add IR, AST, and RISC-V target headers
Diffstat (limited to 'rcc-legacy/include/rcc/error.h')
| -rw-r--r-- | rcc-legacy/include/rcc/error.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/rcc-legacy/include/rcc/error.h b/rcc-legacy/include/rcc/error.h new file mode 100644 index 0000000..f831da0 --- /dev/null +++ b/rcc-legacy/include/rcc/error.h @@ -0,0 +1,34 @@ +/* Source code for RCC-Legacy. + Copyright (C) 2026 Richard Qin + +This file is part of RCC. + +RCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +RCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with RCC; see the file LICENSE. If not see +<http://www.gnu.org/licenses/>. */ + +#pragma once + +#include <string> + +namespace rcc { +[[noreturn]] inline void fatal(const std::string& msg) { + fprintf(stderr, "rcc: error: %s\n", msg.c_str()); + exit(1); +} + +[[noreturn]] inline void fatal(int line, const std::string& msg) { + fprintf(stderr, "rcc: error (line %d): %s\n", line, msg.c_str()); + exit(1); +} +} // namespace rcc
\ No newline at end of file |
