[libc-commits] [PATCH] D148069: [LIBC] Implement remainder of posix 'sched.h' minus `SCHED_SPORADIC`

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Apr 20 11:38:23 PDT 2023


michaelrj added inline comments.


================
Comment at: libc/spec/posix.td:640
       [], // Macros
-      [PidT, SizeTType, CpuSetT], // Types
+      [PidT, TimeTType, StructTimeSpec, StructSchedParam], // Types
       [], // Enumerations
----------------
goldstein.w.n wrote:
> michaelrj wrote:
> > this should still have `CpuSetT` in the Types list since it's used by `sched_getcpucount`
> sched_getcpucount is gnu extension though. We have `CpuSetT` in gnu.td.
ah, you're right. Nevermind then.


================
Comment at: libc/spec/posix.td:646
             RetValSpec<IntType>,
             []
         >,
----------------
goldstein.w.n wrote:
> michaelrj wrote:
> > not relevant for this patch, but in a future patch it would be good to add the argument `ArgSpect<VoidType>` here. In C a function with no arguments is interpreted as having unspecified parameters, whereas a function with an argument of `void` has no arguments.
> +1, is there an issue we add it now (not supported), or just leave it as todo?
> 
> As an side, what are these files for? I've had bugs in them but libc compiled fine /tests ran.
You can fix it now or leave a TODO and fix it in a followup patch, either works.

These files are used to generate the header files in fullbuild mode. We have a TableGen based utility called HeaderGen that takes in the `api.td` file for the platform you're building for. Then the `api.td` file includes these files in the `spec` folder. These files tell HeaderGen what the function prototypes for each function are, and which header file they go in. Then the `entrypoints.txt` and `headers.txt` files determine which functions and headers should be built for this specific platform. If you want to see the header files then build `libc-headers` and look in `build/projects/libc/include`, though make sure you've set `LLVM_LIBC_FULL_BUILD` to `ON` in your cmake. If you want to test that these work, then run the `libc-api-test` which uses the `PrototypeTestGen` (in `libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp`) to **generate** the **prototypes** for each function, then **test** that they match the implementation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148069



More information about the libc-commits mailing list