Skip to content

Commit 330793c

Browse files
[libc] fix clang-tidy llvm-header-guard warnings (llvm#82679)
Towards the goal of getting `ninja libc-lint` back to green, fix the numerous instances of: warning: header guard does not follow preferred style [llvm-header-guard] This is because many of our header guards start with `__LLVM` rather than `LLVM`. To filter just these warnings: $ ninja -k2000 libc-lint 2>&1 | grep llvm-header-guard To automatically apply fixits: $ find libc/src libc/include libc/test -name \*.h | \ xargs -n1 -I {} clang-tidy {} -p build/compile_commands.json \ -checks='-*,llvm-header-guard' --fix --quiet Some manual cleanup is still necessary as headers that were missing header guards outright will have them inserted before the license block (we prefer them after).
1 parent d1f0444 commit 330793c

File tree

210 files changed

+661
-566
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+661
-566
lines changed

libc/include/__llvm-libc-common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef LLVM_LIBC___COMMON_H
10-
#define LLVM_LIBC___COMMON_H
9+
#ifndef LLVM_LIBC_COMMON_H
10+
#define LLVM_LIBC_COMMON_H
1111

1212
#ifdef __cplusplus
1313

@@ -51,4 +51,4 @@
5151

5252
#endif // __cplusplus
5353

54-
#endif // LLVM_LIBC___COMMON_H
54+
#endif // LLVM_LIBC_COMMON_H

libc/include/llvm-libc-macros/containerof-macro.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef __LLVM_LIBC_MACROS_CONTAINEROF_MACRO_H
10-
#define __LLVM_LIBC_MACROS_CONTAINEROF_MACRO_H
9+
#ifndef LLVM_LIBC_MACROS_CONTAINEROF_MACRO_H
10+
#define LLVM_LIBC_MACROS_CONTAINEROF_MACRO_H
1111

1212
#include <llvm-libc-macros/offsetof-macro.h>
1313

@@ -17,4 +17,4 @@
1717
(type *)(void *)((const char *)__ptr - offsetof(type, member)); \
1818
})
1919

20-
#endif // __LLVM_LIBC_MACROS_CONTAINEROF_MACRO_H
20+
#endif // LLVM_LIBC_MACROS_CONTAINEROF_MACRO_H
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#ifndef __LLVM_LIBC_MACROS_FCNTL_MACROS_H
2-
#define __LLVM_LIBC_MACROS_FCNTL_MACROS_H
1+
#ifndef LLVM_LIBC_MACROS_FCNTL_MACROS_H
2+
#define LLVM_LIBC_MACROS_FCNTL_MACROS_H
33

44
#ifdef __linux__
55
#include "linux/fcntl-macros.h"
66
#endif
77

8-
#endif // __LLVM_LIBC_MACROS_FCNTL_MACROS_H
8+
#endif // LLVM_LIBC_MACROS_FCNTL_MACROS_H

libc/include/llvm-libc-macros/features-macros.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef __LLVM_LIBC_MACROS_FEATURES_MACROS_H
10-
#define __LLVM_LIBC_MACROS_FEATURES_MACROS_H
9+
#ifndef LLVM_LIBC_MACROS_FEATURES_MACROS_H
10+
#define LLVM_LIBC_MACROS_FEATURES_MACROS_H
1111

1212
#define __LLVM_LIBC__ 1
1313

14-
#endif // __LLVM_LIBC_MACROS_FEATURES_MACROS_H
14+
#endif // LLVM_LIBC_MACROS_FEATURES_MACROS_H

libc/include/llvm-libc-macros/fenv-macros.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef __LLVM_LIBC_MACROS_FENV_MACROS_H
10-
#define __LLVM_LIBC_MACROS_FENV_MACROS_H
9+
#ifndef LLVM_LIBC_MACROS_FENV_MACROS_H
10+
#define LLVM_LIBC_MACROS_FENV_MACROS_H
1111

1212
#define FE_DIVBYZERO 1
1313
#define FE_INEXACT 2
@@ -24,4 +24,4 @@
2424

2525
#define FE_DFL_ENV ((fenv_t *)-1)
2626

27-
#endif // __LLVM_LIBC_MACROS_FENV_MACROS_H
27+
#endif // LLVM_LIBC_MACROS_FENV_MACROS_H

