On Thu, May 15, 2014 at 12:20:06PM +0400, Yury Gribov wrote: > On 05/15/2014 12:05 PM, Konstantin Serebryany wrote: > >No. We have to support too many build systems and hence do not want > >any configure step. > >All configuration has to be done in the sources. > > Yeah, I see your point. But filling code with magic constants isn't > very nice either. > > We could make a separate CMake check like GetTargetStructSize or > something (somewhere in projects/compiler-rt/make/platform/*.mk).
Also, I'd suggest to have a look at glibc or libgomp how a directory system with easily overridable target specific headers is way better than a maze of #ifdefs all around the source. I mean glibc sysdeps/ stuff or libgomp config/ stuff (the latter is far more limited of course). So, individual structures/constants/defines (or related groups thereof) could be split into separate headers, and have target specific set of -I arguments added by the Makefile/CMake, so that you can have some defaults, some per-CPU defaults, some OS defaults and some per-CPU OS defaults. Say, you could have a header file with layout of kernel stat structure, one for Linux, another one for Darwin, another one for Windows, and then if say on ppc64-linux it is different, it could supply it's own file that would override the generic Linux one. Jakub