================
@@ -0,0 +1,23 @@
+//===-- Implementation of ferror for baremetal ------------------*- C++ 
-*-===//
+//
+// 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 "src/stdio/ferror.h"
+
+#include "hdr/types/FILE.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(int, ferror, (::FILE * stream)) {
+  (void)stream;
+  // TODO: Shall we have an embeddeding API for ferror?
----------------
smithp35 wrote:

Difficult to answer the embedding API question without a bit more context. I 
guess this is aimed the middle-tier described in 
https://discourse.llvm.org/t/rfc-implementation-of-stdio-on-baremetal/86944 

Presumably the state could be tracked internally with some kind of a FILE* -> 
State structure, or it could be stored in the FILE struct (if needed) and 
manipulated by an embedding API to set it.

The former would minimise the complexity of the embedding API, at the expense 
of some flexibility for those that don't need it. It maybe that the size that 
the extra state takes up is sufficiently small that it isn't worth the 
complexity.








https://github.com/llvm/llvm-project/pull/168931
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to