lkml.org 
[lkml]   [1996]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: ideas
Excerpts from mail: 7-May-96 Re: ideas by Alan Cox@lxorguk.ukuu.or 
> Its actually meant to be buildable under g++ currently. Thats why we don't
> have variables called new or lines like
>
> v=8//**/
> -4;

That's obviously a good start, but it looks like there's still a lot of
work to be done before g++ is happy. (Most of the below is warnings,
but it does complain about a few switch statements which could let some
input fall through, casting from void *'s to char *'s (why would anyone
use void* like that?) etc.) Here's output from just init/main.c:

g++ -D__KERNEL__ -I/mnt/new/tmp/linux/include -Wall -Wstrict-prototypes
-O2 -fomit-frame-pointer -fno-strength-reduce -pipe -m486 -DCPU=486 -c
-o init/main.o init/main.c
In file included from /mnt/new/tmp/linux/include/linux/sched.h:18,
from init/main.c:19:
/mnt/new/tmp/linux/include/linux/personality.h:26: parse error before
string constant
/mnt/new/tmp/linux/include/linux/personality.h:36: syntax error before `;'
/mnt/new/tmp/linux/include/linux/personality.h:49: parse error before
string constant
/mnt/new/tmp/linux/include/asm/string.h: In function `void *
__constant_memcpy(void *, const void *, unsigned int)':
In file included from /mnt/new/tmp/linux/include/linux/string.h:38,
from /mnt/new/tmp/linux/include/asm/termios.h:58,
from /mnt/new/tmp/linux/include/linux/termios.h:5,
from /mnt/new/tmp/linux/include/linux/tty.h:20,
from /mnt/new/tmp/linux/include/linux/sched.h:25,
from init/main.c:19:
/mnt/new/tmp/linux/include/asm/string.h:443: warning: control reaches
end of non-void function `__constant_memcpy(void *, const void *,
unsigned int)'
/mnt/new/tmp/linux/include/asm/string.h: In function `void *
__constant_c_and_count_memset(void *, long unsigned int, unsigned int)':
/mnt/new/tmp/linux/include/asm/string.h:592: warning: control reaches
end of non-void function `__constant_c_and_count_memset(void *, long
unsigned int, unsigned int)'
/mnt/new/tmp/linux/include/linux/sched.h: In function `void
select_wait(struct wait_queue **, struct select_table_struct *)':
In file included from init/main.c:19:
/mnt/new/tmp/linux/include/linux/sched.h:478: warning: comparison
between signed and unsigned
/mnt/new/tmp/linux/include/linux/mm.h: In function `int
expand_stack(struct vm_area_struct *, long unsigned int)':
In file included from init/main.c:32:
/mnt/new/tmp/linux/include/linux/mm.h:321: warning: comparison between
signed and unsigned
/mnt/new/tmp/linux/include/asm/bugs.h: In function `void no_halt(char *,
int *)':
In file included from init/main.c:39:
/mnt/new/tmp/linux/include/asm/bugs.h:19: warning: unused parameter `char * s'
/mnt/new/tmp/linux/include/asm/bugs.h:19: warning: unused parameter `int
* ints'
/mnt/new/tmp/linux/include/asm/bugs.h: In function `void no_387(char *,
int *)':
/mnt/new/tmp/linux/include/asm/bugs.h:24: warning: unused parameter `char * s'
/mnt/new/tmp/linux/include/asm/bugs.h:24: warning: unused parameter `int
* ints'
init/main.c: In function `void profile_setup(char *, int *)':
init/main.c:221: warning: unused parameter `char * str'
init/main.c: In function `void calibrate_delay()':
init/main.c:465: warning: comparison between signed and unsigned
init/main.c:482: warning: comparison between signed and unsigned
init/main.c:485: warning: comparison between signed and unsigned
init/main.c: In function `void parse_root_dev(char *)':
init/main.c:502: warning: non-static const member `int const
parse_root_dev(char *)::dev_name_struct::num' in class without a
constructor
init/main.c: In function `int cpu_idle(void *)':
init/main.c:646: warning: unused parameter `void * unused'
init/main.c: In function `int do_rc(void *)':
init/main.c:843: warning: ANSI C++ forbids implicit conversion from
`void *' in argument passing
init/main.c: In function `int do_shell(void *)':
init/main.c:855: warning: ANSI C++ forbids implicit conversion from
`void *' in argument passing
init/main.c: In function `int init(void *)':
init/main.c:878: warning: unused parameter `void * unused'
make: *** [init/main.o] Error 1


> > alone should be more than enough reason to periodically compile the
> > kernel w/ g++ to make sure there aren't any subtle type errors. In a
>
> Yes. Although gcc -Wall -pedantic is a pretty good checker for most
> things.

Good point - How different is gcc with those parameters from g++ in its
type checking? Do prototypes like int foo(); suspend type-checking or
anything along those lines?

> > good safety measure. There's even a chance it could improve some code
> > by pointing out which parameters weren't used in a function. While it
> > doesn't guarantee good code, it does prevent sloppy code from causing
> > problems.
>
> No arguments.



\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.232 / U:2.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site