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: Christos Zoulas <christos@zoulas.com>
List: netbsd-bugs
Date: 06/19/2007 21:10:09
The following reply was made to PR lib/36511; it has been noted by GNATS.

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, lib-bug-people@netbsd.org,
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Cc: 
Subject: Re: lib/36511: lcc is an ANSI C compiler for a variety of platforms
Date: Tue, 19 Jun 2007 17:09:03 -0400

 On Jun 19,  8:15pm, cheusov@tut.by (cheusov@tut.by) wrote:
 -- Subject: lib/36511: lcc is an ANSI C compiler for a variety of platforms
 
 | 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>
 
 Works fine for me after I change <sys/cdefs.h> to read:
 
 #if !defined(_STANDALONE) && !defined(_KERNEL)
 #ifdef __GNUC__
 #define __RENAME(x)     ___RENAME(x)
 #else
 #ifdef __lint__
 #define __RENAME(x)     __symbolrename(x)
 #else
 +#ifdef __LCC__
 +#define __RENAME(x)
 +#else
 #error "No function renaming possible"
 +#endif /* __lcc__ */    
 #endif /* __lint__ */
 #endif /* __GNUC__ */
 #else /* _STANDALONE || _KERNEL */
 #define __RENAME(x)     no renaming in kernel or standalone environment
 #endif
 
 My etc/netbsd.c is in http://www.zoulas.com/NetBSD/lcc/netbsd.c and:
 
 [5:08pm] 10308>lcc -v hello.c
 lcc $Id: lcc.c,v 4.33 2001/06/28 22:19:58 drh Exp $
 /u/christos/lcc/x86-netbsd/cpp -U__GNUC__ -D_POSIX_SOURCE -D__STDC__=1 -D__STRICT_ANSI__ -Dunix -Di386 -Dlinux -D__unix__ -D__i386__ -D__NetBSD__ -D__signed__=signed -D__LCC__ -I/u/christos/lcc/x86-netbsd/include -I/usr/include hello.c /tmp/lcc123110.i
 /u/christos/lcc/x86-netbsd/rcc -target=x86/linux -v /tmp/lcc123110.i /tmp/lcc123111.s
 /u/christos/lcc/x86-netbsd/rcc $Name:  $($Id: main.c,v 1.2 2003/10/20 17:54:27 drh Exp $)
 /usr/bin/as -o /tmp/lcc123112.o /tmp/lcc123111.s
 /usr/bin/ld -m elf_i386 -dynamic-linker /usr/libexec/ld.elf_so -o a.out /usr/lib/crt0.o /usr/lib/crti.o /usr/lib/crtbegin.o /tmp/lcc123112.o -L/u/christos/lcc/x86-netbsd/ -llcc -L/usr/lib -lgcc -lc -lm /usr/lib/crtend.o /usr/lib/crtn.o
 rm /tmp/lcc123112.o /tmp/lcc123110.i /tmp/lcc123111.s
 [5:08pm] 10309>./a.out 
 hello world
 
 christos