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

Reland: [libc] Move off_t and stdio macros to proxy hdrs #98384

Merged
merged 8 commits into from
Jul 11, 2024

Conversation

michaelrj-google
Copy link
Contributor

reland of #98215

Additionally adds proxy headers for FILE and the fopencookie types

The arm32 build has been failing due to redefinitions of the off_t type.
This patch fixes this by moving off_t to a proper proxy header. To do
this, it also moves stdio macros to a proxy header to hopefully avoid
including this proxy header alongside this public stdio.h.

The arm32 build has been failing due to redefinitions of the off_t type.
This patch fixes this by moving off_t to a proper proxy header. To do
this, it also moves stdio macros to a proxy header to hopefully avoid
including this proxy header alongside this public stdio.h.
@llvmbot llvmbot added libc bazel "Peripheral" support tier build system: utils/bazel labels Jul 10, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 10, 2024

@llvm/pr-subscribers-libc

Author: Michael Jones (michaelrj-google)

Changes

reland of #98215

Additionally adds proxy headers for FILE and the fopencookie types

The arm32 build has been failing due to redefinitions of the off_t type.
This patch fixes this by moving off_t to a proper proxy header. To do
this, it also moves stdio macros to a proxy header to hopefully avoid
including this proxy header alongside this public stdio.h.


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

140 Files Affected:

  • (modified) libc/config/gpu/api.td (-5)
  • (modified) libc/config/linux/api.td (-3)
  • (modified) libc/hdr/CMakeLists.txt (+10)
  • (added) libc/hdr/stdio_macros.h (+23)
  • (modified) libc/hdr/types/CMakeLists.txt (+27)
  • (added) libc/hdr/types/FILE.h (+22)
  • (added) libc/hdr/types/cookie_io_functions_t.h (+22)
  • (added) libc/hdr/types/off_t.h (+22)
  • (modified) libc/include/llvm-libc-macros/stdio-macros.h (+4)
  • (modified) libc/newhdrgen/yaml/stdio.yaml (-6)
  • (modified) libc/src/__support/File/CMakeLists.txt (+2)
  • (modified) libc/src/__support/File/file.cpp (+2-3)
  • (modified) libc/src/__support/File/file.h (+2-1)
  • (modified) libc/src/__support/File/linux/CMakeLists.txt (+10)
  • (modified) libc/src/__support/File/linux/file.cpp (+3-2)
  • (modified) libc/src/__support/File/linux/file.h (+1)
  • (modified) libc/src/__support/File/linux/lseekImpl.h (+1-1)
  • (modified) libc/src/__support/File/linux/stderr.cpp (+2-1)
  • (modified) libc/src/__support/File/linux/stdin.cpp (+2-1)
  • (modified) libc/src/__support/File/linux/stdout.cpp (+2-1)
  • (modified) libc/src/__support/OSUtil/linux/CMakeLists.txt (+1)
  • (modified) libc/src/__support/OSUtil/linux/fcntl.cpp (+1)
  • (modified) libc/src/gpu/rpc_fprintf.h (+1-1)
  • (modified) libc/src/stdio/CMakeLists.txt (+11-5)
  • (modified) libc/src/stdio/baremetal/getchar.cpp (+1-1)
  • (modified) libc/src/stdio/baremetal/printf.cpp (+1)
  • (modified) libc/src/stdio/baremetal/vprintf.cpp (+1)
  • (modified) libc/src/stdio/clearerr.h (+1-1)
  • (modified) libc/src/stdio/clearerr_unlocked.h (+1-1)
  • (modified) libc/src/stdio/fclose.h (+1-1)
  • (modified) libc/src/stdio/fdopen.h (+2-2)
  • (modified) libc/src/stdio/feof.h (+1-1)
  • (modified) libc/src/stdio/feof_unlocked.h (+1-1)
  • (modified) libc/src/stdio/ferror.h (+1-1)
  • (modified) libc/src/stdio/ferror_unlocked.h (+1-1)
  • (modified) libc/src/stdio/fflush.h (+1-1)
  • (modified) libc/src/stdio/fgetc.h (+1-1)
  • (modified) libc/src/stdio/fgetc_unlocked.h (+1-1)
  • (modified) libc/src/stdio/fgets.h (+1-1)
  • (modified) libc/src/stdio/flockfile.cpp (+1-1)
  • (modified) libc/src/stdio/flockfile.h (+1-1)
  • (modified) libc/src/stdio/fopen.h (+1-1)
  • (modified) libc/src/stdio/fopencookie.cpp (+4-2)
  • (modified) libc/src/stdio/fopencookie.h (+2-1)
  • (modified) libc/src/stdio/fprintf.cpp (+1-1)
  • (modified) libc/src/stdio/fprintf.h (+1-1)
  • (modified) libc/src/stdio/fputc.h (+1-1)
  • (modified) libc/src/stdio/fputs.h (+1-1)
  • (modified) libc/src/stdio/fread.h (+2-1)
  • (modified) libc/src/stdio/fread_unlocked.h (+2-1)
  • (modified) libc/src/stdio/fscanf.cpp (+1-1)
  • (modified) libc/src/stdio/fscanf.h (+1-1)
  • (modified) libc/src/stdio/fseek.h (+1-1)
  • (modified) libc/src/stdio/fseeko.h (+2-1)
  • (modified) libc/src/stdio/ftell.h (+1-1)
  • (modified) libc/src/stdio/ftello.h (+2-1)
  • (modified) libc/src/stdio/funlockfile.cpp (+1-1)
  • (modified) libc/src/stdio/funlockfile.h (+1-1)
  • (modified) libc/src/stdio/fwrite.h (+2-1)
  • (modified) libc/src/stdio/fwrite_unlocked.h (+2-1)
  • (modified) libc/src/stdio/generic/CMakeLists.txt (+30-30)
  • (modified) libc/src/stdio/generic/clearerr.cpp (+1-1)
  • (modified) libc/src/stdio/generic/clearerr_unlocked.cpp (+1-1)
  • (modified) libc/src/stdio/generic/fclose.cpp (+1-1)
  • (modified) libc/src/stdio/generic/feof.cpp (+1-1)
  • (modified) libc/src/stdio/generic/feof_unlocked.cpp (+1-1)
  • (modified) libc/src/stdio/generic/ferror.cpp (+1-1)
  • (modified) libc/src/stdio/generic/ferror_unlocked.cpp (+1-1)
  • (modified) libc/src/stdio/generic/fflush.cpp (+1-1)
  • (modified) libc/src/stdio/generic/fgetc.cpp (+2-1)
  • (modified) libc/src/stdio/generic/fgetc_unlocked.cpp (+2-1)
  • (modified) libc/src/stdio/generic/fgets.cpp (+1-1)
  • (modified) libc/src/stdio/generic/fopen.cpp (+1-1)
  • (modified) libc/src/stdio/generic/fputc.cpp (+2-1)
  • (modified) libc/src/stdio/generic/fputs.cpp (+2-1)
  • (modified) libc/src/stdio/generic/fread.cpp (+2-1)
  • (modified) libc/src/stdio/generic/fread_unlocked.cpp (+2-1)
  • (modified) libc/src/stdio/generic/fwrite.cpp (+2-1)
  • (modified) libc/src/stdio/generic/fwrite_unlocked.cpp (+2-1)
  • (modified) libc/src/stdio/generic/getc.cpp (+2-1)
  • (modified) libc/src/stdio/generic/getc_unlocked.cpp (+2-1)
  • (modified) libc/src/stdio/generic/getchar.cpp (+1-1)
  • (modified) libc/src/stdio/generic/getchar_unlocked.cpp (+1-1)
  • (modified) libc/src/stdio/generic/printf.cpp (+1-1)
  • (modified) libc/src/stdio/generic/putc.cpp (+2-1)
  • (modified) libc/src/stdio/generic/putchar.cpp (+2-1)
  • (modified) libc/src/stdio/generic/puts.cpp (+2-1)
  • (modified) libc/src/stdio/generic/stderr.cpp (+1-1)
  • (modified) libc/src/stdio/generic/stdin.cpp (+1-1)
  • (modified) libc/src/stdio/generic/stdout.cpp (+1-1)
  • (modified) libc/src/stdio/generic/ungetc.cpp (+1-1)
  • (modified) libc/src/stdio/generic/vprintf.cpp (+1-1)
  • (modified) libc/src/stdio/getc.h (+1-1)
  • (modified) libc/src/stdio/getc_unlocked.h (+1-1)
  • (modified) libc/src/stdio/gpu/CMakeLists.txt (+30-57)
  • (modified) libc/src/stdio/gpu/clearerr.cpp (+1-1)
  • (modified) libc/src/stdio/gpu/fclose.cpp (+2-1)
  • (modified) libc/src/stdio/gpu/feof.cpp (+1-1)
  • (modified) libc/src/stdio/gpu/ferror.cpp (+1-1)
  • (modified) libc/src/stdio/gpu/fflush.cpp (+1-1)
  • (modified) libc/src/stdio/gpu/fgetc.cpp (+2-1)
  • (modified) libc/src/stdio/gpu/fgets.cpp (+2-1)
  • (modified) libc/src/stdio/gpu/file.h (+3-1)
  • (modified) libc/src/stdio/gpu/fopen.cpp (+1-1)
  • (modified) libc/src/stdio/gpu/fputc.cpp (+3-2)
  • (modified) libc/src/stdio/gpu/fputs.cpp (+2-1)
  • (modified) libc/src/stdio/gpu/fread.cpp (+1-1)
  • (modified) libc/src/stdio/gpu/fseek.cpp (+1-1)
  • (modified) libc/src/stdio/gpu/ftell.cpp (+1-1)
  • (modified) libc/src/stdio/gpu/fwrite.cpp (+1-1)
  • (modified) libc/src/stdio/gpu/getc.cpp (+2-1)
  • (modified) libc/src/stdio/gpu/getchar.cpp (+4-1)
  • (modified) libc/src/stdio/gpu/putc.cpp (+2-1)
  • (modified) libc/src/stdio/gpu/putchar.cpp (+5-2)
  • (modified) libc/src/stdio/gpu/puts.cpp (+4-1)
  • (modified) libc/src/stdio/gpu/remove.cpp (+1-1)
  • (modified) libc/src/stdio/gpu/stderr.cpp (+1-1)
  • (modified) libc/src/stdio/gpu/stdin.cpp (+1-1)
  • (modified) libc/src/stdio/gpu/stdout.cpp (+1-1)
  • (modified) libc/src/stdio/gpu/ungetc.cpp (+1-1)
  • (modified) libc/src/stdio/printf.h (+1-1)
  • (modified) libc/src/stdio/printf_core/vfprintf_internal.h (+1-1)
  • (modified) libc/src/stdio/putc.h (+1-1)
  • (modified) libc/src/stdio/remove.h (+1-1)
  • (modified) libc/src/stdio/scanf.cpp (+1-1)
  • (modified) libc/src/stdio/scanf_core/vfscanf_internal.h (+2-1)
  • (modified) libc/src/stdio/setbuf.cpp (+1-2)
  • (modified) libc/src/stdio/setbuf.h (+1-1)
  • (modified) libc/src/stdio/setvbuf.cpp (+2-1)
  • (modified) libc/src/stdio/setvbuf.h (+2-1)
  • (modified) libc/src/stdio/sscanf.cpp (+2-1)
  • (modified) libc/src/stdio/ungetc.h (+1-1)
  • (modified) libc/src/stdio/vfprintf.cpp (+1-1)
  • (modified) libc/src/stdio/vfprintf.h (+1-1)
  • (modified) libc/src/stdio/vprintf.h (+1-1)
  • (modified) libc/src/unistd/getopt.cpp (+1-1)
  • (modified) libc/src/unistd/getopt.h (+1-1)
  • (modified) libc/src/wchar/btowc.cpp (+1-1)
  • (modified) libc/src/wchar/wctob.cpp (+1-1)
  • (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+13)
