[libcxx-commits] [PATCH] D117993: [libc++][RFC] Guard against libc++ macros in tests.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 30 09:41:02 PDT 2022


Mordante updated this revision to Diff 419185.
Mordante added a comment.
Herald added a project: All.

Updated the script. Most positives have been fixed upstream.
Some remain what to do with them should be discussed on Discord.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117993/new/

https://reviews.llvm.org/D117993

Files:
  libcxx/test/libcxx/lint/lint_libcpp_macros_in_tests.sh.cpp


Index: libcxx/test/libcxx/lint/lint_libcpp_macros_in_tests.sh.cpp
===================================================================
--- /dev/null
+++ libcxx/test/libcxx/lint/lint_libcpp_macros_in_tests.sh.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Tests in test/std should work with all Standard library implementations.
+// This test greps for the usage of some libc++ internal defines that have a
+// TEST macro that achieves the same in a portable fashion.
+//
+// Upon failure the found results are part of the test's failure output. This
+// makes finding the occurrences easy.
+
+// Some items are whitelisted
+// - _LIBCPP_VERSION is used to test whether we're testing against libc++
+// - The language.support directory uses internal macros by generated scripts
+// - The experimental directory is a testing ground
+
+RUN: not grep -R --exclude-dir language.support --exclude-dir experimental '#if.*[ (]_LIBCPP' %S/../../std |grep -v ':.*_LIBCPP_VERSION'|grep -v ':.*_LIBCPP[A-Z_]*_ABI_'


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117993.419185.patch
Type: text/x-patch
Size: 1358 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220330/51d3379c/attachment.bin>


More information about the libcxx-commits mailing list