[issue39961] warning: this use of "defined" may not be portable (Mac OS)

Ronald Oussoren report at bugs.python.org
Fri Nov 27 09:12:38 EST 2020


Ronald Oussoren <ronaldoussoren at mac.com> added the comment:

This is incompatibility between upstream clang and Apple's headers. The same warning is not present when using Xcode's compiler.

As a workaround this warning can be disabled when including pthread.h, something like:

```
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wexpansion-to-defined"
#endif

#include <pthread.h>

#ifdef __clang__
#pragma clang diagnostic pop
#endif
```

I won't create a PR for this because I don't have homebrew on my systems.

Alternatively build with "-Wno-expansion-to-defined" in CFLAGS.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39961>
_______________________________________


More information about the Python-bugs-list mailing list