libc/include/llvm-libc-macros/file-seek-macros.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef __LLVM_LIBC_MACROS_FILE_SEEK_MACROS_H
10-
#define __LLVM_LIBC_MACROS_FILE_SEEK_MACROS_H
9+
#ifndef LLVM_LIBC_MACROS_FILE_SEEK_MACROS_H
10+
#define LLVM_LIBC_MACROS_FILE_SEEK_MACROS_H
1111

1212
#define SEEK_SET 0
1313
#define SEEK_CUR 1
1414
#define SEEK_END 2
1515

16-
#endif // __LLVM_LIBC_MACROS_FILE_SEEK_MACROS_H
16+
#endif // LLVM_LIBC_MACROS_FILE_SEEK_MACROS_H

libc/include/llvm-libc-macros/float-macros.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef __LLVM_LIBC_MACROS_FLOAT_MACROS_H
10-
#define __LLVM_LIBC_MACROS_FLOAT_MACROS_H
9+
#ifndef LLVM_LIBC_MACROS_FLOAT_MACROS_H
10+
#define LLVM_LIBC_MACROS_FLOAT_MACROS_H
1111

1212
// Suppress `#include_next is a language extension` warnings.
1313
#ifdef __clang__
@@ -169,4 +169,4 @@
169169

170170
// TODO: Add FLT16 and FLT128 constants.
171171

172-
#endif // __LLVM_LIBC_MACROS_FLOAT_MACROS_H
172+
#endif // LLVM_LIBC_MACROS_FLOAT_MACROS_H

libc/include/llvm-libc-macros/generic-error-number-macros.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef __LLVM_LIBC_MACROS_GENERIC_ERROR_NUMBER_MACROS_H
10-
#define __LLVM_LIBC_MACROS_GENERIC_ERROR_NUMBER_MACROS_H
9+
#ifndef LLVM_LIBC_MACROS_GENERIC_ERROR_NUMBER_MACROS_H
10+
#define LLVM_LIBC_MACROS_GENERIC_ERROR_NUMBER_MACROS_H
1111

1212
#define EPERM 1
1313
#define ENOENT 2
@@ -45,4 +45,4 @@
4545
#define ERANGE 34
4646
#define EILSEQ 35
4747

48-
#endif // __LLVM_LIBC_MACROS_GENERIC_ERROR_NUMBER_MACROS_H
48+
#endif // LLVM_LIBC_MACROS_GENERIC_ERROR_NUMBER_MACROS_H

libc/include/llvm-libc-macros/gpu/time-macros.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef __LLVM_LIBC_MACROS_GPU_TIME_MACROS_H
10-
#define __LLVM_LIBC_MACROS_GPU_TIME_MACROS_H
9+
#ifndef LLVM_LIBC_MACROS_GPU_TIME_MACROS_H
10+
#define LLVM_LIBC_MACROS_GPU_TIME_MACROS_H
1111

1212
#define CLOCKS_PER_SEC 1000000
1313

14-
#endif // __LLVM_LIBC_MACROS_GPU_TIME_MACROS_H
14+
#endif // LLVM_LIBC_MACROS_GPU_TIME_MACROS_H

libc/include/llvm-libc-macros/inttypes-macros.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
8-
#ifndef __LLVM_LIBC_MACROS_INTTYPES_MACROS_H
9-
#define __LLVM_LIBC_MACROS_INTTYPES_MACROS_H
8+
#ifndef LLVM_LIBC_MACROS_INTTYPES_MACROS_H
9+
#define LLVM_LIBC_MACROS_INTTYPES_MACROS_H
1010

1111
// fprintf/scanf format macros.
1212
// POSIX.1-2008, Technical Corrigendum 1, XBD/TC1-2008/0050 [211] is applied.
@@ -286,4 +286,4 @@
286286
#define SCNxMAX __UINTMAX_FMTx__
287287
#define SCNxPTR __UINTPTR_FMTx__
288288

289-
#endif // __LLVM_LIBC_MACROS_INTTYPES_MACROS_H
289+
#endif // LLVM_LIBC_MACROS_INTTYPES_MACROS_H

0 commit comments

Comments
 (0)