Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc] fix clang-tidy llvm-header-guard warnings #82679

Merged
merged 1 commit into from
Feb 28, 2024

Conversation

nickdesaulniers
Copy link
Member

@nickdesaulniers nickdesaulniers commented Feb 22, 2024

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).

@llvmbot
Copy link

llvmbot commented Feb 22, 2024

@llvm/pr-subscribers-backend-amdgpu

@llvm/pr-subscribers-libc

Author: Nick Desaulniers (nickdesaulniers)

Changes

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.

This was done in mass via:

$ find libc -name \*.h | xargs perl -pi -e 's/__LLVM_LIBC/LLVM_LIBC/g'

Then manually fixing up some changes to:

  • libc/include/llvm-libc-macros/features-macros.h
  • libc/include/llvm-libc-types/double_t.h
  • libc/include/llvm-libc-types/float_t.h

Patch is 100.26 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/82679.diff

143 Files Affected:

  • (modified) libc/include/llvm-libc-macros/containerof-macro.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/fcntl-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/features-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/fenv-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/file-seek-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/float-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/generic-error-number-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/gpu/time-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/inttypes-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/limits-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/linux/fcntl-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/linux/sched-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/linux/signal-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/linux/sys-ioctl-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/linux/sys-random-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/linux/sys-socket-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/linux/sys-stat-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/linux/sys-time-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/linux/sys-wait-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/linux/termios-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/linux/time-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/linux/unistd-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/math-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/null-macro.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/offsetof-macro.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/sched-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/signal-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/stdbit-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/stdckdint-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/stdfix-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/stdio-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/stdlib-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/sys-auxv-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/sys-ioctl-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/sys-mman-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/sys-queue-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/sys-random-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/sys-resource-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/sys-select-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/sys-socket-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/sys-stat-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/sys-time-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/sys-wait-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/termios-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/time-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/unistd-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-macros/wchar-macros.h (+3-3)
  • (modified) libc/include/llvm-libc-types/ACTION.h (+3-3)
  • (modified) libc/include/llvm-libc-types/DIR.h (+3-3)
  • (modified) libc/include/llvm-libc-types/ENTRY.h (+3-3)
  • (modified) libc/include/llvm-libc-types/FILE.h (+3-3)
  • (modified) libc/include/llvm-libc-types/__atexithandler_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/__atfork_callback_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/__bsearchcompare_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/__call_once_func_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/__exec_argv_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/__exec_envp_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/__futex_word.h (+3-3)
  • (modified) libc/include/llvm-libc-types/__getoptargv_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/__mutex_type.h (+3-3)
  • (modified) libc/include/llvm-libc-types/__pthread_once_func_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/__pthread_start_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/__pthread_tss_dtor_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/__qsortcompare_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/__qsortrcompare_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/__sighandler_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/__thread_type.h (+3-3)
  • (modified) libc/include/llvm-libc-types/blkcnt_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/blksize_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/cc_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/clock_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/clockid_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/cnd_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/cookie_io_functions_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/cpu_set_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/dev_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/div_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/double_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/fd_set.h (+3-3)
  • (modified) libc/include/llvm-libc-types/fenv_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/fexcept_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/float128.h (+3-3)
  • (modified) libc/include/llvm-libc-types/float_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/gid_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/imaxdiv_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/ino_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/jmp_buf.h (+3-3)
  • (modified) libc/include/llvm-libc-types/ldiv_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/lldiv_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/mode_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/mtx_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/nlink_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/off64_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/off_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/once_flag.h (+3-3)
  • (modified) libc/include/llvm-libc-types/pid_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/posix_spawn_file_actions_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/posix_spawnattr_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/pthread_attr_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/pthread_key_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/pthread_mutex_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/pthread_mutexattr_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/pthread_once_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/pthread_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/rlim_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/rpc_opcodes_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/sa_family_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/sig_atomic_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/siginfo_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/sigset_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/size_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/socklen_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/speed_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/ssize_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/stack_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/struct_dirent.h (+3-3)
  • (modified) libc/include/llvm-libc-types/struct_epoll_data.h (+3-3)
  • (modified) libc/include/llvm-libc-types/struct_epoll_event.h (+3-3)
  • (modified) libc/include/llvm-libc-types/struct_hsearch_data.h (+3-3)
  • (modified) libc/include/llvm-libc-types/struct_rlimit.h (+3-3)
  • (modified) libc/include/llvm-libc-types/struct_rusage.h (+3-3)
  • (modified) libc/include/llvm-libc-types/struct_sched_param.h (+3-3)
  • (modified) libc/include/llvm-libc-types/struct_sigaction.h (+3-3)
  • (modified) libc/include/llvm-libc-types/struct_sockaddr.h (+3-3)
  • (modified) libc/include/llvm-libc-types/struct_sockaddr_un.h (+3-3)
  • (modified) libc/include/llvm-libc-types/struct_stat.h (+3-3)
  • (modified) libc/include/llvm-libc-types/struct_termios.h (+3-3)
  • (modified) libc/include/llvm-libc-types/struct_timespec.h (+3-3)
  • (modified) libc/include/llvm-libc-types/struct_timeval.h (+3-3)
  • (modified) libc/include/llvm-libc-types/struct_tm.h (+3-3)
  • (modified) libc/include/llvm-libc-types/struct_utsname.h (+3-3)
  • (modified) libc/include/llvm-libc-types/suseconds_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/tcflag_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/test_rpc_opcodes_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/thrd_start_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/thrd_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/time_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/tss_dtor_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/tss_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/uid_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/union_sigval.h (+3-3)
  • (modified) libc/include/llvm-libc-types/wchar_t.h (+3-3)
  • (modified) libc/include/llvm-libc-types/wint_t.h (+3-3)
