codegen: fix bug on riscv when --ptrcomp was used
[ajla.git] / fileline.h
blobd801d824d8b6a1591ee0aa3129cd2592b1cafc8e
1 /*
2 * Copyright (C) 2024 Mikulas Patocka
4 * This file is part of Ajla.
6 * Ajla is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, either version 3 of the License, or (at your option) any later
9 * version.
11 * Ajla is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along with
16 * Ajla. If not, see <https://www.gnu.org/licenses/>.
19 #ifndef AJLA_FILELINE_H
20 #define AJLA_FILELINE_H
22 #ifdef DEBUG_TRACK_FILE_LINE
23 #define argument_position , const char attr_unused *position_arg
24 #define pass_position , position_arg
25 #define pass_file_line , file_line
26 typedef const char * position_t;
27 #define position_string(x) (x)
28 #define position_string_alloc(x) (x)
29 #define position_string_free(x) do { } while (0)
30 #define caller_file_line position_string(position_arg)
31 #define caller_file_line_x caller_file_line
32 #else
33 #define argument_position
34 #define pass_position
35 #define pass_file_line
36 typedef void * position_t;
37 const char *position_string(void *);
38 const char *position_string_alloc(void *);
39 #define position_string_free(x) mem_free(x)
40 #ifdef return_address
41 #define position_arg return_address
42 #define caller_file_line position_string(position_arg)
43 #else
44 #define position_arg NULL
45 #define caller_file_line file_line
46 #endif
47 #define caller_file_line_x file_line
48 #endif
50 #endif