From owner-freebsd-bugs@FreeBSD.ORG Thu Oct 25 19:10:01 2007 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF13316A41B for ; Thu, 25 Oct 2007 19:10:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 9055313C4BB for ; Thu, 25 Oct 2007 19:10:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l9PJA1NS057490 for ; Thu, 25 Oct 2007 19:10:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l9PJA1PU057489; Thu, 25 Oct 2007 19:10:01 GMT (envelope-from gnats) Resent-Date: Thu, 25 Oct 2007 19:10:01 GMT Resent-Message-Id: <200710251910.l9PJA1PU057489@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Ed Schouten Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDE5716A419 for ; Thu, 25 Oct 2007 19:08:11 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:610:652::211]) by mx1.freebsd.org (Postfix) with ESMTP id 750FB13C4A6 for ; Thu, 25 Oct 2007 19:08:11 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 2AEE31CCC9; Thu, 25 Oct 2007 21:08:09 +0200 (CEST) Message-Id: <20071025190809.2AEE31CCC9@palm.hoeg.nl> Date: Thu, 25 Oct 2007 21:08:09 +0200 (CEST) From: Ed Schouten To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: kern/117510: [Patch] sys/cdefs.h lacks support for PCC X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Ed Schouten List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Oct 2007 19:10:01 -0000 >Number: 117510 >Category: kern >Synopsis: [Patch] sys/cdefs.h lacks support for PCC >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Oct 25 19:10:01 UTC 2007 >Closed-Date: >Last-Modified: >Originator: Ed Schouten >Release: FreeBSD 6.2-STABLE i386 >Organization: >Environment: System: FreeBSD palm.hoeg.nl 6.2-STABLE FreeBSD 6.2-STABLE #0: Mon Sep 10 21:37:34 CEST 2007 root@palm.hoeg.nl:/usr/obj/usr/src/sys/PALM i386 >Description: I'm filing this under kern, as it affects the src/sys/ directory. The current sys/cdefs.h file lacks support for PCC, which means that when users install PCC from ports, they have a compiler that isn't really useful. >How-To-Repeat: >Fix: The following patch is incomplete, but already fixes the __packed attribute. I'm currently discussing on the mailing list how to implement __aligned() and __section(), but those can wait for now. It would be wonderful if this would already make it into RELENG_7, because then FreeBSD users can already start tinkering around with PCC on an unpatched install. A cool thing is: when you apply this patch, all apps in src/bin/ compile without a flaw! :-) --- src/sys/sys/cdefs.h 2006-09-21 03:38:58.000000000 +0200 +++ src/sys/sys/cdefs.h 2007-10-17 19:56:42.000000000 +0200 @@ -111,7 +111,7 @@ /* * Macro to test if we're using a specific version of gcc or later. */ -#if defined(__GNUC__) && !defined(__INTEL_COMPILER) +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__PCC__) #define __GNUC_PREREQ__(ma, mi) \ (__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi)) #else @@ -140,7 +140,7 @@ #define __const const /* define reserved names to standard */ #define __signed signed #define __volatile volatile -#if defined(__cplusplus) +#if defined(__cplusplus) || defined(__PCC__) #define __inline inline /* convert to C++ keyword */ #else #if !(defined(__CC_SUPPORTS___INLINE)) @@ -221,6 +221,15 @@ #define __aligned(x) __attribute__((__aligned__(x))) #define __section(x) __attribute__((__section__(x))) #endif +#if defined(__PCC__) +#define __dead2 +#define __pure2 +#define __unused +#define __used +#define __packed _Pragma("packed") +#define __aligned(x) +#define __section(x) +#endif #endif #if __GNUC_PREREQ__(2, 96) >Release-Note: >Audit-Trail: >Unformatted: