aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib/attributes.h
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2020-11-02 11:52:41 +0000
committerGary Benson <gbenson@redhat.com>2020-11-02 11:52:41 +0000
commit7ea44a51faeb81644eeb14f06db15cfb4a65d59e (patch)
tree296dff3206b8fc96bfca3fa0a8f8d690d98f9fb4 /gdb/testsuite/lib/attributes.h
parentab8f783d7ad51895d961b1bc6b82abcd8118e9a1 (diff)
downloadbinutils-7ea44a51faeb81644eeb14f06db15cfb4a65d59e.zip
binutils-7ea44a51faeb81644eeb14f06db15cfb4a65d59e.tar.gz
binutils-7ea44a51faeb81644eeb14f06db15cfb4a65d59e.tar.bz2
Fix testcases using __attribute__((noclone)) with Clang
Clang fails to compile a number of files with the following warning: unknown attribute 'noclone' ignored [-Wunknown-attributes]. This commit adds a new header, lib/noclone.h, which defines the macro ATTRIBUTE_NOCLONE accordingly, and updates the relevant testcases to use it. gdb/testsuite/ChangeLog: * lib/attributes.h: New header. * gdb.base/backtrace.c: Include the above. Replace __attribute__(noclone)) with ATTRIBUTE_NOCLONE. * gdb.base/infcall-nested-structs.c: Likewise. * gdb.base/vla-optimized-out.c: Likewise.
Diffstat (limited to 'gdb/testsuite/lib/attributes.h')
-rw-r--r--gdb/testsuite/lib/attributes.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/attributes.h b/gdb/testsuite/lib/attributes.h
new file mode 100644
index 0000000..b66567c
--- /dev/null
+++ b/gdb/testsuite/lib/attributes.h
@@ -0,0 +1,40 @@
+/* This file is part of GDB, the GNU debugger.
+
+ Copyright (C) 2020 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Compatibility macro for __attribute__((noclone)). */
+
+#ifndef ATTRIBUTES_H
+#define ATTRIBUTES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __has_attribute
+# if !__has_attribute (noclone)
+# define ATTRIBUTE_NOCLONE
+# endif
+#endif
+#ifndef ATTRIBUTE_NOCLONE
+# define ATTRIBUTE_NOCLONE __attribute__((noclone))
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ATTRIBUTES_H */