diff --git a/libc/config/gpu/api.td b/libc/config/gpu/api.td
index 523ad49ffa3fd..21ddbb95b70c9 100644
--- a/libc/config/gpu/api.td
+++ b/libc/config/gpu/api.td
@@ -59,11 +59,6 @@ def FenvAPI: PublicAPI<"fenv.h"> {
 }
 
 def StdIOAPI : PublicAPI<"stdio.h"> {
-  let Macros = [
-    SimpleMacroDef<"_IOFBF", "0">,
-    SimpleMacroDef<"_IOLBF", "1">,
-    SimpleMacroDef<"_IONBF", "2">,
-  ];
   let Types = [
     "FILE",
     "off_t",
diff --git a/libc/config/linux/api.td b/libc/config/linux/api.td
index eb0090c80b0da..60e9b70f0d8a4 100644
--- a/libc/config/linux/api.td
+++ b/libc/config/linux/api.td
@@ -76,9 +76,6 @@ def StdIOAPI : PublicAPI<"stdio.h"> {
     SimpleMacroDef<"stderr", "stderr">,
     SimpleMacroDef<"stdin", "stdin">,
     SimpleMacroDef<"stdout", "stdout">,
-    SimpleMacroDef<"_IOFBF", "0">,
-    SimpleMacroDef<"_IOLBF", "1">,
-    SimpleMacroDef<"_IONBF", "2">,
   ];
   let Types = [
     "FILE",
diff --git a/libc/hdr/CMakeLists.txt b/libc/hdr/CMakeLists.txt
index 1303280c2c5ef..da640e8c0f70c 100644
--- a/libc/hdr/CMakeLists.txt
+++ b/libc/hdr/CMakeLists.txt
@@ -69,6 +69,16 @@ add_proxy_header_library(
     libc.include.signal
 )
 
+add_proxy_header_library(
+  stdio_macros
+  HDRS
+    stdio_macros.h
+  FULL_BUILD_DEPENDS
+    libc.include.stdio
+    libc.include.llvm-libc-macros.stdio_macros
+    libc.include.llvm-libc-macros.file_seek_macros
+)
+
 add_proxy_header_library(
   sys_epoll_macros
   HDRS
diff --git a/libc/hdr/stdio_macros.h b/libc/hdr/stdio_macros.h
new file mode 100644
index 0000000000000..a212846dd8f41
--- /dev/null
+++ b/libc/hdr/stdio_macros.h
@@ -0,0 +1,23 @@
+//===-- Definition of macros from stdio.h --------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_HDR_STDIO_MACROS_H
+#define LLVM_LIBC_HDR_STDIO_MACROS_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-macros/file-seek-macros.h"
+#include "include/llvm-libc-macros/stdio-macros.h"
+
+#else // Overlay mode
+
+#include <stdio.h>
+
+#endif // LLVM_LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_STDIO_MACROS_H
diff --git a/libc/hdr/types/CMakeLists.txt b/libc/hdr/types/CMakeLists.txt
index 1cab1d3b812cf..4fc28fd82e68d 100644
--- a/libc/hdr/types/CMakeLists.txt
+++ b/libc/hdr/types/CMakeLists.txt
@@ -135,3 +135,30 @@ add_proxy_header_library(
     libc.include.llvm-libc-types.struct_sigaction
     libc.include.signal
 )
+
+add_proxy_header_library(
+  FILE
+  HDRS
+    FILE.h
+  FULL_BUILD_DEPENDS
+    libc.include.llvm-libc-types.FILE
+    libc.include.stdio
+)
+
+add_proxy_header_library(
+  off_t
+  HDRS
+    off_t.h
+  FULL_BUILD_DEPENDS
+    libc.include.llvm-libc-types.off_t
+    libc.include.stdio
+)
+
+add_proxy_header_library(
+  cookie_io_functions_t
+  HDRS
+    cookie_io_functions_t.h
+  FULL_BUILD_DEPENDS
+    libc.include.llvm-libc-types.cookie_io_functions_t
+    libc.include.stdio
+)
diff --git a/libc/hdr/types/FILE.h b/libc/hdr/types/FILE.h
new file mode 100644
index 0000000000000..60e95f07e37f9
--- /dev/null
+++ b/libc/hdr/types/FILE.h
@@ -0,0 +1,22 @@
+//===-- Proxy for FILE ----------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_HDR_TYPES_FILE_H
+#define LLVM_LIBC_HDR_TYPES_FILE_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-types/FILE.h"
+
+#else // Overlay mode
+
+#include <stdio.h>
+
+#endif // LLVM_LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_TYPES_FILE_H
diff --git a/libc/hdr/types/cookie_io_functions_t.h b/libc/hdr/types/cookie_io_functions_t.h
new file mode 100644
index 0000000000000..d8fe7731a84bd
--- /dev/null
+++ b/libc/hdr/types/cookie_io_functions_t.h
@@ -0,0 +1,22 @@
+//===-- Proxy for cookie_io_functions_t -----------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_HDR_TYPES_COOKIE_IO_FUNCTIONS_T_H
+#define LLVM_LIBC_HDR_TYPES_COOKIE_IO_FUNCTIONS_T_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-types/cookie_io_functions_t.h"
+
+#else // Overlay mode
+
+#include <stdio.h>
+
+#endif // LLVM_LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_TYPES_COOKIE_IO_FUNCTIONS_T_H
diff --git a/libc/hdr/types/off_t.h b/libc/hdr/types/off_t.h
new file mode 100644
index 0000000000000..abc3aa659365f
--- /dev/null
+++ b/libc/hdr/types/off_t.h
@@ -0,0 +1,22 @@
+//===-- Proxy for off_t ---------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_HDR_TYPES_OFF_T_H
+#define LLVM_LIBC_HDR_TYPES_OFF_T_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-types/off_t.h"
+
+#else // Overlay mode
+
+#include <stdio.h>
+
+#endif // LLVM_LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_TYPES_OFF_T_H
diff --git a/libc/include/llvm-libc-macros/stdio-macros.h b/libc/include/llvm-libc-macros/stdio-macros.h
index 4664801c5731f..69fb71ad3f651 100644
--- a/libc/include/llvm-libc-macros/stdio-macros.h
+++ b/libc/include/llvm-libc-macros/stdio-macros.h
@@ -15,4 +15,8 @@
 
 #define BUFSIZ 1024
 
+#define _IONBF 2
+#define _IOLBF 1
+#define _IOFBF 0
+
 #endif // LLVM_LIBC_MACROS_STDIO_MACROS_H
diff --git a/libc/newhdrgen/yaml/stdio.yaml b/libc/newhdrgen/yaml/stdio.yaml
index 6d2a8557f9b94..687a6d696cad6 100644
--- a/libc/newhdrgen/yaml/stdio.yaml
+++ b/libc/newhdrgen/yaml/stdio.yaml
@@ -1,11 +1,5 @@
 header: stdio.h
 macros:
-  - macro_name: _IONBF
-    macro_value: 2
-  - macro_name: _IOLBF
-    macro_value: 1
-  - macro_name: _IOFBF
-    macro_value: 0
   - macro_name: stdout
     macro_value: stdout
   - macro_name: stdin
diff --git a/libc/src/__support/File/CMakeLists.txt b/libc/src/__support/File/CMakeLists.txt
index 0416ac2cc902e..1b390a12424d0 100644
--- a/libc/src/__support/File/CMakeLists.txt
+++ b/libc/src/__support/File/CMakeLists.txt
@@ -16,6 +16,8 @@ add_object_library(
     libc.src.__support.CPP.span
     libc.src.__support.threads.mutex
     libc.src.__support.error_or
+    libc.hdr.types.off_t
+    libc.hdr.stdio_macros
 )
 
 add_object_library(
diff --git a/libc/src/__support/File/file.cpp b/libc/src/__support/File/file.cpp
index 0b1a8cac21f77..08052f8d0a328 100644
--- a/libc/src/__support/File/file.cpp
+++ b/libc/src/__support/File/file.cpp
@@ -8,13 +8,12 @@
 
 #include "file.h"
 
+#include "hdr/stdio_macros.h"
+#include "hdr/types/off_t.h"
 #include "src/__support/CPP/new.h"
 #include "src/__support/CPP/span.h"
 #include "src/errno/libc_errno.h" // For error macros
 
-#include <stdio.h>
-#include <stdlib.h>
-
 namespace LIBC_NAMESPACE {
 
 FileIOResult File::write_unlocked(const void *data, size_t len) {
diff --git a/libc/src/__support/File/file.h b/libc/src/__support/File/file.h
index cc82a7ecc9745..d804289702540 100644
--- a/libc/src/__support/File/file.h
+++ b/libc/src/__support/File/file.h
@@ -9,7 +9,8 @@
 #ifndef LLVM_LIBC_SRC___SUPPORT_FILE_FILE_H
 #define LLVM_LIBC_SRC___SUPPORT_FILE_FILE_H
 
-#include "include/llvm-libc-types/off_t.h"
+#include "hdr/stdio_macros.h"
+#include "hdr/types/off_t.h"
 #include "src/__support/CPP/new.h"
 #include "src/__support/error_or.h"
 #include "src/__support/macros/properties/architectures.h"
diff --git a/libc/src/__support/File/linux/CMakeLists.txt b/libc/src/__support/File/linux/CMakeLists.txt
index 8436a687116bd..5556b812596f8 100644
--- a/libc/src/__support/File/linux/CMakeLists.txt
+++ b/libc/src/__support/File/linux/CMakeLists.txt
@@ -5,6 +5,7 @@ add_object_library(
     file.cpp
   HDRS
     file.h
+    lseekImpl.h
   DEPENDS
     libc.include.fcntl
     libc.include.stdio
@@ -15,6 +16,9 @@ add_object_library(
     libc.src.errno.errno
     libc.src.__support.error_or
     libc.src.__support.File.file
+    libc.hdr.types.off_t
+    libc.hdr.types.FILE
+    libc.hdr.stdio_macros
 )
 
 add_object_library(
@@ -23,6 +27,8 @@ add_object_library(
     stdout.cpp
   DEPENDS
     .file
+    libc.hdr.types.FILE
+    libc.hdr.stdio_macros
 )
 
 add_object_library(
@@ -31,6 +37,8 @@ add_object_library(
     stdin.cpp
   DEPENDS
     .file
+    libc.hdr.types.FILE
+    libc.hdr.stdio_macros
 )
 
 add_object_library(
@@ -39,6 +47,8 @@ add_object_library(
     stderr.cpp
   DEPENDS
     .file
+    libc.hdr.types.FILE
+    libc.hdr.stdio_macros
 )
 
 add_object_library(
diff --git a/libc/src/__support/File/linux/file.cpp b/libc/src/__support/File/linux/file.cpp
index 0f6ed4f0a5ef4..df68570bc1043 100644
--- a/libc/src/__support/File/linux/file.cpp
+++ b/libc/src/__support/File/linux/file.cpp
@@ -8,6 +8,8 @@
 
 #include "file.h"
 
+#include "hdr/stdio_macros.h"
+#include "hdr/types/off_t.h"
 #include "src/__support/CPP/new.h"
 #include "src/__support/File/file.h"
 #include "src/__support/File/linux/lseekImpl.h"
@@ -15,8 +17,7 @@
 #include "src/__support/OSUtil/syscall.h" // For internal syscall function.
 #include "src/errno/libc_errno.h"         // For error macros
 
-#include <fcntl.h> // For mode_t and other flags to the open syscall
-#include <stdio.h>
+#include <fcntl.h>       // For mode_t and other flags to the open syscall
 #include <sys/stat.h>    // For S_IS*, S_IF*, and S_IR* flags.
 #include <sys/syscall.h> // For syscall numbers
 
diff --git a/libc/src/__support/File/linux/file.h b/libc/src/__support/File/linux/file.h
index 63b820529932b..0507109e6793f 100644
--- a/libc/src/__support/File/linux/file.h
+++ b/libc/src/__support/File/linux/file.h
@@ -6,6 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "hdr/types/off_t.h"
 #include "src/__support/File/file.h"
 
 namespace LIBC_NAMESPACE {
diff --git a/libc/src/__support/File/linux/lseekImpl.h b/libc/src/__support/File/linux/lseekImpl.h
index d1632b703d3bc..af015a2fd6a70 100644
--- a/libc/src/__support/File/linux/lseekImpl.h
+++ b/libc/src/__support/File/linux/lseekImpl.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_LIBC_SRC___SUPPORT_FILE_LINUX_LSEEKIMPL_H
 #define LLVM_LIBC_SRC___SUPPORT_FILE_LINUX_LSEEKIMPL_H
 
+#include "hdr/types/off_t.h"
 #include "src/__support/OSUtil/syscall.h" // For internal syscall function.
 #include "src/__support/common.h"
 #include "src/__support/error_or.h"
@@ -16,7 +17,6 @@
 
 #include <stdint.h>      // For uint64_t.
 #include <sys/syscall.h> // For syscall numbers.
-#include <unistd.h>      // For off_t.
 
 namespace LIBC_NAMESPACE {
 namespace internal {
diff --git a/libc/src/__support/File/linux/stderr.cpp b/libc/src/__support/File/linux/stderr.cpp
index 65d7865720ffe..0b4b207329fff 100644
--- a/libc/src/__support/File/linux/stderr.cpp
+++ b/libc/src/__support/File/linux/stderr.cpp
@@ -7,7 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "file.h"
-#include <stdio.h>
+#include "hdr/stdio_macros.h"
+#include "hdr/types/FILE.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/__support/File/linux/stdin.cpp b/libc/src/__support/File/linux/stdin.cpp
index c9a363bb7c65a..49146dacfd4ac 100644
--- a/libc/src/__support/File/linux/stdin.cpp
+++ b/libc/src/__support/File/linux/stdin.cpp
@@ -7,7 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "file.h"
-#include <stdio.h>
+#include "hdr/stdio_macros.h"
+#include "hdr/types/FILE.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/__support/File/linux/stdout.cpp b/libc/src/__support/File/linux/stdout.cpp
index 314692ecbfe1e..58caf85b5167f 100644
--- a/libc/src/__support/File/linux/stdout.cpp
+++ b/libc/src/__support/File/linux/stdout.cpp
@@ -7,7 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "file.h"
-#include <stdio.h>
+#include "hdr/stdio_macros.h"
+#include "hdr/types/FILE.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/__support/OSUtil/linux/CMakeLists.txt b/libc/src/__support/OSUtil/linux/CMakeLists.txt
index 78b117fd19439..089cad454d534 100644
--- a/libc/src/__support/OSUtil/linux/CMakeLists.txt
+++ b/libc/src/__support/OSUtil/linux/CMakeLists.txt
@@ -21,4 +21,5 @@ add_object_library(
     libc.hdr.types.struct_flock
     libc.hdr.types.struct_flock64
     libc.hdr.types.struct_f_owner_ex
+    libc.hdr.types.off_t
 )
diff --git a/libc/src/__support/OSUtil/linux/fcntl.cpp b/libc/src/__support/OSUtil/linux/fcntl.cpp
index b6483bb7534d6..d5e850a904703 100644
--- a/libc/src/__support/OSUtil/linux/fcntl.cpp
+++ b/libc/src/__support/OSUtil/linux/fcntl.cpp
@@ -9,6 +9,7 @@
 #include "src/__support/OSUtil/fcntl.h"
 
 #include "hdr/fcntl_macros.h"
+#include "hdr/types/off_t.h"
 #include "hdr/types/struct_f_owner_ex.h"
 #include "hdr/types/struct_flock.h"
 #include "hdr/types/struct_flock64.h"
diff --git a/libc/src/gpu/rpc_fprintf.h b/libc/src/gpu/rpc_fprintf.h
index 053f7b4f818ae..3292ce2d4b1ec 100644
--- a/libc/src/gpu/rpc_fprintf.h
+++ b/libc/src/gpu/rpc_fprintf.h
@@ -9,8 +9,8 @@
 #ifndef LLVM_LIBC_SRC_GPU_RPC_HOST_CALL_H
 #define LLVM_LIBC_SRC_GPU_RPC_HOST_CALL_H
 
+#include "hdr/types/FILE.h"
 #include <stddef.h>
-#include <stdio.h>
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/stdio/CMakeLists.txt b/libc/src/stdio/CMakeLists.txt
index a659d9e847a9e..91b3a864042b9 100644
--- a/libc/src/stdio/CMakeLists.txt
+++ b/libc/src/stdio/CMakeLists.txt
@@ -37,7 +37,7 @@ add_entrypoint_object(
   HDRS
     flockfile.h
   DEPENDS
-    libc.include.stdio
+    libc.hdr.types.FILE
     libc.src.__support.File.file
     libc.src.__support.File.platform_file
 )
@@ -49,7 +49,7 @@ add_entrypoint_object(
   HDRS
     funlockfile.h
   DEPENDS
-    libc.include.stdio
+    libc.hdr.types.FILE
     libc.src.__support.File.file
     libc.src.__support.File.platform_file
 )
@@ -61,7 +61,10 @@ add_entrypoint_object(
   HDRS
     fopencookie.h
   DEPENDS
-    libc.include.stdio
+    libc.hdr.stdio_macros
+    libc.hdr.types.off_t
+    libc.hdr.types.cookie_io_functions_t
+    libc.hdr.types.FILE
     libc.src.__support.CPP.new
     libc.src.__support.File.file
 )
@@ -74,7 +77,7 @@ add_entrypoint_object(
     setbuf.h
   DEPENDS
     libc.src.errno.errno
-    libc.include.stdio
+    libc.hdr.types.off_t
     libc.src.__support.File.file
     libc.src.__support.File.platform_file
 )
@@ -87,7 +90,7 @@ add_entrypoint_object(
     setvbuf.h
   DEPENDS
     libc.src.errno.errno
-    libc.include.stdio
+    libc.hdr.types.FILE
     libc.src.__support.File.file
     libc.src.__support.File.platform_file
 )
@@ -95,6 +98,7 @@ add_entrypoint_object(
 list(APPEND scanf_deps
       libc.src.__support.arg_list
       libc.src.stdio.scanf_core.vfscanf_internal
+      libc.hdr.types.FILE
 )
 
 if(LLVM_LIBC_FULL_BUILD)
@@ -166,6 +170,7 @@ add_entrypoint_object(
   HDRS
     fprintf.h
   DEPENDS
+    libc.hdr.types.FILE
     libc.src.__support.arg_list
     libc.src.stdio.printf_core.vfprintf_internal
 )
@@ -199,6 +204,7 @@ add_entrypoint_object(
   HDRS
     vfprintf.h
   DEPENDS
+    libc.hdr.types.FILE
     libc.src.__support.arg_list
     libc.src.stdio.printf_core.vfprintf_internal
 )
diff --git a/libc/src/stdio/baremetal/getchar.cpp b/libc/src/stdio/baremetal/getchar.cpp
index bbd5ba7a954fb..0cd7c59b495dd 100644
--- a/libc/src/stdio/baremetal/getchar.cpp
+++ b/libc/src/stdio/baremetal/getchar.cpp
@@ -9,7 +9,7 @@
 #include "src/stdio/getchar.h"
 #include "src/__support/OSUtil/io.h"
 
-#include <stdio.h>
+#include "hdr/types/FILE.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/stdio/baremetal/printf.cpp b/libc/src/stdio/baremetal/printf.cpp
index b240371a0c20e..dfc3c0b853959 100644
--- a/libc/src/stdio/baremetal/printf.cpp
+++ b/libc/src/stdio/baremetal/printf.cpp
@@ -14,6 +14,7 @@
 #include "src/stdio/printf_core/writer.h"
 
 #include <stdarg.h>
+#include <stddef.h>
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/stdio/baremetal/vprintf.cpp b/libc/src/stdio/baremetal/vprintf.cpp
index cd1541297f3b6..203ec18efb657 100644
--- a/libc/src/stdio/baremetal/vprintf.cpp
+++ b/libc/src/stdio/baremetal/vprintf.cpp
@@ -14,6 +14,7 @@
 #include "src/stdio/printf_core/writer.h"
 
 #include <stdarg.h>
+#include <stddef.h>
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/stdio/clearerr.h b/libc/src/stdio/clearerr.h
index b8e8d7c5cab82..2b3418037c433 100644
--- a/libc/src/stdio/clearerr.h
+++ b/libc/src/stdio/clearerr.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_LIBC_SRC_STDIO_CLEARERR_H
 #define LLVM_LIBC_SRC_STDIO_CLEARERR_H
 
-#include <stdio.h>
+#include "hdr/types/FILE.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/stdio/clearerr_unlocked.h b/libc/src/stdio/clearerr_unlocked.h
index ff447cea61370..05ddbdd1d7af1 100644
--- a/libc/src/stdio/clearerr_unlocked.h
+++ b/libc/src/stdio/clearerr_unlocked.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_LIBC_SRC_STDIO_CLEARERR_UNLOCKED_H
 #define LLVM_LIBC_SRC_STDIO_CLEARERR_UNLOCKED_H
 
-#include <stdio.h>
+#include "hdr/types/FILE.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/stdio/fclose.h b/libc/src/stdio/fclose.h
index 7fe6951a080dc..731e3581d8fd1 100644
--- a/libc/src/stdio/fclose.h
+++ b/libc/src/stdio/fclose.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_LIBC_SRC_STDIO_FCLOSE_H
 #define LLVM_LIBC_SRC_STDIO_FCLOSE_H
 
-#include <stdio.h>
+#include "hdr/types/FILE.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/stdio/fdopen.h b/libc/src/stdio/fdopen.h
index 158a133e7e131..29028b8ab5ed3 100644
--- a/libc/src/stdio/fdopen.h
+++ b/libc/src/stdio/fdopen.h
@@ -9,11 +9,11 @@
 #ifndef LLVM_LIBC_SRC_STDIO_FDOPEN_H
 #define LLVM_LIBC_SRC_STDIO_FDOPEN_H
 
-#include <stdio.h>
+#include "hdr/types/FILE.h"
 
 namespace LIBC_NAMESPACE {
 
-FILE *fdopen(int fd, const char *mode);
+::FILE *fdopen(int fd, const char *mode);
 
 } // namespace LIBC_NAMESPACE
 
diff --git a/libc/src/stdio/feof.h b/libc/src/stdio/feof.h
index 66a49bdd25701..3d47db6993e1f 100644
--- a/libc/src/stdio/feof.h
+++ b/libc/src/stdio/feof.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_LIBC_SRC_STDIO_FEOF_H
 #define LLVM_LIBC_SRC_STDIO_FEOF_H
 
-#include <stdio.h>
+#include "hdr/types/FILE.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/stdio/feof_unlocked.h b/libc/src/stdio/feof_unlocked.h
index 359609c597900..6eae427992698 100644
--- a/libc/src/stdio/feof_unlocked.h
+++ b/libc/src/stdio/feof_unlocked.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_LIBC_SRC_STDIO_FEOF_UNLOCKED_H
 #define LLVM_LIBC_SRC_STDIO_FEOF_UNLOCKED_H
 
-#include <stdio.h>
+#include "hdr/types/FILE.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/stdio/ferror.h b/libc/src/stdio/ferror.h
index 194dff6320c83..9e2f949bf30e5 100644
--- a/libc/src/stdio/ferror.h
+++ b/libc/src/stdio/ferror.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_LIBC_SRC_STDIO_FERROR_H
 #define LLVM_LIBC_SRC_STDIO_FERROR_H
 
-#include <stdio.h>
+#include "hdr/types/FILE.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/stdio/ferror_unlocked.h b/libc/src/stdio/ferror_unlocked.h
index 86281025368c3..16cfd5a1b1482 100644
--- a/libc/src/stdio/ferror_unlocked.h
+++ b/libc/src/stdio/ferror_unlocked.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_LIBC_SRC_STDIO_FERROR_UNLOCKED_H
 #define LLVM_LIBC_SRC_STDIO_FERROR_UNLOCKED_H
 
-#include <stdio.h>
+#include "hdr/types/FILE.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/stdio/fflush.h b/libc/src/stdio/fflush.h
index 839fd986f15b5..d64d5264cf7dd 100644
--- a/libc/src/stdio/fflush.h
+++ b/libc/src/stdio/fflush.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_LIBC_SRC_STDIO_FFLUSH_H
 #define LLVM_LIBC_SRC_STDIO_FFLUSH_H
 
-#include <stdio.h>
+#include "hdr/types/FILE.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/stdio/fgetc.h b/libc/src/stdio/fgetc.h
index 26a32482a3ba7..f88d759d549ec 100644
--- a/libc/src/stdio/fgetc.h
+++ b/libc/src/stdio/fgetc.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_LIBC...
[truncated]

@michaelrj-google michaelrj-google merged commit 5aed6d6 into llvm:main Jul 11, 2024
6 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 11, 2024

LLVM Buildbot has detected a new failure on builder libc-x86_64-debian running on libc-x86_64-debian while building libc,utils at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/43/builds/1907

Here is the relevant piece of the build log for the reference:

Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Performing Test HAVE_PTHREAD_AFFINITY -- success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/build
@@@BUILD_STEP build libc@@@
Running: ninja libc
[1/16] Building CXX object projects/libc/src/wchar/CMakeFiles/libc.src.wchar.wctob.dir/wctob.cpp.o
[2/16] Building CXX object projects/libc/src/stdio/CMakeFiles/libc.src.stdio.sscanf.dir/sscanf.cpp.o
[3/16] Building CXX object projects/libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o
FAILED: projects/libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_19_0_0_git -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/build/projects/libc/src/stdio/generic -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/llvm-project/libc/src/stdio/generic -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/build/projects/libc/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -fpie -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -DLIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT=100 -DLIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY=1 -std=c++17 -MD -MT projects/libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o -MF projects/libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o.d -o projects/libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/llvm-project/libc/src/stdio/generic/fileno.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/llvm-project/libc/src/stdio/generic/fileno.cpp:13:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/llvm-project/libc/src/__support/File/file.h:12:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/llvm-project/libc/hdr/stdio_macros.h:19:
In file included from /usr/include/stdio.h:42:
/usr/include/x86_64-linux-gnu/bits/types/FILE.h:7:25: error: typedef redefinition with different types ('struct _IO_FILE' vs 'struct FILE')
typedef struct _IO_FILE FILE;
                        ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/llvm-project/libc/include/llvm-libc-types/FILE.h:12:21: note: previous definition is here
typedef struct FILE FILE;
                    ^
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/llvm-project/libc/src/stdio/generic/fileno.cpp:13:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/llvm-project/libc/src/__support/File/file.h:12:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/llvm-project/libc/hdr/stdio_macros.h:19:
In file included from /usr/include/stdio.h:902:
/usr/include/x86_64-linux-gnu/bits/stdio.h:58:10: error: member access into incomplete type 'FILE'
  return __getc_unlocked_body (__fp);
         ^
/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h:103:27: note: expanded from macro '__getc_unlocked_body'
  (__glibc_unlikely ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end)        \
                          ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/llvm-project/libc/include/llvm-libc-types/FILE.h:12:16: note: forward declaration of 'FILE'
typedef struct FILE FILE;
               ^
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/llvm-project/libc/src/stdio/generic/fileno.cpp:13:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/llvm-project/libc/src/__support/File/file.h:12:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/llvm-project/libc/hdr/stdio_macros.h:19:
In file included from /usr/include/stdio.h:902:
/usr/include/x86_64-linux-gnu/bits/stdio.h:58:10: error: member access into incomplete type 'FILE'
  return __getc_unlocked_body (__fp);
         ^
/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h:103:50: note: expanded from macro '__getc_unlocked_body'
  (__glibc_unlikely ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end)        \
                                                 ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/llvm-project/libc/include/llvm-libc-types/FILE.h:12:16: note: forward declaration of 'FILE'
typedef struct FILE FILE;
               ^
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/llvm-project/libc/src/stdio/generic/fileno.cpp:13:

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 11, 2024

LLVM Buildbot has detected a new failure on builder libc-x86_64-debian-dbg-asan running on libc-x86_64-debian while building libc,utils at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/147/builds/1847

Here is the relevant piece of the build log for the reference:

Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Performing Test HAVE_PTHREAD_AFFINITY -- success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build
@@@BUILD_STEP build libc@@@
Running: ninja libc
[1/16] Building CXX object projects/libc/src/stdio/CMakeFiles/libc.src.stdio.sscanf.dir/sscanf.cpp.o
[2/16] Building CXX object projects/libc/src/stdio/linux/CMakeFiles/libc.src.stdio.linux.remove.dir/remove.cpp.o
[3/16] Building CXX object projects/libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o
FAILED: projects/libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_19_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/projects/libc/src/stdio/generic -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/stdio/generic -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/projects/libc/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fno-omit-frame-pointer -O1 -fsanitize=address -fdiagnostics-color -g -fpie -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -DLIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT=100 -DLIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY=1 -std=c++17 -MD -MT projects/libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o -MF projects/libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o.d -o projects/libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/stdio/generic/fileno.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/stdio/generic/fileno.cpp:13:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/__support/File/file.h:12:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/hdr/stdio_macros.h:19:
In file included from /usr/include/stdio.h:42:
/usr/include/x86_64-linux-gnu/bits/types/FILE.h:7:25: error: typedef redefinition with different types ('struct _IO_FILE' vs 'struct FILE')
typedef struct _IO_FILE FILE;
                        ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/include/llvm-libc-types/FILE.h:12:21: note: previous definition is here
typedef struct FILE FILE;
                    ^
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/stdio/generic/fileno.cpp:13:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/__support/File/file.h:12:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/hdr/stdio_macros.h:19:
In file included from /usr/include/stdio.h:902:
/usr/include/x86_64-linux-gnu/bits/stdio.h:58:10: error: member access into incomplete type 'FILE'
  return __getc_unlocked_body (__fp);
         ^
/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h:103:27: note: expanded from macro '__getc_unlocked_body'
  (__glibc_unlikely ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end)        \
                          ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/include/llvm-libc-types/FILE.h:12:16: note: forward declaration of 'FILE'
typedef struct FILE FILE;
               ^
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/stdio/generic/fileno.cpp:13:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/__support/File/file.h:12:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/hdr/stdio_macros.h:19:
In file included from /usr/include/stdio.h:902:
/usr/include/x86_64-linux-gnu/bits/stdio.h:58:10: error: member access into incomplete type 'FILE'
  return __getc_unlocked_body (__fp);
         ^
/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h:103:50: note: expanded from macro '__getc_unlocked_body'
  (__glibc_unlikely ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end)        \
                                                 ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/include/llvm-libc-types/FILE.h:12:16: note: forward declaration of 'FILE'
typedef struct FILE FILE;
               ^
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/stdio/generic/fileno.cpp:13:

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 11, 2024

LLVM Buildbot has detected a new failure on builder libc-x86_64-debian-dbg running on libc-x86_64-debian while building libc,utils at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/93/builds/1873

Here is the relevant piece of the build log for the reference:

Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
-- Generating done
-- Build files have been written to: /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg/build
@@@BUILD_STEP build libc@@@
Running: ninja libc
[1/16] Building CXX object projects/libc/src/stdio/CMakeFiles/libc.src.stdio.sscanf.dir/sscanf.cpp.o
[2/16] Building CXX object projects/libc/src/wchar/CMakeFiles/libc.src.wchar.wctob.dir/wctob.cpp.o
[3/16] Building CXX object projects/libc/src/stdio/linux/CMakeFiles/libc.src.stdio.linux.remove.dir/remove.cpp.o
[4/16] Building CXX object projects/libc/src/unistd/linux/CMakeFiles/libc.src.unistd.linux.lseek.dir/lseek.cpp.o
[5/16] Building CXX object projects/libc/src/__support/OSUtil/linux/CMakeFiles/libc.src.__support.OSUtil.linux.linux_util.dir/fcntl.cpp.o
[6/16] Building CXX object projects/libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o
FAILED: projects/libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_19_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg/build/projects/libc/src/stdio/generic -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg/llvm-project/libc/src/stdio/generic -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg/build/projects/libc/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -fpie -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -DLIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT=100 -DLIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY=1 -std=c++17 -MD -MT projects/libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o -MF projects/libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o.d -o projects/libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg/llvm-project/libc/src/stdio/generic/fileno.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg/llvm-project/libc/src/stdio/generic/fileno.cpp:13:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg/llvm-project/libc/src/__support/File/file.h:12:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg/llvm-project/libc/hdr/stdio_macros.h:19:
In file included from /usr/include/stdio.h:42:
/usr/include/x86_64-linux-gnu/bits/types/FILE.h:7:25: error: typedef redefinition with different types ('struct _IO_FILE' vs 'struct FILE')
typedef struct _IO_FILE FILE;
                        ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg/llvm-project/libc/include/llvm-libc-types/FILE.h:12:21: note: previous definition is here
typedef struct FILE FILE;
                    ^
1 error generated.
[7/16] Building CXX object projects/libc/src/stdio/linux/CMakeFiles/libc.src.stdio.linux.fdopen.dir/fdopen.cpp.o
[8/16] Building CXX object projects/libc/src/stdio/CMakeFiles/libc.src.stdio.scanf.dir/scanf.cpp.o
[9/16] Building CXX object projects/libc/src/stdio/CMakeFiles/libc.src.stdio.fscanf.dir/fscanf.cpp.o
[10/16] Building CXX object projects/libc/src/__support/File/linux/CMakeFiles/libc.src.__support.File.linux.file.dir/file.cpp.o
[11/16] Building CXX object projects/libc/src/__support/File/CMakeFiles/libc.src.__support.File.file.dir/file.cpp.o
[12/16] Building CXX object projects/libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.vprintf.dir/vprintf.cpp.o
[13/16] Building CXX object projects/libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.printf.dir/printf.cpp.o
[14/16] Building CXX object projects/libc/src/stdio/CMakeFiles/libc.src.stdio.fprintf.dir/fprintf.cpp.o
[15/16] Building CXX object projects/libc/src/stdio/CMakeFiles/libc.src.stdio.vfprintf.dir/vfprintf.cpp.o
ninja: build stopped: subcommand failed.
['ninja', 'libc'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 164, in step
    yield
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 121, in main
    run_command(['ninja', 'libc'])
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 179, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja', 'libc']' returned non-zero exit status 1.
@@@STEP_FAILURE@@@
@@@BUILD_STEP libc-unit-tests@@@

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 11, 2024

LLVM Buildbot has detected a new failure on builder libc-x86_64-debian-dbg-runtimes-build running on libc-x86_64-debian while building libc,utils at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/78/builds/1760

Here is the relevant piece of the build log for the reference:

Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
-- check-runtimes does nothing.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/build/runtimes/runtimes-bins
[1/16] Building CXX object libc/src/wchar/CMakeFiles/libc.src.wchar.wctob.dir/wctob.cpp.o
[2/16] Building CXX object libc/src/stdio/CMakeFiles/libc.src.stdio.sscanf.dir/sscanf.cpp.o
[3/16] Building CXX object libc/src/stdio/linux/CMakeFiles/libc.src.stdio.linux.remove.dir/remove.cpp.o
[4/16] Building CXX object libc/src/__support/OSUtil/linux/CMakeFiles/libc.src.__support.OSUtil.linux.linux_util.dir/fcntl.cpp.o
[5/16] Building CXX object libc/src/unistd/linux/CMakeFiles/libc.src.unistd.linux.lseek.dir/lseek.cpp.o
[6/16] Building CXX object libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o
FAILED: libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o 
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/build/./bin/clang++ --target=x86_64-unknown-linux-gnu -DLIBC_NAMESPACE=__llvm_libc_19_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/build/runtimes/runtimes-bins/libc/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -fpie -ffixed-point -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -DLIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT=100 -DLIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY=1 -std=gnu++17 -MD -MT libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o -MF libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o.d -o libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/llvm-project/libc/src/stdio/generic/fileno.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/llvm-project/libc/src/stdio/generic/fileno.cpp:13:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/llvm-project/libc/src/__support/File/file.h:12:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/llvm-project/libc/hdr/stdio_macros.h:19:
In file included from /usr/include/stdio.h:42:
/usr/include/x86_64-linux-gnu/bits/types/FILE.h:7:25: error: typedef redefinition with different types ('struct _IO_FILE' vs 'struct FILE')
    7 | typedef struct _IO_FILE FILE;
      |                         ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/llvm-project/libc/include/llvm-libc-types/FILE.h:12:21: note: previous definition is here
   12 | typedef struct FILE FILE;
      |                     ^
1 error generated.
[7/16] Building CXX object libc/src/stdio/linux/CMakeFiles/libc.src.stdio.linux.fdopen.dir/fdopen.cpp.o
[8/16] Building CXX object libc/src/stdio/CMakeFiles/libc.src.stdio.fscanf.dir/fscanf.cpp.o
[9/16] Building CXX object libc/src/stdio/CMakeFiles/libc.src.stdio.scanf.dir/scanf.cpp.o
[10/16] Building CXX object libc/src/__support/File/linux/CMakeFiles/libc.src.__support.File.linux.file.dir/file.cpp.o
[11/16] Building CXX object libc/src/__support/File/CMakeFiles/libc.src.__support.File.file.dir/file.cpp.o
[12/16] Building CXX object libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.vprintf.dir/vprintf.cpp.o
[13/16] Building CXX object libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.printf.dir/printf.cpp.o
[14/16] Building CXX object libc/src/stdio/CMakeFiles/libc.src.stdio.vfprintf.dir/vfprintf.cpp.o
[15/16] Building CXX object libc/src/stdio/CMakeFiles/libc.src.stdio.fprintf.dir/fprintf.cpp.o
ninja: build stopped: subcommand failed.
FAILED: runtimes/CMakeFiles/libc /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/build/runtimes/CMakeFiles/libc 
cd /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/build/runtimes/runtimes-bins && /usr/bin/cmake --build /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/build/runtimes/runtimes-bins/ --target libc --config Debug
ninja: build stopped: subcommand failed.
['ninja', 'libc'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 164, in step
    yield
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 121, in main
    run_command(['ninja', 'libc'])
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 179, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
Step 6 (build libc) failure: build libc (failure)
...
-- check-runtimes does nothing.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/build/runtimes/runtimes-bins
[1/16] Building CXX object libc/src/wchar/CMakeFiles/libc.src.wchar.wctob.dir/wctob.cpp.o
[2/16] Building CXX object libc/src/stdio/CMakeFiles/libc.src.stdio.sscanf.dir/sscanf.cpp.o
[3/16] Building CXX object libc/src/stdio/linux/CMakeFiles/libc.src.stdio.linux.remove.dir/remove.cpp.o
[4/16] Building CXX object libc/src/__support/OSUtil/linux/CMakeFiles/libc.src.__support.OSUtil.linux.linux_util.dir/fcntl.cpp.o
[5/16] Building CXX object libc/src/unistd/linux/CMakeFiles/libc.src.unistd.linux.lseek.dir/lseek.cpp.o
[6/16] Building CXX object libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o
FAILED: libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o 
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/build/./bin/clang++ --target=x86_64-unknown-linux-gnu -DLIBC_NAMESPACE=__llvm_libc_19_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/build/runtimes/runtimes-bins/libc/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -fpie -ffixed-point -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -DLIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT=100 -DLIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY=1 -std=gnu++17 -MD -MT libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o -MF libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o.d -o libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/llvm-project/libc/src/stdio/generic/fileno.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/llvm-project/libc/src/stdio/generic/fileno.cpp:13:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/llvm-project/libc/src/__support/File/file.h:12:
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/llvm-project/libc/hdr/stdio_macros.h:19:
In file included from /usr/include/stdio.h:42:
/usr/include/x86_64-linux-gnu/bits/types/FILE.h:7:25: error: typedef redefinition with different types ('struct _IO_FILE' vs 'struct FILE')
    7 | typedef struct _IO_FILE FILE;
      |                         ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/llvm-project/libc/include/llvm-libc-types/FILE.h:12:21: note: previous definition is here
   12 | typedef struct FILE FILE;
      |                     ^
1 error generated.
[7/16] Building CXX object libc/src/stdio/linux/CMakeFiles/libc.src.stdio.linux.fdopen.dir/fdopen.cpp.o
[8/16] Building CXX object libc/src/stdio/CMakeFiles/libc.src.stdio.fscanf.dir/fscanf.cpp.o
[9/16] Building CXX object libc/src/stdio/CMakeFiles/libc.src.stdio.scanf.dir/scanf.cpp.o
[10/16] Building CXX object libc/src/__support/File/linux/CMakeFiles/libc.src.__support.File.linux.file.dir/file.cpp.o
[11/16] Building CXX object libc/src/__support/File/CMakeFiles/libc.src.__support.File.file.dir/file.cpp.o
[12/16] Building CXX object libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.vprintf.dir/vprintf.cpp.o
[13/16] Building CXX object libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.printf.dir/printf.cpp.o
[14/16] Building CXX object libc/src/stdio/CMakeFiles/libc.src.stdio.vfprintf.dir/vfprintf.cpp.o
[15/16] Building CXX object libc/src/stdio/CMakeFiles/libc.src.stdio.fprintf.dir/fprintf.cpp.o
ninja: build stopped: subcommand failed.
FAILED: runtimes/CMakeFiles/libc /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/build/runtimes/CMakeFiles/libc 
cd /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/build/runtimes/runtimes-bins && /usr/bin/cmake --build /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/build/runtimes/runtimes-bins/ --target libc --config Debug
ninja: build stopped: subcommand failed.
['ninja', 'libc'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 164, in step
    yield
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 121, in main
    run_command(['ninja', 'libc'])
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 179, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-runtimes-build/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)

@michaelrj-google michaelrj-google deleted the libcProxyOfft branch July 11, 2024 18:21
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 11, 2024

LLVM Buildbot has detected a new failure on builder premerge-monolithic-linux running on premerge-linux-1 while building libc,utils at step 6 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/2687

Here is the relevant piece of the build log for the reference:

Step 6 (build-unified-tree) failure: build (failure)
...
4.933 [860/58/478] Building CXX object libc/src/math/generic/CMakeFiles/libc.src.math.generic.atanhf.dir/atanhf.cpp.o
4.934 [859/58/479] Building CXX object libc/src/math/generic/CMakeFiles/libc.src.math.generic.f16fma.dir/f16fma.cpp.o
4.935 [858/58/480] Building CXX object libc/src/math/generic/CMakeFiles/libc.src.math.generic.f16sqrtl.dir/f16sqrtl.cpp.o
4.936 [857/58/481] Building CXX object libc/src/stdfix/CMakeFiles/libc.src.stdfix.exphk.dir/exphk.cpp.o
4.943 [856/58/482] Building CXX object libc/src/stdfix/CMakeFiles/libc.src.stdfix.expk.dir/expk.cpp.o
4.964 [855/58/483] Building CXX object libc/src/stdio/CMakeFiles/libc.src.stdio.sscanf.dir/sscanf.cpp.o
4.972 [854/58/484] Building CXX object libc/src/math/generic/CMakeFiles/libc.src.math.generic.explogxf.dir/explogxf.cpp.o
4.973 [853/58/485] Building CXX object libc/src/math/generic/CMakeFiles/libc.src.math.generic.f16fmal.dir/f16fmal.cpp.o
4.981 [852/58/486] Building CXX object libc/src/stdio/CMakeFiles/libc.src.stdio.scanf.dir/scanf.cpp.o
4.989 [851/58/487] Building CXX object libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o
FAILED: libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o 
/build/buildbot/premerge-monolithic-linux/build/./bin/clang++ --target=x86_64-unknown-linux-gnu -DLIBC_NAMESPACE=__llvm_libc_19_0_0_git -I/build/buildbot/premerge-monolithic-linux/llvm-project/libc -isystem /build/buildbot/premerge-monolithic-linux/build/runtimes/runtimes-bins/libc/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -fpie -ffixed-point -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -UNDEBUG -DLIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT=100 -DLIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY=1 -std=gnu++17 -MD -MT libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o -MF libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o.d -o libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.fileno.dir/fileno.cpp.o -c /build/buildbot/premerge-monolithic-linux/llvm-project/libc/src/stdio/generic/fileno.cpp
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/libc/src/stdio/generic/fileno.cpp:13:
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/libc/src/__support/File/file.h:12:
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/libc/hdr/stdio_macros.h:19:
In file included from /usr/include/stdio.h:42:
/usr/include/x86_64-linux-gnu/bits/types/FILE.h:7:25: error: typedef redefinition with different types ('struct _IO_FILE' vs 'struct FILE')
    7 | typedef struct _IO_FILE FILE;
      |                         ^
/build/buildbot/premerge-monolithic-linux/llvm-project/libc/include/llvm-libc-types/FILE.h:12:21: note: previous definition is here
   12 | typedef struct FILE FILE;
      |                     ^
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/libc/src/stdio/generic/fileno.cpp:13:
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/libc/src/__support/File/file.h:12:
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/libc/hdr/stdio_macros.h:19:
In file included from /usr/include/stdio.h:891:
/usr/include/x86_64-linux-gnu/bits/stdio.h:58:10: error: member access into incomplete type 'FILE'
   58 |   return __getc_unlocked_body (__fp);
      |          ^
/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h:103:27: note: expanded from macro '__getc_unlocked_body'
  103 |   (__glibc_unlikely ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end)        \
      |                           ^
/build/buildbot/premerge-monolithic-linux/llvm-project/libc/include/llvm-libc-types/FILE.h:12:16: note: forward declaration of 'FILE'
   12 | typedef struct FILE FILE;
      |                ^
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/libc/src/stdio/generic/fileno.cpp:13:
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/libc/src/__support/File/file.h:12:
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/libc/hdr/stdio_macros.h:19:
In file included from /usr/include/stdio.h:891:
/usr/include/x86_64-linux-gnu/bits/stdio.h:58:10: error: member access into incomplete type 'FILE'
   58 |   return __getc_unlocked_body (__fp);
      |          ^
/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h:103:50: note: expanded from macro '__getc_unlocked_body'
  103 |   (__glibc_unlikely ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end)        \
      |                                                  ^
/build/buildbot/premerge-monolithic-linux/llvm-project/libc/include/llvm-libc-types/FILE.h:12:16: note: forward declaration of 'FILE'
   12 | typedef struct FILE FILE;
      |                ^
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/libc/src/stdio/generic/fileno.cpp:13:

aaryanshukla pushed a commit to aaryanshukla/llvm-project that referenced this pull request Jul 14, 2024
reland of llvm#98215

Additionally adds proxy headers for FILE and the fopencookie types

The arm32 build has been failing due to redefinitions of the off_t type.
This patch fixes this by moving off_t to a proper proxy header. To do
this, it also moves stdio macros to a proxy header to hopefully avoid
including this proxy header alongside this public stdio.h.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bazel "Peripheral" support tier build system: utils/bazel libc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants