[libc-commits] [libc] [libc] remove header guard for assert.h (PR #83334)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Wed Feb 28 13:09:59 PST 2024


https://github.com/nickdesaulniers updated https://github.com/llvm/llvm-project/pull/83334

>From ab655f99c16d07e38e4291f2f22aa5ae7eba9601 Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Wed, 28 Feb 2024 13:06:14 -0800
Subject: [PATCH 1/2] [libc] remove header guard for assert.h

It's meant to be included multiple times! Maybe use a NOLINT rule to suppress
clang-tidy's llvm-header-guard lint warning.
---
 libc/src/assert/assert.h | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/libc/src/assert/assert.h b/libc/src/assert/assert.h
index 0daf9c4e1e6166..21f6e67eb9625c 100644
--- a/libc/src/assert/assert.h
+++ b/libc/src/assert/assert.h
@@ -6,9 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_LIBC_SRC_ASSERT_ASSERT_H
-#define LLVM_LIBC_SRC_ASSERT_ASSERT_H
-
 #include "src/assert/__assert_fail.h"
 
 // There is no header guard here since assert is intended to be capable of being
@@ -25,5 +22,3 @@
        : LIBC_NAMESPACE::__assert_fail(#e, __FILE__, __LINE__,                 \
                                        __PRETTY_FUNCTION__))
 #endif // NDEBUG
-
-#endif // LLVM_LIBC_SRC_ASSERT_ASSERT_H

>From 8eab7547d92086e16c26bb2785f399d392589d59 Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Wed, 28 Feb 2024 13:09:48 -0800
Subject: [PATCH 2/2] add nolint

---
 libc/src/assert/assert.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libc/src/assert/assert.h b/libc/src/assert/assert.h
index 21f6e67eb9625c..d13a54ed4dab11 100644
--- a/libc/src/assert/assert.h
+++ b/libc/src/assert/assert.h
@@ -1,3 +1,4 @@
+// NOLINT(llvm-header-guard)
 //===-- Internal header for assert ------------------------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.



More information about the libc-commits mailing list