From owner-cvs-all Fri Sep 13 4: 4:19 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 94C0637B400; Fri, 13 Sep 2002 04:04:10 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0C65E43E3B; Fri, 13 Sep 2002 04:04:09 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id VAA03512; Fri, 13 Sep 2002 21:04:06 +1000 Date: Fri, 13 Sep 2002 21:08:42 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: "David E. O'Brien" Cc: cvs-committers@FreeBSD.org, Subject: Re: cvs commit: src/contrib/gcc/config freebsd-spec.h In-Reply-To: <200209121605.g8CG5vVT091346@freefall.freebsd.org> Message-ID: <20020913203222.U9654-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 12 Sep 2002, David E. O'Brien wrote: > obrien 2002/09/12 09:05:57 PDT > > Modified files: > contrib/gcc/config freebsd-spec.h > Log: > Try to detect support for the `long long' type so that ANSI-C[89] clean > code will know not to try to use `long long'. > Unfortunately the GCC spec parser will not allow us to properly detect the > "iso9899:1990" and "iso9899:199409" forms of the acceptable -std= arguments, > because of the ':' in the -std argument. :-( I have left them in the spec > as a place holder in hopes someone knows a way to make the detection of > them work. > > Desired by: wollman Not wanted by: bde. Whether reasonably non-archaic versions of gcc support the long long mistake is very easy to determine using existing macros. There are 3 cases: (1) long long supported because the compiler is a non-archaic version of gcc without any standards restrictions: _GNUC_ >= 2 && !defined(__STRICT_ANSI__) (2) long long not supported because the compiler is gcc restricted to c89: defined(__GNUC__) && defined(__STRICT_ANSI__) && \ __STDC_VERSION__ < 199901 (3) long long supported because the compiler is gcc-3 or any other compiler that supports c99: __STDC_VERSION__ >= 199901 Determining whether compilers other than non-archaic versions of gcc and tools like lint support long long is not so easy. I think we should use the simple binary condition _STDC_VERSION__ >= 199901. The code for this is much simpler than its description: %%% Index: cdefs.h =================================================================== RCS file: /home/ncvs/src/sys/sys/cdefs.h,v retrieving revision 1.59 diff -u -2 -r1.59 cdefs.h --- cdefs.h 15 Jul 2002 16:44:07 -0000 1.59 +++ cdefs.h 13 Sep 2002 11:01:06 -0000 @@ -134,6 +134,5 @@ #endif -/* XXX: should use `#if __STDC_VERSION__ >= 199901'. */ -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +#if __GNUC__ >= 2 && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901 #define __LONG_LONG_SUPPORTED #endif %%% Using the new feature in the specs would not affect this in any way unless it were used (then it would add a redundant condition). An ifdef like the above is still needed to handle compilers other than hacked versions of gcc, including all old and unhacked gcc ports. Other C99 features like __func and restrict require slightly different and maybe messier ifdefs. I think we should use the simple c99 condition for these and not provide special support for them with old versions of gcc like we do now. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message