misc/74159: Warnings concerned with header files

Satoshi Kimura satosi.kimura at nifty.ne.jp
Sat Nov 20 05:50:19 PST 2004


>Number:         74159
>Category:       misc
>Synopsis:       Warnings concerned with header files
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Nov 20 13:50:18 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Satoshi Kimura
>Release:        FreeBSD 4.9
>Organization:
personal use
>Environment:
FreeBSD 4.9-RELEASE #0: Wed Oct 29 02:43:54 2003
    root at kcesx20.koganemaru.co.jp:/usr/src/sys/compile/GENERIC98

>Description:
      Use following source "sample.c" as an example.
#include <stdio.h>
#include <sys/kbio.h>
#include <machine/mouse.h>

int main(void) { }

If compile it with "-Wundef" option like
% /usr/bin/gcc -Wundef sample.c -o sample 
following warnings were shown.

> In file included from /usr/include/stdio.h:43,
>                  from sample.c:2:
> /usr/include/sys/cdefs.h:273: warning: `_POSIX_C_SOURCE' is not defined
> /usr/include/sys/cdefs.h:279: warning: `_POSIX_C_SOURCE' is not defined
> In file included from sample.c:3:
> /usr/include/sys/kbio.h:24: warning: `notdef' is not defined
> /usr/include/sys/kbio.h:64: warning: `notdef' is not defined
> /usr/include/sys/kbio.h:214: warning: `notdef' is not defined
> In file included from sample.c:4:
> /usr/include/machine/mouse.h:44: warning: `notyet' is not defined

>How-To-Repeat:
      See above example.
Or, for example, at making XFree86 or Xorg, warning concerned with
cdefs.h were shown about 4,000 times! (16,000 lines!)

>Fix:
      To avoid these warnings, modify some header files as follows.
(1) /usr/include/sys/cdefs.h
#if _POSIX_C_SOURCE == 1
is to be modified to
#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE == 1

(2) /usr/include/sys/kbio.h
#if notdef
is to be modified to
#if defined notdef && notdef
or probably to
#ifdef notdef

(3) /usr/include/machine/mouse.h
#if notyet
is to be modified to
#if defined notyet && notyet
or probably to
#ifdef notyet

Following patch is available for all modifications.
begin 644 patch.gz
M'XL("$W.D4$``W!A=&-H`)V376^B0!2&K_%7G,2DW591&*FM)DUDA6V,50S0
M=/>*(`XR*64:P37NK]\9H/+AQVYZH\G,>\Z<]^$]HBA"O(^[W at K[<2?HT,U:
ML+<8#"\!]`"2-$2]H2(!DJ1>H]5JE<7"*U[!G/X&60*Y/[Q#0Z7/A4IC-`(1
MW4MMN0>M_'\T:@#<=AO0 at .XM:- at -84>2`":ZKH.5K#JLB]3KR*(\&$AM(!'L
M`N(%X"P,:_+3&3N6\6*.=7A\!+G#&XE-XI^\;;3X#1N11&R^NN+JZG01-+<1
MJZE?"@*;=K&A2W<9[H&$(5Z[81N6VP26>$^C%7CNAD1KB. at N'0N:V<O"42-N
M3!HP`8Y6Q/\7",1!H,L at T$40Z"L at T#D0EXVADC$QC]3;DM#_352FK0=*&2)4
M"I3<OF=QXK\\3/DX,-5F4]N8ZX(S,;Y=3Z_;\,#`<G`)HW.3<XXQ!H]&,0UQ
M)P"?;B`)<,:&)(1=`/73(Y^&(=WQ+TJHEX3Q at 7!$$R:O,LW..,K\MC35DV[/
M#"T=R\SF&J1#W91%5B'*-,QY9?B2]+MA:KI9DO8J4HZHGR+J'R-B[YBJ5M3V
M[[_`Z`RB+Q,R5<O.#+U^FF>;'WL;)R9_L).2^MR5+`!Y`C[]%<T8[!]3_9>0
M-F.XWU at WULM_PWMWLW;*T*T34KDB+9E)U[_*A;F]Z/!D13'HQ'"LL3F?J8L\
M&?Q]E-I^=S\JDRZJVM=,VZMJBYU[=[V`E77?Z3;&9Q=/+A:O5G"\?7=*L7U*
MREZI1VMFO%BZ8^JJ9MFJK1^HSO@>MB%MO7(3MV*L*-)46ZW4#.HUAZ^QQ\D1
M>':6@^>WM?X\\[IE/+_8$V.>`YRE*:OOX4%OC=7GR?RI+);/BLV#WUR*<NE?
(W)%#/50'````
`
end


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list