[clang] [clang][PP] Add extension to predefine target OS macros (PR #74676)

Zixu Wang via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 17 09:49:46 PST 2024


zixu-w wrote:

> > It looks like this breaks building at least `MultiSource` from https://github.com/llvm/llvm-test-suite/. The first failure I see is when building `llvm-test-suite/MultiSource/Applications/ClamAV/zlib_zutil.c`
> > ```
> > In file included from /llvm-test-suite/MultiSource/Applications/ClamAV/zlib_zutil.c:10:
> > In file included from test-suites/llvm-test-suite/MultiSource/Applications/ClamAV/zlib/gzguts.h:21:
> > ../usr/include/stdio.h:220:7: error: expected identifier or '('
> >   220 | FILE    *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen));
> >       |          ^
> > llvm-test-suite/MultiSource/Applications/ClamAV/zlib/zutil.h:140:33: note: expanded from macro 'fdopen'
> >   140 | #        define fdopen(fd,mode) NULL /* No fdopen() */
> >       |                                 ^
> > llvm-project/builds/release-with-assertions/ccache-stage1/lib/clang/18/include/__stddef_null.h:26:16: note: expanded from macro 'NULL'
> >    26 | #define NULL ((void*)0)
> >       |                ^
> > ```
> 
> These are actually part of zlib, so apart from llvm test suite having been broken by this (but was fixed), plain zlib has been broken too (although arguably, zlib is where the real issue is).

We have provided a fix for zlib (https://github.com/madler/zlib/pull/895) which was accepted by @madler.

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


More information about the cfe-commits mailing list