This is an archive of the discontinued LLVM Phabricator instance.

[libc] Add implementations of fopen, flose, fread, fwrite and fseek.
ClosedPublic

Authored by sivachandra on Mar 23 2022, 9:57 AM.

Details

Summary

A follow up patch will add feof and ferror.

Diff Detail

Event Timeline

sivachandra created this revision.Mar 23 2022, 9:57 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 23 2022, 9:57 AM
sivachandra requested review of this revision.Mar 23 2022, 9:57 AM
michaelrj added inline comments.Mar 23 2022, 10:41 AM
libc/src/stdio/fopen.h
16

why does this need to specifically be a global namespace FILE?

libc/src/stdio/fseek.h
16

the other FILEs are specifically global, if that is necessary then this one should be too.

Qualify all uses of FILE with "::".

sivachandra added inline comments.Mar 23 2022, 4:40 PM
libc/src/stdio/fopen.h
16

To make it absolutely clear that we are indeed referring to the public FILE type and not one in the namespace __llvm_libc. We don't have one in __llvm_libc, but qualification makes it clear.

libc/src/stdio/fseek.h
16

Add :: to all references to FILE in src/stdio.

lntue accepted this revision.Mar 23 2022, 4:58 PM
This revision is now accepted and ready to land.Mar 23 2022, 4:58 PM
libc/test/src/stdio/fileop_test.cpp