Work around compilation failure with old Apple SDKs#6602
Conversation
When building fish-shell with the macOS 10.12 SDK, <sys/proc.h> does not include <sys/time.h> but references `struct itimerval`. This causes a compilation failure if we don't import <sys/time.h> ourselves. This was previously masked by an import of <sys/sysctl.h>, which was removed in fc0c39b.
| #include <procfs.h> | ||
| #endif | ||
| #if __APPLE__ | ||
| #include <sys/time.h> // Required to build with old SDK versions |
There was a problem hiding this comment.
possibly make this an IWYU pragma?
There was a problem hiding this comment.
I'm not set up to run IWYU so I don't know if it would even flag this. We do use something from this file, it's just that in newer SDKs it's redundant because <sys/proc.h> includes it.
|
Could hide it behind a check specifically for the 10.12 SDK or older before including it. Not really going to make a difference though. |
|
@floam I don't know which SDK added the |
|
SGTM! I think we're definitely going to have to do a 3.1.1, so I'll add this to the milestone and cherry-pick it when I get a chance. |
|
I've just merged this now, as-is, because it fixes what it purports properly. I think we'd have to re-check a bunch of includes anyway if we reran IWYU (I think the last time was in 2017?). |
When building fish-shell with the macOS 10.12 SDK,
<sys/proc.h>does not include<sys/time.h>but referencesstruct itimerval. This causes a compilation failure if we don't import<sys/time.h>ourselves.This was previously masked by an import of
<sys/sysctl.h>, which was removed in fc0c39b.This fixes a build failure when building Fish using Nix, as Nix is currently on the macOS 10.12 SDK.