diff --git a/libc/include/llvm-libc-macros/containerof-macro.h b/libc/include/llvm-libc-macros/containerof-macro.h
index ea91fa7097a4f2..62724abd3b0f11 100644
--- a/libc/include/llvm-libc-macros/containerof-macro.h
+++ b/libc/include/llvm-libc-macros/containerof-macro.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_CONTAINEROF_MACRO_H
-#define __LLVM_LIBC_MACROS_CONTAINEROF_MACRO_H
+#ifndef LLVM_LIBC_MACROS_CONTAINEROF_MACRO_H
+#define LLVM_LIBC_MACROS_CONTAINEROF_MACRO_H
 
 #include <llvm-libc-macros/offsetof-macro.h>
 
@@ -17,4 +17,4 @@
     (type *)(void *)((const char *)__ptr - offsetof(type, member));            \
   })
 
-#endif // __LLVM_LIBC_MACROS_CONTAINEROF_MACRO_H
+#endif // LLVM_LIBC_MACROS_CONTAINEROF_MACRO_H
diff --git a/libc/include/llvm-libc-macros/fcntl-macros.h b/libc/include/llvm-libc-macros/fcntl-macros.h
index 448dcc0a813536..4bd03a7e3e2b29 100644
--- a/libc/include/llvm-libc-macros/fcntl-macros.h
+++ b/libc/include/llvm-libc-macros/fcntl-macros.h
@@ -1,8 +1,8 @@
-#ifndef __LLVM_LIBC_MACROS_FCNTL_MACROS_H
-#define __LLVM_LIBC_MACROS_FCNTL_MACROS_H
+#ifndef LLVM_LIBC_MACROS_FCNTL_MACROS_H
+#define LLVM_LIBC_MACROS_FCNTL_MACROS_H
 
 #ifdef __linux__
 #include "linux/fcntl-macros.h"
 #endif
 
-#endif // __LLVM_LIBC_MACROS_FCNTL_MACROS_H
+#endif // LLVM_LIBC_MACROS_FCNTL_MACROS_H
diff --git a/libc/include/llvm-libc-macros/features-macros.h b/libc/include/llvm-libc-macros/features-macros.h
index 2938b3ccb95b29..5bc87a68fc0ba8 100644
--- a/libc/include/llvm-libc-macros/features-macros.h
+++ b/libc/include/llvm-libc-macros/features-macros.h
@@ -6,9 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_FEATURES_MACROS_H
-#define __LLVM_LIBC_MACROS_FEATURES_MACROS_H
+#ifndef LLVM_LIBC_MACROS_FEATURES_MACROS_H
+#define LLVM_LIBC_MACROS_FEATURES_MACROS_H
 
 #define __LLVM_LIBC__ 1
 
-#endif // __LLVM_LIBC_MACROS_FEATURES_MACROS_H
+#endif // LLVM_LIBC_MACROS_FEATURES_MACROS_H
diff --git a/libc/include/llvm-libc-macros/fenv-macros.h b/libc/include/llvm-libc-macros/fenv-macros.h
index cc0ea344b1702b..72ac660cd98cba 100644
--- a/libc/include/llvm-libc-macros/fenv-macros.h
+++ b/libc/include/llvm-libc-macros/fenv-macros.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_FENV_MACROS_H
-#define __LLVM_LIBC_MACROS_FENV_MACROS_H
+#ifndef LLVM_LIBC_MACROS_FENV_MACROS_H
+#define LLVM_LIBC_MACROS_FENV_MACROS_H
 
 #define FE_DIVBYZERO 1
 #define FE_INEXACT 2
@@ -24,4 +24,4 @@
 
 #define FE_DFL_ENV ((fenv_t *)-1)
 
