[libcxx-commits] [PATCH] D151046: [libcxx][tests] Introduce 32-bit feature and use it for stringstream gcount test

Azat Khuzhin via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon May 22 22:25:21 PDT 2023


azat added inline comments.


================
Comment at: libcxx/utils/libcxx/test/features.py:385
+
+  Feature(name='32-bit', when=lambda cfg: int(compilerMacros(cfg)['__SIZEOF_SIZE_T__']) == 4),
 ]
----------------
ldionne wrote:
> azat wrote:
> > azat wrote:
> > > ldionne wrote:
> > > > Mordante wrote:
> > > > > I'm not convinced we should rely on `__SIZEOF_SIZE_T__` being available at least we should test here it's defined. (Alternatively we do a runtime test, for an example see `has-unix-headers`.)
> > > > I would try using a runtime test that checks the result of `sizeof(void*) == 4`.
> > > >I'm not convinced we should rely on __SIZEOF_SIZE_T__ being available at least we should test here it's defined. (Alternatively we do a runtime test, for an example see has-unix-headers.)
> > > 
> > > I guess a simple fallback to `0` will work, rebased.
> > @ldionne Ok, I could use this, but can you elaborate why `int(compilerMacros(cfg).get('__SIZEOF_SIZE_T__', 0)) == 4` is not good, just to understand is there any difference? (since actually that test relies on the `size_t` size, but this feature flag is about 32-bit architecture so I'm fine both ways)
> Using `sizeof(void*)` would work regardless of the compiler though.
>I'm not convinced we should rely on __SIZEOF_SIZE_T__ being available at least we should test here it's defined. (Alternatively we do a runtime test, for an example see has-unix-headers.)

@Mordante BTW it is defined in `clang/lib/Frontend/InitPreprocessor.cpp`, so it should always be defined.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151046



More information about the libcxx-commits mailing list