Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Mar 2003 19:49:45 +0100
From:      "Simon 'corecode' Schubert" <corecode@corecode.ath.cx>
To:        standards@freebsd.org
Cc:        Mike Barcroft <mike@freebsd.org>, markm@freebsd.org
Subject:   Re: cvs commit: src/sys/sys stat.h
Message-ID:  <20030306194945.126c092f.corecode@corecode.ath.cx>
In-Reply-To: <200302262010.h1QKAsMT007004@repoman.freebsd.org>
References:  <200302262010.h1QKAsMT007004@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--=.n.n8Fy3e('0fOY
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Lately Mike Barcroft told:

> mike        2003/02/26 12:10:54 PST
> 
>   Modified files:
>     sys/sys              stat.h 
>   Log:
>   Change spelling of `u_int' to `unsigned int' in the POSIX case.

if this catched the POSIX case it would be good. bad thing is it doesn't
catch it. imagine:

% cat <<EOF > stattest.c
#define	_XOPEN_SOURCE	600

#include <sys/types.h>
#include <sys/stat.h>
EOF
% cc -c stattest.c
In file included from stattest.c:4:
/usr/include/sys/stat.h:127: syntax error before "u_int"
/usr/include/sys/stat.h:158: syntax error before "u_int"

problem here is: _XOPEN_SOURCE defines _POSIX_C_SOURCE but NOT
_POSIX_SOURCE which is being checked for in many places in the source
tree:

% grep -r '#if.*_POSIX_SOURCE' /usr/include | wc -l
      73

a possible fix could be:

Index: sys/sys/cdefs.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/cdefs.h,v
retrieving revision 1.68
diff -u -r1.68 cdefs.h
--- sys/sys/cdefs.h	21 Oct 2002 20:50:30 -0000	1.68
+++ sys/sys/cdefs.h	6 Mar 2003 17:35:23 -0000
@@ -341,6 +341,8 @@
 #define	_POSIX_C_SOURCE		198808
 #endif
 #ifdef _POSIX_C_SOURCE
+#undef _POSIX_SOURCE
+#define	_POSIX_SOURCE		1
 #if _POSIX_C_SOURCE >= 200112
 #define	__POSIX_VISIBLE		200112
 #define	__ISO_C_VISIBLE		1999

but as i'm writing this patch shows other (mis?)usage of _POSIX_SOURCE:
[snip math.h]
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
#define M_E             2.7182818284590452354   /* e */
[...]

now stuff breaks here. what's the proper fix? changing all headers so
that _POSIX_SOURCE isn't used anymore (only _POSIX_VISIBLE and/or
_POSIX_C_SOURCE)?

cheers
  simon

ps: please cc me as i'm not subscribed. reply-to headers set tho

-- 
/"\   http://corecode.ath.cx/#donate
\ /
 \     ASCII Ribbon Campaign
/ \  Against HTML Mail and News

--=.n.n8Fy3e('0fOY
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQE+Z5hNr5S+dk6z85oRAurKAKD1rcPV5eU9TJ1igy5Yxv7Q2VJtSwCfWKx4
3Peu5stNFxtrGl6v3+qryp4=
=ZJSJ
-----END PGP SIGNATURE-----

--=.n.n8Fy3e('0fOY--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-standards" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030306194945.126c092f.corecode>