-#endif // __LLVM_LIBC_MACROS_FENV_MACROS_H
+#endif // LLVM_LIBC_MACROS_FENV_MACROS_H
diff --git a/libc/include/llvm-libc-macros/file-seek-macros.h b/libc/include/llvm-libc-macros/file-seek-macros.h
index 04f397982f460d..676cb7511407ff 100644
--- a/libc/include/llvm-libc-macros/file-seek-macros.h
+++ b/libc/include/llvm-libc-macros/file-seek-macros.h
@@ -6,11 +6,11 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_FILE_SEEK_MACROS_H
-#define __LLVM_LIBC_MACROS_FILE_SEEK_MACROS_H
+#ifndef LLVM_LIBC_MACROS_FILE_SEEK_MACROS_H
+#define LLVM_LIBC_MACROS_FILE_SEEK_MACROS_H
 
 #define SEEK_SET 0
 #define SEEK_CUR 1
 #define SEEK_END 2
 
-#endif // __LLVM_LIBC_MACROS_FILE_SEEK_MACROS_H
+#endif // LLVM_LIBC_MACROS_FILE_SEEK_MACROS_H
diff --git a/libc/include/llvm-libc-macros/float-macros.h b/libc/include/llvm-libc-macros/float-macros.h
index 86ec4939393086..a51eab0c7ed2f3 100644
--- a/libc/include/llvm-libc-macros/float-macros.h
+++ b/libc/include/llvm-libc-macros/float-macros.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_FLOAT_MACROS_H
-#define __LLVM_LIBC_MACROS_FLOAT_MACROS_H
+#ifndef LLVM_LIBC_MACROS_FLOAT_MACROS_H
+#define LLVM_LIBC_MACROS_FLOAT_MACROS_H
 
 // Suppress `#include_next is a language extension` warnings.
 #ifdef __clang__
@@ -169,4 +169,4 @@
 
 // TODO: Add FLT16 and FLT128 constants.
 
-#endif // __LLVM_LIBC_MACROS_FLOAT_MACROS_H
+#endif // LLVM_LIBC_MACROS_FLOAT_MACROS_H
diff --git a/libc/include/llvm-libc-macros/generic-error-number-macros.h b/libc/include/llvm-libc-macros/generic-error-number-macros.h
index 3805c95cbb2a5c..7ee0352669b8a9 100644
--- a/libc/include/llvm-libc-macros/generic-error-number-macros.h
+++ b/libc/include/llvm-libc-macros/generic-error-number-macros.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_GENERIC_ERROR_NUMBER_MACROS_H
-#define __LLVM_LIBC_MACROS_GENERIC_ERROR_NUMBER_MACROS_H
+#ifndef LLVM_LIBC_MACROS_GENERIC_ERROR_NUMBER_MACROS_H
+#define LLVM_LIBC_MACROS_GENERIC_ERROR_NUMBER_MACROS_H
 
 #define EPERM 1
 #define ENOENT 2
@@ -45,4 +45,4 @@
 #define ERANGE 34
 #define EILSEQ 35
 
-#endif // __LLVM_LIBC_MACROS_GENERIC_ERROR_NUMBER_MACROS_H
+#endif // LLVM_LIBC_MACROS_GENERIC_ERROR_NUMBER_MACROS_H
diff --git a/libc/include/llvm-libc-macros/gpu/time-macros.h b/libc/include/llvm-libc-macros/gpu/time-macros.h
index baf2ea5f41324f..c3dc812f90a3be 100644
--- a/libc/include/llvm-libc-macros/gpu/time-macros.h
+++ b/libc/include/llvm-libc-macros/gpu/time-macros.h
@@ -6,9 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_GPU_TIME_MACROS_H
-#define __LLVM_LIBC_MACROS_GPU_TIME_MACROS_H
+#ifndef LLVM_LIBC_MACROS_GPU_TIME_MACROS_H
+#define LLVM_LIBC_MACROS_GPU_TIME_MACROS_H
 
 #define CLOCKS_PER_SEC 1000000
 
-#endif // __LLVM_LIBC_MACROS_GPU_TIME_MACROS_H
+#endif // LLVM_LIBC_MACROS_GPU_TIME_MACROS_H
diff --git a/libc/include/llvm-libc-macros/inttypes-macros.h b/libc/include/llvm-libc-macros/inttypes-macros.h
index fc3e2517f19471..8e7d4f558a63b6 100644
--- a/libc/include/llvm-libc-macros/inttypes-macros.h
+++ b/libc/include/llvm-libc-macros/inttypes-macros.h
@@ -5,8 +5,8 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-#ifndef __LLVM_LIBC_MACROS_INTTYPES_MACROS_H
-#define __LLVM_LIBC_MACROS_INTTYPES_MACROS_H
+#ifndef LLVM_LIBC_MACROS_INTTYPES_MACROS_H
+#define LLVM_LIBC_MACROS_INTTYPES_MACROS_H
 
 // fprintf/scanf format macros.
 // POSIX.1-2008, Technical Corrigendum 1, XBD/TC1-2008/0050 [211] is applied.
@@ -286,4 +286,4 @@
 #define SCNxMAX __UINTMAX_FMTx__
 #define SCNxPTR __UINTPTR_FMTx__
 
-#endif // __LLVM_LIBC_MACROS_INTTYPES_MACROS_H
+#endif // LLVM_LIBC_MACROS_INTTYPES_MACROS_H
diff --git a/libc/include/llvm-libc-macros/limits-macros.h b/libc/include/llvm-libc-macros/limits-macros.h
index 3b4df58ae4a143..95f0f5f0baa58e 100644
--- a/libc/include/llvm-libc-macros/limits-macros.h
+++ b/libc/include/llvm-libc-macros/limits-macros.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_LIMITS_MACROS_H
-#define __LLVM_LIBC_MACROS_LIMITS_MACROS_H
+#ifndef LLVM_LIBC_MACROS_LIMITS_MACROS_H
+#define LLVM_LIBC_MACROS_LIMITS_MACROS_H
 
 // Define all C23 macro constants of limits.h
 
@@ -225,4 +225,4 @@
 #define ULLONG_MIN 0ULL
 #endif // ULLONG_MIN
 
-#endif // __LLVM_LIBC_MACROS_LIMITS_MACROS_H
+#endif // LLVM_LIBC_MACROS_LIMITS_MACROS_H
diff --git a/libc/include/llvm-libc-macros/linux/fcntl-macros.h b/libc/include/llvm-libc-macros/linux/fcntl-macros.h
index 495c5ec780edb0..1d4e5bbbdc770a 100644
--- a/libc/include/llvm-libc-macros/linux/fcntl-macros.h
+++ b/libc/include/llvm-libc-macros/linux/fcntl-macros.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_LINUX_FCNTL_MACROS_H
-#define __LLVM_LIBC_MACROS_LINUX_FCNTL_MACROS_H
+#ifndef LLVM_LIBC_MACROS_LINUX_FCNTL_MACROS_H
+#define LLVM_LIBC_MACROS_LINUX_FCNTL_MACROS_H
 
 // File creation flags
 #define O_CLOEXEC 02000000
@@ -68,4 +68,4 @@
 #define F_GETFL 3
 #define F_SETFL 4
 
-#endif // __LLVM_LIBC_MACROS_LINUX_FCNTL_MACROS_H
+#endif // LLVM_LIBC_MACROS_LINUX_FCNTL_MACROS_H
diff --git a/libc/include/llvm-libc-macros/linux/sched-macros.h b/libc/include/llvm-libc-macros/linux/sched-macros.h
index 0c574440ccbcf7..ace620049ca0c6 100644
--- a/libc/include/llvm-libc-macros/linux/sched-macros.h
+++ b/libc/include/llvm-libc-macros/linux/sched-macros.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_LINUX_SCHED_MACROS_H
-#define __LLVM_LIBC_MACROS_LINUX_SCHED_MACROS_H
+#ifndef LLVM_LIBC_MACROS_LINUX_SCHED_MACROS_H
+#define LLVM_LIBC_MACROS_LINUX_SCHED_MACROS_H
 
 // Definitions of SCHED_* macros must match was linux as at:
 // https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/sched.h
@@ -26,4 +26,4 @@
 #define CPU_COUNT_S(setsize, set) __sched_getcpucount(setsize, set)
 #define CPU_COUNT(set) CPU_COUNT_S(sizeof(cpu_set_t), set)
 
-#endif // __LLVM_LIBC_MACROS_LINUX_SCHED_MACROS_H
+#endif // LLVM_LIBC_MACROS_LINUX_SCHED_MACROS_H
diff --git a/libc/include/llvm-libc-macros/linux/signal-macros.h b/libc/include/llvm-libc-macros/linux/signal-macros.h
index deb190ec375998..083c06a91e0365 100644
--- a/libc/include/llvm-libc-macros/linux/signal-macros.h
+++ b/libc/include/llvm-libc-macros/linux/signal-macros.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_LINUX_SIGNUM_MACROS_H
-#define __LLVM_LIBC_MACROS_LINUX_SIGNUM_MACROS_H
+#ifndef LLVM_LIBC_MACROS_LINUX_SIGNUM_MACROS_H
+#define LLVM_LIBC_MACROS_LINUX_SIGNUM_MACROS_H
 
 #define SIGHUP 1
 #define SIGINT 2
@@ -101,4 +101,4 @@
 #define CLD_STOPPED 5   // child has stopped
 #define CLD_CONTINUED 6 // stopped child has continued
 
-#endif // __LLVM_LIBC_MACROS_LINUX_SIGNUM_MACROS_H
+#endif // LLVM_LIBC_MACROS_LINUX_SIGNUM_MACROS_H
diff --git a/libc/include/llvm-libc-macros/linux/sys-ioctl-macros.h b/libc/include/llvm-libc-macros/linux/sys-ioctl-macros.h
index 8f13a0ef4ad305..5eb779aeeca561 100644
--- a/libc/include/llvm-libc-macros/linux/sys-ioctl-macros.h
+++ b/libc/include/llvm-libc-macros/linux/sys-ioctl-macros.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_LINUX_SYS_IOCTL_MACROS_H
-#define __LLVM_LIBC_MACROS_LINUX_SYS_IOCTL_MACROS_H
+#ifndef LLVM_LIBC_MACROS_LINUX_SYS_IOCTL_MACROS_H
+#define LLVM_LIBC_MACROS_LINUX_SYS_IOCTL_MACROS_H
 
 // TODO (michaelrj): Finish defining these macros.
 // Just defining this macro for the moment since it's all that we need right
@@ -16,4 +16,4 @@
 // think is worth digging into right now.
 #define TIOCGETD 0x5424
 
-#endif // __LLVM_LIBC_MACROS_LINUX_SYS_IOCTL_MACROS_H
+#endif // LLVM_LIBC_MACROS_LINUX_SYS_IOCTL_MACROS_H
diff --git a/libc/include/llvm-libc-macros/linux/sys-random-macros.h b/libc/include/llvm-libc-macros/linux/sys-random-macros.h
index 1337f8b606fcf8..9261e87bdbf6f6 100644
--- a/libc/include/llvm-libc-macros/linux/sys-random-macros.h
+++ b/libc/include/llvm-libc-macros/linux/sys-random-macros.h
@@ -6,12 +6,12 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_LINUX_SYS_RANDOM_MACROS_H
-#define __LLVM_LIBC_MACROS_LINUX_SYS_RANDOM_MACROS_H
+#ifndef LLVM_LIBC_MACROS_LINUX_SYS_RANDOM_MACROS_H
+#define LLVM_LIBC_MACROS_LINUX_SYS_RANDOM_MACROS_H
 
 // Getrandom flags
 #define GRND_RANDOM 0x0001
 #define GRND_NONBLOCK 0x0002
 #define GRND_INSECURE 0x0004
 
-#endif // __LLVM_LIBC_MACROS_LINUX_SYS_RANDOM_MACROS_H
+#endif // LLVM_LIBC_MACROS_LINUX_SYS_RANDOM_MACROS_H
diff --git a/libc/include/llvm-libc-macros/linux/sys-socket-macros.h b/libc/include/llvm-libc-macros/linux/sys-socket-macros.h
index 7de410225b7126..f335200a103bb0 100644
--- a/libc/include/llvm-libc-macros/linux/sys-socket-macros.h
+++ b/libc/include/llvm-libc-macros/linux/sys-socket-macros.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_LINUX_SYS_SOCKET_MACROS_H
-#define __LLVM_LIBC_MACROS_LINUX_SYS_SOCKET_MACROS_H
+#ifndef LLVM_LIBC_MACROS_LINUX_SYS_SOCKET_MACROS_H
+#define LLVM_LIBC_MACROS_LINUX_SYS_SOCKET_MACROS_H
 
 // IEEE Std 1003.1-2017 - basedefs/sys_socket.h.html
 // Macro values come from the Linux syscall interface.
@@ -25,4 +25,4 @@
 #define SOCK_SEQPACKET 5
 #define SOCK_PACKET 10
 
-#endif // __LLVM_LIBC_MACROS_LINUX_SYS_SOCKET_MACROS_H
+#endif // LLVM_LIBC_MACROS_LINUX_SYS_SOCKET_MACROS_H
diff --git a/libc/include/llvm-libc-macros/linux/sys-stat-macros.h b/libc/include/llvm-libc-macros/linux/sys-stat-macros.h
index 48606cfa08ce93..3013121d0f3cb3 100644
--- a/libc/include/llvm-libc-macros/linux/sys-stat-macros.h
+++ b/libc/include/llvm-libc-macros/linux/sys-stat-macros.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_LINUX_SYS_STAT_MACROS_H
-#define __LLVM_LIBC_MACROS_LINUX_SYS_STAT_MACROS_H
+#ifndef LLVM_LIBC_MACROS_LINUX_SYS_STAT_MACROS_H
+#define LLVM_LIBC_MACROS_LINUX_SYS_STAT_MACROS_H
 
 // Definitions from linux/stat.h
 #define S_IFMT 0170000
