binutils-gdb/gdb/testsuite/gdb.base/backtrace.c
Gary Benson 7ea44a51fa 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.
2020-11-02 11:52:41 +00:00

43 lines
1.0 KiB
C

/* This testcase is part of GDB, the GNU debugger.
Copyright 2019-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/>. */
#include "../lib/attributes.h"
int __attribute__((noinline)) ATTRIBUTE_NOCLONE
baz ()
{
return 0; /* Break here. */
}
int __attribute__((noinline)) ATTRIBUTE_NOCLONE
bar ()
{
return baz ();
}
int __attribute__((noinline)) ATTRIBUTE_NOCLONE
foo ()
{
return bar ();
}
int
main ()
{
return foo ();
}