[libc-commits] [libc] [libc] Implement fileno on Linux (PR #85628)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Mon Mar 18 09:12:27 PDT 2024


================
@@ -0,0 +1,20 @@
+//===-- Implementation of fileno
+//-------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "include/llvm-libc-types/FILE.h"
+#include "src/stdio/fileno.h"
+#include "src/__support/File/file.h"
----------------
nickdesaulniers wrote:

ah, sorry, my previous suggestion was bad. This should be:

```suggestion
#include "src/stdio/fileno.h"

#include "include/llvm-libc-types/FILE.h"
#include "src/__support/File/file.h"
```

We always want to include the .cpp's corresponding .h first, as then subsequent includes can sometimes be skipped by the preprocessor.

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


More information about the libc-commits mailing list