@@ -45,4 +45,4 @@
 #define S_IWOTH 00002
 #define S_IXOTH 00001
 
-#endif // __LLVM_LIBC_MACROS_LINUX_SYS_STAT_MACROS_H
+#endif // LLVM_LIBC_MACROS_LINUX_SYS_STAT_MACROS_H
diff --git a/libc/include/llvm-libc-macros/linux/sys-time-macros.h b/libc/include/llvm-libc-macros/linux/sys-time-macros.h
index 06ae43f0e0054c..e97819594adcb1 100644
--- a/libc/include/llvm-libc-macros/linux/sys-time-macros.h
+++ b/libc/include/llvm-libc-macros/linux/sys-time-macros.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_LINUX_SYS_TIME_MACROS_H
-#define __LLVM_LIBC_MACROS_LINUX_SYS_TIME_MACROS_H
+#ifndef LLVM_LIBC_MACROS_LINUX_SYS_TIME_MACROS_H
+#define LLVM_LIBC_MACROS_LINUX_SYS_TIME_MACROS_H
 
 // Add two timevals and put the result in timeval_ptr_result. If the resulting
 // usec value is greater than 999,999 then the microseconds are turned into full
@@ -50,4 +50,4 @@
        ? ((timeval_ptr_a)->tv_usec CMP(timeval_ptr_b)->tv_usec)                \
        : ((timeval_ptr_a)->tv_sec CMP(timeval_ptr_b)->tv_sec))
 
-#endif // __LLVM_LIBC_MACROS_LINUX_SYS_TIME_MACROS_H
+#endif // LLVM_LIBC_MACROS_LINUX_SYS_TIME_MACROS_H
diff --git a/libc/include/llvm-libc-macros/linux/sys-wait-macros.h b/libc/include/llvm-libc-macros/linux/sys-wait-macros.h
index 3e6c6f53cc7171..c101638fdae340 100644
--- a/libc/include/llvm-libc-macros/linux/sys-wait-macros.h
+++ b/libc/include/llvm-libc-macros/linux/sys-wait-macros.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_LINUX_SYS_WAIT_MACROS_H
-#define __LLVM_LIBC_MACROS_LINUX_SYS_WAIT_MACROS_H
+#ifndef LLVM_LIBC_MACROS_LINUX_SYS_WAIT_MACROS_H
+#define LLVM_LIBC_MACROS_LINUX_SYS_WAIT_MACROS_H
 
 // Wait flags
 #define WNOHANG 1    // Do not block
@@ -41,4 +41,4 @@
 #define P_PGID 2
 #define P_PIDFD 3
 
-#endif // __LLVM_LIBC_MACROS_LINUX_SYS_WAIT_MACROS_H
+#endif // LLVM_LIBC_MACROS_LINUX_SYS_WAIT_MACROS_H
diff --git a/libc/include/llvm-libc-macros/linux/termios-macros.h b/libc/include/llvm-libc-macros/linux/termios-macros.h
index 17e380ebecffe3..668cfe27abaabf 100644
--- a/libc/include/llvm-libc-macros/linux/termios-macros.h
+++ b/libc/include/llvm-libc-macros/linux/termios-macros.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_LINUX_TERMIOS_MACROS_H
-#define __LLVM_LIBC_MACROS_LINUX_TERMIOS_MACROS_H
+#ifndef LLVM_LIBC_MACROS_LINUX_TERMIOS_MACROS_H
+#define LLVM_LIBC_MACROS_LINUX_TERMIOS_MACROS_H
 
 // Below are generic definitions of symbolic bit-masks, modes etc. They serve
 // most architectures including x86_64, aarch64 but have to be adjusted for few
@@ -164,4 +164,4 @@
 #define TCIOFF 2 // Suspend output
 #define TCION 3  // Restart output
 
-#endif // __LLVM_LIBC_MACROS_LINUX_TERMIOS_MACROS_H
+#endif // LLVM_LIBC_MACROS_LINUX_TERMIOS_MACROS_H
diff --git a/libc/include/llvm-libc-macros/linux/time-macros.h b/libc/include/llvm-libc-macros/linux/time-macros.h
index ace27cb2e9eb4b..407a1eb30eeaf7 100644
--- a/libc/include/llvm-libc-macros/linux/time-macros.h
+++ b/libc/include/llvm-libc-macros/linux/time-macros.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_LINUX_TIME_MACROS_H
-#define __LLVM_LIBC_MACROS_LINUX_TIME_MACROS_H
+#ifndef LLVM_LIBC_MACROS_LINUX_TIME_MACROS_H
+#define LLVM_LIBC_MACROS_LINUX_TIME_MACROS_H
 
 // clock type macros
 #define CLOCK_REALTIME 0
