Wouldn't it be better to check for __STDC_VERSION__ >= 199901L rather than a list of compilers? (I don't have a source tree close by which is why I don't have a patch.)
2013/11/23 Daniel Dickman <[email protected]> > I'm trying to port compcert to openbsd. Here's a first patch to allow > jot to be compiled with compcert. > > Before the patch is applied compcert fails because _Bool is predefined as > per C99: > > # ccomp -fall -c /usr/src/usr.bin/jot/jot.c > /usr/include/stdbool.h:20: Error: illegal combination of type specifiers. > Fatal error. > 1 error detected. > *** Error 2 in /usr/src/usr.bin/jot (<sys.mk>:87 'jot.o') > # > > After the patch below is applied: > > # ccomp -fall -c /usr/src/usr.bin/jot/jot.c > # > > > Index: include/stdbool.h > =================================================================== > RCS file: /home/cvs/src/include/stdbool.h,v > retrieving revision 1.5 > diff -u -p -u -r1.5 stdbool.h > --- include/stdbool.h 24 Jul 2010 22:17:03 -0000 1.5 > +++ include/stdbool.h 23 Nov 2013 22:38:23 -0000 > @@ -10,7 +10,7 @@ > > #ifndef __cplusplus > > -#if (defined(__GNUC__) && __GNUC__ >= 3) || defined(__PCC__) || > defined(lint) > +#if (defined(__GNUC__) && __GNUC__ >= 3) || defined(__COMPCERT__) || > defined(__PCC__) || defined(lint) > /* Support for _C99: type _Bool is already built-in. */ > #define false 0 > #define true 1 > Index: sys/sys/types.h > =================================================================== > RCS file: /home/cvs/src/sys/sys/types.h,v > retrieving revision 1.39 > diff -u -p -u -r1.39 types.h > --- sys/sys/types.h 14 Sep 2013 01:35:02 -0000 1.39 > +++ sys/sys/types.h 23 Nov 2013 22:40:59 -0000 > @@ -241,7 +241,7 @@ struct uio; > #endif > > #ifdef _KERNEL > -#if (defined(__GNUC__) && __GNUC__ >= 3) || defined(__PCC__) || > defined(lint) > +#if (defined(__GNUC__) && __GNUC__ >= 3) || defined(__COMPCERT__) || > defined(__PCC__) || defined(lint) > /* Support for _C99: type _Bool is already built-in. */ > #define false 0 > #define true 1 > >
