Subject: bin/2304: kernel main may want a return type (?)
To: None <gnats-bugs@NetBSD.ORG>
From: Peter Seebach <seebs@taniemarie.solon.com>
List: netbsd-bugs
Date: 04/05/1996 21:17:20
>Number: 2304
>Category: bin
>Synopsis: gcc warning for non-int main can't build a kernel.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Fri Apr 5 22:35:02 1996
>Last-Modified:
>Originator: Peter Seebach
>Organization:
Usenet Fact Police (Undercover)
>Release: -current
>Environment:
System: NetBSD taniemarie 1.1A NetBSD 1.1A (SEEBS) #0: Sat Mar 9 11:19:31 CST 1996 seebs@taniemarie:/usr/src/sys/arch/amiga/compile/SEEBS amiga
>Description:
If gcc is patched to warn for non-int main()s, and we have -Werror,
the kernel can't build.
>How-To-Repeat:
See a previous patch relating to main return types.
>Fix:
Apply this patch.
This is obviously "wrong" - gcc should have a switch for compiling
in freestanding environments vs. hosted ones. Adding a switch to
gcc is more than I think is safe. Since this is harmless, for now,
I prefer this.
Since gcc won't warn about the unusual arguments, why worry? Nothing
wrong with it as it is.
A "better" patch might be renaming `main' in the kernel, but this
introduces its own problems.
*** init_main.old Fri Apr 5 21:11:12 1996
--- init_main.c Fri Apr 5 21:11:40 1996
***************
*** 112,118 ****
static void start_init __P((struct proc *));
static void start_pagedaemon __P((struct proc *));
! void main __P((void *));
#ifdef cpu_set_init_frame
void *initframep; /* XXX should go away */
--- 112,118 ----
static void start_init __P((struct proc *));
static void start_pagedaemon __P((struct proc *));
! int main __P((void *));
#ifdef cpu_set_init_frame
void *initframep; /* XXX should go away */
***************
*** 148,154 ****
* hard work is done in the lower-level initialization routines including
* startup(), which does memory initialization and autoconfiguration.
*/
! void
main(framep)
void *framep; /* XXX should go away */
{
--- 148,154 ----
* hard work is done in the lower-level initialization routines including
* startup(), which does memory initialization and autoconfiguration.
*/
! int
main(framep)
void *framep; /* XXX should go away */
{
***************
*** 369,374 ****
--- 369,375 ----
/* The scheduler is an infinite loop. */
scheduler();
/* NOTREACHED */
+ return 1; /* failure, if we get here. */
}
/*
>Audit-Trail:
>Unformatted: