*BSD News Article 57819


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!spool.mu.edu!howland.reston.ans.net!blackbush.xlink.net!rz.uni-karlsruhe.de!news.uni-stuttgart.de!schweikh
From: schweikh@itosun.ito.uni-stuttgart.de (Jens Schweikhardt)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Bogus gcc warning for SIG_DFL
Date: 2 Jan 1996 22:53:39 GMT
Organization: Comp.Center (RUS), U of Stuttgart, FRG
Lines: 29
Message-ID: <4ccd1j$1l8i@info4.rus.uni-stuttgart.de>
NNTP-Posting-Host: itosun.ito.uni-stuttgart.de

Hello,

Using SIG_DFL and compiling with -Wall gives a bogous warning.  For

        #include <signal.h>
        ...
        signal (SIGALRM, SIG_DFL);

gcc -Wall says
main.c:46: warning: function declaration isn't a prototype

grepping for the SIG_DFL macro I find

 /usr/include/sys/signal.h:#define       SIG_DFL         (void (*)(int))0
 /usr/include/sys/signal.h:#define       SIG_DFL         (void (*)())0

of which two the latter one is the culprit; it is an oldstyle cast.
The first define is only taken when _ANSI_SOURCE is defined before
inclusion of <signal.h>. Alas, defining _ANSI_SOURCE lets hell break
lose: 50% of what's in <stdlib.h> is not prototyped anymore.

I wonder why SIG_DFL is defined differently at all, depending on _ANSI_SOURCE.
The 'native' gcc is an ANSI compiler, so why worry about providing an old style
cast? Someone care to explain?

Bye, Jens

-- 
SIGSIG -- signature too long (core dumped)