40 lines · python
1# ===----------------------------------------------------------------------===##2#3# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4# See https://llvm.org/LICENSE.txt for license information.5# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6#7# ===----------------------------------------------------------------------===##8 9# Ensure that none of the standard C++ headers implicitly include cassert or10# assert.h (because assert() is implemented as a macro).11 12# RUN: %{python} %s %{libcxx-dir}/utils13 14import sys15 16sys.path.append(sys.argv[1])17from libcxx.header_information import (18 lit_header_restrictions,19 lit_header_undeprecations,20 public_headers,21)22 23for header in public_headers:24 if header == "cassert":25 continue26 27 print(28 f"""\29//--- {header}.compile.pass.cpp30{lit_header_restrictions.get(header, '')}31{lit_header_undeprecations.get(header, '')}32 33#include <{header}>34 35#ifdef assert36# error "Do not include cassert or assert.h in standard header files"37#endif38"""39 )40