Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/sys Add Clang/LLVM specific feature/extension detection ...
details: https://anonhg.NetBSD.org/src/rev/f9d7c4cb9ab1
branches: trunk
changeset: 459538:f9d7c4cb9ab1
user: kamil <kamil%NetBSD.org@localhost>
date: Sun Sep 15 14:30:26 2019 +0000
description:
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.
diffstat:
sys/sys/cdefs.h | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
diffs (34 lines):
diff -r 3b3dcd431222 -r f9d7c4cb9ab1 sys/sys/cdefs.h
--- a/sys/sys/cdefs.h Sun Sep 15 13:40:46 2019 +0000
+++ b/sys/sys/cdefs.h Sun Sep 15 14:30:26 2019 +0000
@@ -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>
Home |
Main Index |
Thread Index |
Old Index