@@ -23,4 +23,4 @@
 
 #define CLOCKS_PER_SEC 1000000
 
-#endif //__LLVM_LIBC_MACROS_LINUX_TIME_MACROS_H
+#endif // LLVM_LIBC_MACROS_LINUX_TIME_MACROS_H
diff --git a/libc/include/llvm-libc-macros/linux/unistd-macros.h b/libc/include/llvm-libc-macros/linux/unistd-macros.h
index cfdfb9a93ee9b0..c5109df435e68d 100644
--- a/libc/include/llvm-libc-macros/linux/unistd-macros.h
+++ b/libc/include/llvm-libc-macros/linux/unistd-macros.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_LINUX_UNISTD_MACROS_H
-#define __LLVM_LIBC_MACROS_LINUX_UNISTD_MACROS_H
+#ifndef LLVM_LIBC_MACROS_LINUX_UNISTD_MACROS_H
+#define LLVM_LIBC_MACROS_LINUX_UNISTD_MACROS_H
 
 // Values for mode argument to the access(...) function.
 #define F_OK 0
@@ -27,4 +27,4 @@
                       (long)(arg4), (long)(arg5), (long)(arg6))
 #define syscall(...) __syscall_helper(__VA_ARGS__, 0, 1, 2, 3, 4, 5, 6)
 
-#endif // __LLVM_LIBC_MACROS_LINUX_UNISTD_MACROS_H
+#endif // LLVM_LIBC_MACROS_LINUX_UNISTD_MACROS_H
diff --git a/libc/include/llvm-libc-macros/math-macros.h b/libc/include/llvm-libc-macros/math-macros.h
index 136670e665e6b0..6b960a4b4d2085 100644
--- a/libc/include/llvm-libc-macros/math-macros.h
+++ b/libc/include/llvm-libc-macros/math-macros.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_MATH_MACROS_H
-#define __LLVM_LIBC_MACROS_MATH_MACROS_H
+#ifndef LLVM_LIBC_MACROS_MATH_MACROS_H
+#define LLVM_LIBC_MACROS_MATH_MACROS_H
 
 #define MATH_ERRNO 1
 #define MATH_ERREXCEPT 2
@@ -31,4 +31,4 @@
 #define math_errhandling (MATH_ERRNO | MATH_ERREXCEPT)
 #endif
 
-#endif // __LLVM_LIBC_MACROS_MATH_MACROS_H
+#endif // LLVM_LIBC_MACROS_MATH_MACROS_H
diff --git a/libc/include/llvm-libc-macros/null-macro.h b/libc/include/llvm-libc-macros/null-macro.h
index b83fc05c614dfb..416d4e865fc583 100644
--- a/libc/include/llvm-libc-macros/null-macro.h
+++ b/libc/include/llvm-libc-macros/null-macro.h
@@ -6,10 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_NULL_MACRO_H
-#define __LLVM_LIBC_MACROS_NULL_MACRO_H
+#ifndef LLVM_LIBC_MACROS_NULL_MACRO_H
+#define LLVM_LIBC_MACROS_NULL_MACRO_H
 
 #define __need_NULL
 #include <stddef.h>
 
-#endif // __LLVM_LIBC_MACROS_NULL_MACRO_H
+#endif // LLVM_LIBC_MACROS_NULL_MACRO_H
diff --git a/libc/include/llvm-libc-macros/offsetof-macro.h b/libc/include/llvm-libc-macros/offsetof-macro.h
index eeceb3db110b6b..208c06b29cb642 100644
--- a/libc/include/llvm-libc-macros/offsetof-macro.h
+++ b/libc/include/llvm-libc-macros/offsetof-macro.h
@@ -6,10 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_OFFSETOF_MACRO_H
-#define __LLVM_LIBC_MACROS_OFFSETOF_MACRO_H
+#ifndef LLVM_LIBC_MACROS_OFFSETOF_MACRO_H
+#define LLVM_LIBC_MACROS_OFFSETOF_MACRO_H
 
 #define __need_offsetof
 #include <stddef.h>
 
-#endif // __LLVM_LIBC_MACROS_OFFSETOF_MACRO_H
+#endif // LLVM_LIBC_MACROS_OFFSETOF_MACRO_H
diff --git a/libc/include/llvm-libc-macros/sched-macros.h b/libc/include/llvm-libc-macros/sched-macros.h
index 760edd9feb723d..0f643029816c1f 100644
--- a/libc/include/llvm-libc-macros/sched-macros.h
+++ b/libc/include/llvm-libc-macros/sched-macros.h
@@ -6,11 +6,11 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_MACROS_SCHED_MACROS_H
-#define __LLVM_LIBC_MACROS_SCHED_...
[truncated]

