drgn/scripts/gen_pp_cat.py
Omar Sandoval c0d8709b45 Update copyright headers to Meta
Signed-off-by: Omar Sandoval <osandov@osandov.com>
2021-11-21 15:59:44 -08:00

29 lines
821 B
Python
Executable File

#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
# SPDX-License-Identifier: GPL-3.0-or-later
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("max", type=int)
args = parser.parse_args()
for i in range(2, args.max + 1):
print(
f"#define PP_CAT{str(i) if i > 2 else ''}("
+ ", ".join(f"_{j}" for j in range(i))
+ f") PP_CAT_I{i}("
+ ", ".join(f"_{j}" for j in range(i))
+ ")"
)
print("/** @cond */")
for i in range(2, args.max + 1):
print(
f"#define PP_CAT_I{i}("
+ ", ".join(f"_{j}" for j in range(i))
+ ") "
+ "##".join(f"_{j}" for j in range(i))
)
print("/** @endcond */")