FreeBSD doesn't do anything wrong here, it just happens to define and use a struct thread in its own headers. The problems arise because here in LLVM we have using namespace llvm prior to including system headers, which is bad practice for precisely this reason. If we instead play by the rules and defer our using namespace llvm until after we've included the system headers then we no longer need this hack. This hack is particularly problematic by being conditional on __FreeBSD__ as of9093ba9f7e("[Support] Include Support/thread.h before api implementations (#111175)"), since on non-FreeBSD Threading.inc can reference anything in Support/thread.h, only causing errors on FreeBSD, which is precisely what happened in64be34c562("Enable using threads on z/OS (#171847)"). By deferring the using namespace llvm until after Threading.inc is included there may be build failures introduced on untested platforms due to needing to replace unqualified identifiers with qualified ones by prepending llvm::.
3.7 KiB
3.7 KiB