[libc-commits] [libc] [libc] Make hdrgen support macro_header YAML field. (PR #123265)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Fri Jan 17 10:41:40 PST 2025


nickdesaulniers wrote:

> This is used for dlfcn.h, which previously bogusly redefined the RTLD_* macros to empty.

/nods yeah that's silly.

Looking into what `macro_value` is...perhaps we can just remove that entirely?  It's only used in stdio, threads, dlfcn and I don't see a good reason why.

The current convention is that if one of these .h files defines macros, then we have (stdio example):

libc/include/stdio.h.def `#include "include/llvm-libc-macros/stdio-macros.h"` 

so I don't see the _point_ of `macro_value` at all.

`macro_value` also breaks the convention I'm using in docgen to detect if we define a macro or not (for a macro defined in stdio.h, I grep libc/llvm-libc-macros/stdio-macros.h for it).

So that's 2 reasons to remove `macro_value` from hdrgen.

If we remove `macro_value`, and clean up places where we're not sticking to convention (which breaks macro definition detection for docgen), then I don't think we need `macro_header` either.

https://github.com/llvm/llvm-project/pull/123265


More information about the libc-commits mailing list