SIG values in driver\Platform.h

I’m working on cleaning getting rid of all warnings durings a Windows build (there are currently thousands), and I’ve found something unusual in tools\driver\Platform.h. _INC_SIGNAL is explicitly defined with a comment indicating that the purpose is so that signal.h is not included, and then specific values from signal.h are defined.

My first question is why not just include signal.h? Since there is a comment here it’s clearly intentional, so I’d like to understand the reasoning before just removing this and including signal.h. I thought maybe it was because some compilers on Windows supported signal.h and others didn’t, but then in Platform.cpp there is a comment that says “this file is only relevant for Visual C++”. So that’s not it either.

My second question is regarding the values of some of the constants. Specifically, these:

#define SIG_DFL ( (sighandler_t) -1 )

#define SIG_IGN ( (sighandler_t) -2 )

#define SIGCONT 18

#define SIGTSTP 20

These are actually not the correct values. SIG_DFL is 0, SIG_IGN is 1, SIGCONT is 19, and SIGTSTP is 18. Can I assume this is a bug? Note that, again, simply including signal.h would fix this, so this goes back to my first question about the reasoning behind not including it.


The Visual Studio signal.h does not include those signals, so that’s probably the case. I wouldn’t call it a bug.

Due to the different toolchain options available to windows, the config paths are quite messy. It would be great getting them cleaned up, but whilst we don’t have windows buildbots up I think it’s just going to end in broken TOT for at least one configuration option.


Ahh, I see. Windows signal() only supports a subset of possible signals. But still, shouldn’t the #define’d values match the numerical values on other platforms?