libpulsar
A modular compiler for the pulsar programming language
Loading...
Searching...
No Matches
abort.c
Go to the documentation of this file.
1// Copyright (C) 2023 Ethan Uppal. All rights reserved.
2
3#include <stdlib.h> // exit
4#include <stdio.h> // fprintf, stderr
5#include "abort.h" // STR
6
7void _ps_abort(STR msg, int code, STR filename, STR function, int line) {
8 int ret = fprintf(stderr, "ps_abort(exit=%d): %s:%d:%s: %s\n", code,
9 filename, line, function, msg);
10 if (ret < 0) {
11 perror("_ps_abort: fprintf");
12 }
13 exit(code);
14}
void _ps_abort(STR msg, int code, STR filename, STR function, int line)
Aborts the program with the given message.
Definition abort.c:7
Defines assertion and abortion functionality.
#define STR
Definition def.h:40