Marcin Dalecki <[EMAIL PROTECTED]> writes:
> Trying to use a compiler different from GCC I have found the folowing error
> 
> "/usr/include/sys/syslimits.h", line 42: Error:
>    [ISO 6.8]: Unknown preprocessing directive, '#warning'.
> 
> I think that somthing like to above should not appear in system
> headers.

This is a bug in TenDRA.  It looks in conditionals that don't apply
for syntax errors.  I use the attached workaround on my system to
support TenDRA.

Best regards,
Mike Barcroft
Index: cdefs.h
===================================================================
RCS file: /work/repo/src/sys/sys/cdefs.h,v
retrieving revision 1.68
diff -u -r1.68 cdefs.h
--- cdefs.h     21 Oct 2002 20:50:30 -0000      1.68
+++ cdefs.h     14 Dec 2002 16:46:57 -0000
@@ -113,27 +113,27 @@
  * in a different (wrong) way).  If we do not provide an implementation
  * for a given compiler, let the compile fail if it is told to use
  * a feature that we cannot live without.
+ *
+ * XXX the check for lint here is incorrect, since either your lint supports
+ * GNUC or it doesn't.  Some kernel source code is very GNUC-centric, so we
+ * need this hack here until those GNUCisms are fixed.  In reality, having
+ * hacks like this usually extend the life of bugs.
  */
-#ifdef lint
+#if defined(lint)
 #define        __dead2
 #define        __pure2
 #define        __unused
 #define        __packed
 #define        __aligned(x)
 #define        __section(x)
-#else
-#if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 5
-#define        __dead2
-#define        __pure2
-#define        __unused
-#endif
-#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7
+/* Older GCC versions default to NOP for everything. */
+#elif __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7
 #define        __dead2         __attribute__((__noreturn__))
 #define        __pure2         __attribute__((__const__))
-#define        __unused
+/* XXX __aligned() is too critical to working code to safely be defined away. */
+#define        __aligned(x)
 /* XXX Find out what to do for __packed, __aligned and __section */
-#endif
-#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3
+#elif __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3
 #define        __dead2         __attribute__((__noreturn__))
 #define        __pure2         __attribute__((__const__))
 #define        __unused        __attribute__((__unused__))
@@ -141,6 +141,25 @@
 #define        __aligned(x)    __attribute__((__aligned__(x)))
 #define        __section(x)    __attribute__((__section__(x)))
 #endif
+
+/*
+ * Default to NOP for compiler-dependent extentions.
+ * XXX missing __aligned(), since we can't safely define it away.
+ */
+#ifndef __dead2
+#define        __dead2
+#endif
+#ifndef __packed
+#define        __packed
+#endif
+#ifndef __pure2
+#define        __pure2
+#endif
+#ifndef __section
+#define        __section(x)
+#endif
+#ifndef __unused
+#define        __unused
 #endif
 
 /* XXX: should use `#if __STDC_VERSION__ < 199901'. */
@@ -226,6 +245,14 @@
  * The alternative is: #define __IDSTRING(name,string)  [nothing]
  */
 #define        __IDSTRING(name,string) static const char name[] __unused = string
+#endif
+
+/*
+ * TenDRA looks inside conditionals that don't apply (ie. #if __GNUC__).
+ * #warning is the most likely cause of syntax errors, so work around this.
+ */
+#ifdef __TenDRA__
+#pragma        TenDRA directive warning (ignore) allow
 #endif
 
 /*

Reply via email to