P4C
The P4 Compiler
Loading...
Searching...
No Matches
null.h
1/*
2 * SPDX-FileCopyrightText: 2013 Barefoot Networks, Inc.
3 * Copyright 2013-present Barefoot Networks, Inc.
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8/* -*-C++-*- */
9
10#ifndef LIB_NULL_H_
11#define LIB_NULL_H_
12
13#include "exceptions.h" // for BUG macro
14
15// Typical C contortions to transform something into a string
16#define LIB_STRINGIFY(x) #x
17#define LIB_TOSTRING(x) LIB_STRINGIFY(x)
18
19#define CHECK_NULL(a) \
20 do { \
21 if ((a) == nullptr) BUG(__FILE__ ":" LIB_TOSTRING(__LINE__) ": Null " #a); \
22 } while (0)
23
24#endif /* LIB_NULL_H_ */