Date: Thu, 25 Oct 2007 21:08:09 +0200 (CEST) From: Ed Schouten <ed@fxq.nl> To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/117510: [Patch] sys/cdefs.h lacks support for PCC Message-ID: <20071025190809.2AEE31CCC9@palm.hoeg.nl> Resent-Message-ID: <200710251910.l9PJA1PU057489@freefall.freebsd.org>
index | next in thread | raw e-mail
>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:
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071025190809.2AEE31CCC9>
