xref: /aosp_15_r20/external/cronet/base/macros/is_empty.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2023 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef BASE_MACROS_IS_EMPTY_H_
6 #define BASE_MACROS_IS_EMPTY_H_
7 
8 // A macro that substitutes with 1 if called without arguments, otherwise 0.
9 #define BASE_IS_EMPTY(...) BASE_INTERNAL_IS_EMPTY_EXPANDED(__VA_ARGS__)
10 #define BASE_INTERNAL_IS_EMPTY_EXPANDED(...) \
11   BASE_INTERNAL_IS_EMPTY_INNER(_, ##__VA_ARGS__)
12 #define BASE_INTERNAL_IS_EMPTY_INNER(...) \
13   BASE_INTERNAL_IS_EMPTY_INNER_EXPANDED(__VA_ARGS__, 0, 1)
14 #define BASE_INTERNAL_IS_EMPTY_INNER_EXPANDED(e0, e1, is_empty, ...) is_empty
15 
16 #endif  // BASE_MACROS_IS_EMPTY_H_
17