Realm
A distributed, event-based tasking library
Loading...
Searching...
No Matches
bootstrap_util.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 NVIDIA Corporation
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef BOOTSTRAP_UTIL_H
19#define BOOTSTRAP_UTIL_H
20
21#include <stdio.h>
22
23#define BOOTSTRAP_ERROR_PRINT(...) \
24 do { \
25 fprintf(stderr, "%s:%s:%d: ", __FILE__, __FUNCTION__, __LINE__); \
26 fprintf(stderr, __VA_ARGS__); \
27 } while(0)
28
29#define BOOTSTRAP_NE_ERROR_JMP(status, expected, err, label, ...) \
30 do { \
31 if(status != expected) { \
32 fprintf(stderr, "%s:%d: non-zero status: %d ", __FILE__, __LINE__, status); \
33 fprintf(stderr, __VA_ARGS__); \
34 status = err; \
35 goto label; \
36 } \
37 } while(0)
38
39#define BOOTSTRAP_NZ_ERROR_JMP(status, err, label, ...) \
40 do { \
41 if(status != 0) { \
42 fprintf(stderr, "%s:%d: non-zero status: %d ", __FILE__, __LINE__, status); \
43 fprintf(stderr, __VA_ARGS__); \
44 status = err; \
45 goto label; \
46 } \
47 } while(0)
48
49#define BOOTSTRAP_NULL_ERROR_JMP(var, status, err, label, ...) \
50 do { \
51 if(var == NULL) { \
52 fprintf(stderr, "%s:%d: NULL value ", __FILE__, __LINE__); \
53 fprintf(stderr, __VA_ARGS__); \
54 status = err; \
55 goto label; \
56 } \
57 } while(0)
58
59#endif