[libc-commits] [PATCH] D156480: [libc] Add support for more file functions

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Jul 27 13:17:42 PDT 2023


jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, tianshilei1992, lntue, sivachandra, michaelrj.
Herald added projects: libc-project, All.
Herald added a subscriber: libc-commits.
jhuber6 requested review of this revision.

This patch adds support for more trivial file functions. This leaves out
specifically `fgets`. This is because as implemented this does not have
the correct behavior as it does not stop on EOF or newline since we map
it all to `fread`. This will probably need to be fixed somehow.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156480

Files:
  libc/config/gpu/entrypoints.txt
  libc/docs/gpu/support.rst
  libc/test/src/stdio/CMakeLists.txt


Index: libc/test/src/stdio/CMakeLists.txt
===================================================================
--- libc/test/src/stdio/CMakeLists.txt
+++ libc/test/src/stdio/CMakeLists.txt
@@ -233,7 +233,7 @@
     libc.src.stdio.fopen
 )
 
-add_libc_unittest(
+add_libc_test(
   putc_test
   SUITE
     libc_stdio_unittests
@@ -265,7 +265,7 @@
   )
 endif()
 
-add_libc_unittest(
+add_libc_test(
   fgetc_test
   SUITE
     libc_stdio_unittests
Index: libc/docs/gpu/support.rst
===================================================================
--- libc/docs/gpu/support.rst
+++ libc/docs/gpu/support.rst
@@ -126,4 +126,13 @@
 fputs          |check|    |check|
 fclose         |check|    |check|
 fopen          |check|    |check|
+putc           |check|    |check|
+putchar        |check|    |check|
+feof           |check|
+ferror         |check|
+fgetc          |check|    |check|
+fputc          |check|    |check|
+fwrite         |check|    |check|
+getchar        |check|    |check|
+getc           |check|    |check|
 =============  =========  ============
Index: libc/config/gpu/entrypoints.txt
===================================================================
--- libc/config/gpu/entrypoints.txt
+++ libc/config/gpu/entrypoints.txt
@@ -82,10 +82,19 @@
 
     # stdio.h entrypoints
     libc.src.stdio.puts
+    libc.src.stdio.putc
+    libc.src.stdio.putchar
     libc.src.stdio.fputs
     libc.src.stdio.fread
+    libc.src.stdio.feof
+    libc.src.stdio.ferror
+    libc.src.stdio.fgetc
+    libc.src.stdio.fputc
     libc.src.stdio.fclose
     libc.src.stdio.fopen
+    libc.src.stdio.fwrite
+    libc.src.stdio.getchar
+    libc.src.stdio.getc
     libc.src.stdio.stdin
     libc.src.stdio.stdout
     libc.src.stdio.stderr


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156480.544904.patch
Type: text/x-patch
Size: 1739 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230727/68bb74c1/attachment.bin>


More information about the libc-commits mailing list