[libc-commits] [PATCH] D77626: [libc] Add very basic stdio FILE and fwrite

Alex Brachet via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Apr 13 10:12:24 PDT 2020


abrachet marked 6 inline comments as done.
abrachet added inline comments.


================
Comment at: libc/config/linux/api.td:23
+  let Decl = [{
+    typedef void FILE;
+  }];
----------------
MaskRay wrote:
> You can just use the real underlying type `typedef struct _IO_FILE FILE;`
> 
> It is not required to be complete.
I've gone with `typedef struct FILE FILE`


================
Comment at: libc/src/stdio/FILE.h:20
+
+struct FILE {
+  mtx_t lock;
----------------
MaskRay wrote:
> `FILE` needs to be a typedef to a struct.
This is an internal (C++) header.


================
Comment at: libc/src/stdio/FILE.h:24
+  void *cookie;
+  cookie_write_function_t *write;
+};
----------------
MaskRay wrote:
> fopencookie is a use case. The type does not need to mention `cookie_*`.
 `cookie_write_function_t` is a type which must be exposed for `fopencookie`. That doesn't mean we need to refer to the internal type by that name though so I have just called it `write_function_t`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77626/new/

https://reviews.llvm.org/D77626





More information about the libc-commits mailing list