Subject: re: lib/36511: lcc is an ANSI C compiler for a variety of platforms
To: None <lib-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: matthew green <mrg@eterna.com.au>
List: netbsd-bugs
Date: 06/19/2007 20:30:03
The following reply was made to PR lib/36511; it has been noted by GNATS.
From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: lib-bug-people@netbsd.org, gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org
Subject: re: lib/36511: lcc is an ANSI C compiler for a variety of platforms
Date: Wed, 20 Jun 2007 06:25:52 +1000
0 tmp>cat main.c
#include <stdio.h>
int main (void)
{
printf ("Hello world\n");
return 0;
}
0 tmp>gcc main.c
0 tmp>./a.out
Hello world
0 tmp>lcc main.c
cpp: /usr/include/sys/cdefs_elf.h:67 /usr/pkg/share/lcc/include/sys/cdefs.h:21 /usr/include/stdio.h:40 main.c:1 Syntax error in #if/#elsif
1 tmp>
Can you make NetBSD include files
a bit friendlier for C compilers other that GCC?
this should be valid for an ANSI C compiler. the relevant parts are:
from <sys/cdefs.h>:
#ifdef __GNUC__
#define __GNUC_PREREQ__(x, y) \
((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || \
(__GNUC__ > (x)))
#else
#define __GNUC_PREREQ__(x, y) 0
#endif
and the usage from <sys/cdefs_elf.h>:
#if __GNUC_PREREQ__(4, 0)
so this should come out as "#if 0" for non GCC compilers. does lcc
define __GNUC__ by chance?
.mrg.