Module Name: src
Committed By: kamil
Date: Sun Sep 15 14:30:26 UTC 2019
Modified Files:
src/sys/sys: cdefs.h
Log Message:
Add Clang/LLVM specific feature/extension detection macros in sys/cdefs.h
These macros are not supported (as of now) with GCC and there is need to
maintain a fallback that evaluates to 0.
To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/sys/cdefs.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/sys/cdefs.h
diff -u src/sys/sys/cdefs.h:1.141 src/sys/sys/cdefs.h:1.142
--- src/sys/sys/cdefs.h:1.141 Thu Feb 21 21:34:05 2019
+++ src/sys/sys/cdefs.h Sun Sep 15 14:30:26 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ */
+/* $NetBSD: cdefs.h,v 1.142 2019/09/15 14:30:26 kamil Exp $ */
/* * Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -60,6 +60,24 @@
#define __GNUC_PREREQ__(x, y) 0
#endif
+/*
+ * Macros to test Clang/LLVM features.
+ * Usage:
+ *
+ * #if __has_feature(safe_stack)
+ * ...SafeStack specific code...
+ * #else
+ * ..regular code...
+ * #endif
+ */
+#ifndef __has_feature
+#define __has_feature(x) 0
+#endif
+
+#ifndef __has_extension
+#define __has_extension __has_feature /* Compat with pre-3.0 Clang */
+#endif
+
#include <machine/cdefs.h>
#ifdef __ELF__
#include <sys/cdefs_elf.h>