add dead and pure function qualifiers, with appropiate #ifdef's
authorChris Torek <torek@ucbvax.Berkeley.EDU>
Tue, 3 Mar 1992 12:13:28 +0000 (04:13 -0800)
committerChris Torek <torek@ucbvax.Berkeley.EDU>
Tue, 3 Mar 1992 12:13:28 +0000 (04:13 -0800)
SCCS-vsn: sys/sys/cdefs.h 7.7

usr/src/sys/sys/cdefs.h

index 3bf74c9..6804f90 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)cdefs.h     7.6 (Berkeley) %G%
+ *     @(#)cdefs.h     7.7 (Berkeley) %G%
  */
 
 #ifndef        _CDEFS_H_
  */
 
 #ifndef        _CDEFS_H_
 #endif /* !__GNUC__ */
 #endif /* !(__STDC__ || __cplusplus) */
 
 #endif /* !__GNUC__ */
 #endif /* !(__STDC__ || __cplusplus) */
 
+/*
+ * GCC has extensions for declaring functions as `pure' (always returns
+ * the same value given the same inputs, i.e., has no external state and
+ * no side effects) and `dead' (nonreturning).  These mainly affect
+ * optimization and warnings.  Unfortunately, GCC complains if these are
+ * used under strict ANSI mode (`gcc -ansi -pedantic'), hence we need to
+ * define them only if compiling without this.
+ */
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+#define __dead __volatile
+#define __pure __const
+#else
+#define __dead
+#define __pure
+#endif
+
 #endif /* !_CDEFS_H_ */
 #endif /* !_CDEFS_H_ */