@frobtech
Copy link
Contributor

Is there a reason you used perl-as-sed rather than clang-tidy --fix? I think that would fully canonicalize things wrt the trailing underscores too.

@michaelrj-google
Copy link
Contributor

It seems like all of these are public headers in include. I think we had those extra underscores for macro namespacing purposes. I'm not sure if we actually want to remove those, it might be better to remove the check from the include folder.

@gchatelet
Copy link
Contributor

It seems like all of these are public headers in include. I think we had those extra underscores for macro namespacing purposes. I'm not sure if we actually want to remove those, it might be better to remove the check from the include folder.

Or modify the clang tidy so it handles the include folder in a special way?
TBH I would prefer to have the clang tidy be the source of truth and have clang-tidy --fix do the job.

@nickdesaulniers
Copy link
Member Author

Is there a reason you used perl-as-sed rather than clang-tidy --fix?

It is one command line vs many different command line invocations. ;)

I think that would fully canonicalize things wrt the trailing underscores too.

Sure, I'll give it a shot!

It seems like all of these are public headers in include.
I think we had those extra underscores for macro namespacing purposes.

Can you clarify what you mean by that?

I'm not sure if we actually want to remove those, it might be better to remove the check from the include folder.
Or modify the clang tidy so it handles the include folder in a special way?

Perhaps, if we have a justification why we need different conventions for different directories. I highly suspect we don't actually need them and may be cargo culting historical accidents forward.

I could replace all these lines with #pragma once to further demonstrate the lack of a need for a convention based on directory (and remind users that we only support modern open source compilers from the last decade).

When in doubt, I guess I'd be curious if libcxx has such a convention between "user visible" vs "internal only" header guards?

@nickdesaulniers nickdesaulniers marked this pull request as draft February 28, 2024 00:00
@nickdesaulniers
Copy link
Member Author

Is there a reason you used perl-as-sed rather than clang-tidy --fix?
I think that would fully canonicalize things wrt the trailing underscores too.

Sure, I'll give it a shot!

So I hacked the ninja libc-lint target to just run -checks="-*,llvm-header-guard" --fix than ran ninja libc-lint. While it cleaned up some headers, it also crashed a lot (ICE) and really mucked up some of the sources! I'm impressed!

@michaelrj-google
Copy link
Contributor

By "macro namespacing" I mean ensuring all our publicly available macros start (and possibly end) with a specific prefix. Looking at it, it's probably fine for that prefix to just be LLVM_LIBC_ since it's unlikely to have any collisions.

@nickdesaulniers
Copy link
Member Author

Note: when --fix does work, it also renames some header guards. Example:

diff --git a/libc/src/__support/CPP/type_traits/is_fixed_point.h b/libc/src/__support/CPP/type_traits/is_fixed_point.h
index 317ba39748b7..025268bc2979 100644
--- a/libc/src/__support/CPP/type_traits/is_fixed_point.h
+++ b/libc/src/__support/CPP/type_traits/is_fixed_point.h
@@ -43,4 +43,4 @@ LIBC_INLINE_VAR constexpr bool is_fixed_point_v = is_fixed_point<T>::value;
 
 } // namespace LIBC_NAMESPACE::cpp
 
-#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_INTEGRAL_H
+#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_FIXED_POINT_H
diff --git a/libc/src/__support/GPU/generic/utils.h b/libc/src/__support/GPU/generic/utils.h
index 58db88dce1ca..3139604ac644 100644

(This is good, just heads up to reviewers that some guards will also be renamed in this PR).

it's probably fine for that prefix to just be LLVM_LIBC_ since it's unlikely to have any collisions.

👍 SGTM

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).

There's a few remaining llvm-header-guard warning I'm tracking down separately
and will have a separate PR for those.
@nickdesaulniers
Copy link
Member Author

OK, I've figured a new way to automate applying fixits. I'ved added it to the commit message. PTAL

@nickdesaulniers nickdesaulniers marked this pull request as ready for review February 28, 2024 19:16
@nickdesaulniers nickdesaulniers merged commit 330793c into llvm:main Feb 28, 2024
7 checks passed
@nickdesaulniers nickdesaulniers deleted the stdfix_headr_grd branch February 28, 2024 20:54
@nickdesaulniers
Copy link
Member Author

Probably don't want header guards on assert.h: #83334

mylai-mtk pushed a commit to mylai-mtk/llvm-project that referenced this pull request Jul 12, 2024
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants