Subject: lib/2718: [dM] missing some prototypes
To: None <gnats-bugs@NetBSD.ORG>
From: der Mouse <mouse@Holo.Rodents.Montreal.QC.CA>
List: netbsd-bugs
Date: 08/28/1996 16:11:00
>Number:         2718
>Category:       lib
>Synopsis:       [dM] <signal.h> missing some prototypes
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 28 18:50:01 1996
>Last-Modified:
>Originator:     der Mouse
>Organization:
	Dis-
>Release:        -1.2 release branch (-current sup), 28 Aug 1996: $NetBSD: signal.h,v 1.21 1996/02/09 18:25:32 christos Exp $
>Environment:
	Any (noticed on Sun-3/260 and SPARC IPC)
>Description:
	<signal.h> is missing some prototypes; they cause trouble when
	code that uses signals is compiled with -Wmissing-prototypes
	-Wstrict-prototypes.  Specifically, SIG_DFL, SIG_IGN, and
	SIG_ERR provoke such complaints, as do the sa_handler and
	sv_handler structure elements.
>How-To-Repeat:
	% cat sigtest.c
	#include <signal.h>
	
	void foo(void);
	void foo(void)
	{
	 signal(SIGINT,SIG_IGN);
	}
	% cc -Wmissing-prototypes -Wstrict-prototypes -c sigtest.c
	sigtest.c: In function `foo':
	sigtest.c:6: warning: function declaration isn't a prototype
	% 
>Fix:
	Here's what I've been running with (based, obviously, on a
	slightly older version of <sys/signal.h>, but from the diffs,
	the difference between signal.h 1.20 and 1.21 is not relevant
	to this PR).

	Probably these should all be fixed to use __P, as in

		#define SIG_DFL (void (*)__P((int)))0

	and indeed I'll do so; however, I wanted to get this PR in
	today, and it's unlikely I'll get that done today.  If the PR
	is still open when I do get it done, I'll send in an addendum.

					der Mouse

			    mouse@collatz.mcrcim.mcgill.edu
		    01 EE 31 F6 BB 0C 34 36  00 F3 7C 5A C1 A0 67 1D

*** /sources/supped/netbsd/src/sys/sys/signal.h	Sat Feb 10 07:34:33 1996
--- /local/mouse/include/sys/signal.h	Thu Feb  1 14:47:25 1996
***************
*** 1,4 ****
! /*	$NetBSD: signal.h,v 1.21 1996/02/09 18:25:32 christos Exp $	*/
  
  /*
   * Copyright (c) 1982, 1986, 1989, 1991, 1993
--- 1,4 ----
! /*	$NetBSD: signal.h,v 1.20 1996/01/04 22:23:23 jtc Exp $	*/
  
  /*
   * Copyright (c) 1982, 1986, 1989, 1991, 1993
***************
*** 96,102 ****
  #define SIGUSR1 30	/* user defined signal 1 */
  #define SIGUSR2 31	/* user defined signal 2 */
  
- #if defined(_ANSI_SOURCE) || defined(__cplusplus) || defined(_KERNEL)
  /*
   * Language spec sez we must list exactly one parameter, even though we
   * actually supply three.  Ugh!
--- 96,101 ----
***************
*** 104,114 ****
  #define	SIG_DFL		(void (*)(int))0
  #define	SIG_IGN		(void (*)(int))1
  #define	SIG_ERR		(void (*)(int))-1
- #else
- #define	SIG_DFL		(void (*)())0
- #define	SIG_IGN		(void (*)())1
- #define	SIG_ERR		(void (*)())-1
- #endif
  
  #ifndef _ANSI_SOURCE
  typedef unsigned int sigset_t;
--- 103,108 ----
***************
*** 117,128 ****
   * Signal vector "template" used in sigaction call.
   */
  struct	sigaction {
! 	void	(*sa_handler)		/* signal handler */
! #ifdef _KERNEL
! 			    __P((int));
! #else
! 			    __P(());
! #endif
  	sigset_t sa_mask;		/* signal mask to apply */
  	int	sa_flags;		/* see signal options below */
  };
--- 111,117 ----
   * Signal vector "template" used in sigaction call.
   */
  struct	sigaction {
! 	void	(*sa_handler)(int);	/* signal handler */
  	sigset_t sa_mask;		/* signal mask to apply */
  	int	sa_flags;		/* see signal options below */
  };
***************
*** 168,179 ****
   * Signal vector "template" used in sigvec call.
   */
  struct	sigvec {
! 	void	(*sv_handler)		/* signal handler */
! #ifdef _KERNEL
! 			    __P((int));
! #else
! 			    __P(());
! #endif
  	int	sv_mask;		/* signal mask to apply */
  	int	sv_flags;		/* see signal options below */
  };
--- 157,163 ----
   * Signal vector "template" used in sigvec call.
   */
  struct	sigvec {
! 	void	(*sv_handler)(int);	/* signal handler */
  	int	sv_mask;		/* signal mask to apply */
  	int	sv_flags;		/* see signal options below */
  };
>Audit-Trail:
>Unformatted: