Subject: lib/1071: Compile warnings in C++ startup code
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: Thorsten Lockert <tholo@SigmaSoft.COM>
List: netbsd-bugs
Date: 05/19/1995 21:20:06
>Number: 1071
>Category: lib
>Synopsis: Compile warnings in C++ startup code
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: lib-bug-people (Library Bug People)
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Fri May 19 21:20:06 1995
>Originator: Thorsten Lockert
>Organization:
SigmaSoft, Th. Lockert
>Release: May 7th, 1995
>Environment:
System: NetBSD gandalf.sigmasoft.com 1.0A NetBSD 1.0A (GANDALF) #1: Sun May 7 21:49:27 PDT 1995 tholo@gandalf.sigmasoft.com:/usr/src/sys/arch/i386/compile/GANDALF i386
>Description:
There are compile-time warnings in the C++ startup code if
compiled with -Wall and -Wstrict-prototypes. Also, the code
does not follow NetBSD's coding convention wrt. function
declarations.
>How-To-Repeat:
Add "-Wall -Wstrict-prototypes" to src/lib/csu/Makefile and
recompile
>Fix:
Apply the following patch:
--- src/lib/csu/c++/c++rt0.c.main Fri May 19 20:38:35 1995
+++ src/lib/csu/c++/c++rt0.c Fri May 19 20:44:19 1995
@@ -38,11 +38,16 @@
* number of pointers in each.
* The tables are also null-terminated.
*/
-void (*__CTOR_LIST__[0])(void);
-void (*__DTOR_LIST__[0])(void);
+#include <stdlib.h>
+
+static void __ctors __P((void));
+static void __dtors __P((void));
+
+void (*__CTOR_LIST__[0]) __P((void));
+void (*__DTOR_LIST__[0]) __P((void));
static void
-__dtors(void)
+__dtors()
{
unsigned long i = (unsigned long) __DTOR_LIST__[0];
void (**p)(void) = __DTOR_LIST__ + i;
@@ -52,18 +57,18 @@
}
static void
-__ctors(void)
+__ctors()
{
- void (**p)(void) = __CTOR_LIST__ + 1;
+ void (**p) __P((void)) = __CTOR_LIST__ + 1;
while (*p)
(**p++)();
}
-extern void __init() asm(".init");
+extern void __init __P((void)) asm(".init");
void
-__init(void)
+__init()
{
static int initialized = 0;
>Audit-Trail:
>Unformatted: