[libc-commits] [PATCH] D158774: [libc] Add GPU support for `printf` and `fprintf`
Michael Jones via Phabricator via libc-commits
libc-commits at lists.llvm.org
Wed Sep 6 11:17:58 PDT 2023
michaelrj added inline comments.
================
Comment at: libc/src/stdio/gpu/file.h:2
+//===--- GPU helper functions
+//----------------------------------------------===//
//
----------------
nit: formatting
================
Comment at: libc/src/stdio/gpu/parser.h:103
+ if (format[cur_pos] == '.')
+ while (format[cur_pos] != '\0' && is_precision(format[cur_pos]))
+ ++cur_pos;
----------------
This should be
```
if(format[cur_pos] == '.'){
++cur_pos;
while (format[cur_pos] != '\0' && isdigit(format[cur_pos]))
++cur_pos;
}
```
A solo `.` is an acceptable precision, but `..1` is not.
================
Comment at: libc/src/stdio/gpu/parser.h:142
+ cur_pos++;
+ LengthModifier lm = parse_length_modifier();
+
----------------
instead of having all of the flag/width/precision parsing in `parse_length_modifier` wouldn't it be better to put those out here? That would also let you skip those parsing steps when `unfinished` is set.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158774/new/
https://reviews.llvm.org/D158774
More information about the libc-commits
mailing list