[libc-commits] [libc] [libc] fix -Wmacro-redefined (PR #75261)

via libc-commits libc-commits at lists.llvm.org
Tue Dec 12 16:31:12 PST 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 1ee6a1e38aa0c3773d892fcd01bb2af8e446e67f ec5a5bddd4ba87f303dac44c76402a1276346eef -- libc/include/llvm-libc-macros/linux/fcntl-macros.h libc/include/llvm-libc-macros/linux/sys-stat-macros.h libc/src/__support/File/linux/file.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
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 7886d356f2..48606cfa08 100644
--- a/libc/include/llvm-libc-macros/linux/sys-stat-macros.h
+++ b/libc/include/llvm-libc-macros/linux/sys-stat-macros.h
@@ -10,7 +10,7 @@
 #define __LLVM_LIBC_MACROS_LINUX_SYS_STAT_MACROS_H
 
 // Definitions from linux/stat.h
-#define S_IFMT   0170000
+#define S_IFMT 0170000
 #define S_IFSOCK 0140000
 #define S_IFLNK  0120000
 #define S_IFREG  0100000
diff --git a/libc/src/__support/File/linux/file.cpp b/libc/src/__support/File/linux/file.cpp
index 1b2d0e5901..b84da64cbe 100644
--- a/libc/src/__support/File/linux/file.cpp
+++ b/libc/src/__support/File/linux/file.cpp
@@ -17,8 +17,8 @@
 
 #include <fcntl.h> // For mode_t and other flags to the open syscall
 #include <stdio.h>
+#include <sys/stat.h>    // For S_IS*, S_IF*, and S_IR* flags.
 #include <sys/syscall.h> // For syscall numbers
-#include <sys/stat.h> // For S_IS*, S_IF*, and S_IR* flags.
 
 namespace LIBC_NAMESPACE {
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/75261


More information about the libc-commits mailing list