[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 00:29:49 PDT 2020


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


================
Comment at: libc/config/linux/api.td:23
+  let Decl = [{
+    typedef struct {} FILE;
+  }];
----------------
sivachandra wrote:
> I understand all public API deals with `FILE*`. But, would an empty struct trigger an incorrect optimization in user code somewhere? I have no idea, but just checking since such a thought comes to my mind.
Actually it turns out that empty struct is undefined behavior in C. I've used void here, which will of course fail if someone does `FILE f`. Which I think is preferable, but we can make it a complete object type like `int` if thats better.


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

https://reviews.llvm.org/D77626





More information about the libc-commits mailing list