summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.opt
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2010-07-27 18:08:48 +0000
committerTom Tromey <tromey@redhat.com>2010-07-27 18:08:48 +0000
commit5283e9e1e3ce1862befdd428729c2382fa4c2d91 (patch)
treee28247d85c8f1a459d96fd9d347581df38924531 /gdb/testsuite/gdb.opt
parente992ef7345b6ff291c424cac2a056ba09102e64a (diff)
downloadbinutils-gdb-5283e9e1e3ce1862befdd428729c2382fa4c2d91.tar.gz
* gdb.opt/inline-cmds.c (ATTR): New define.
(func1): Use it. (func2): Likewise. (func3): Likewise. (outer_inline1): Likewise. (outer_inline2): Likewise. * gdb.opt/inline-bt.c (ATTR): New define. (func1): Use it. (func2): Likewise. * gdb.opt/inline-locals.c (ATTR): New define. (func1): Use it. (func2): Likewise.
Diffstat (limited to 'gdb/testsuite/gdb.opt')
-rw-r--r--gdb/testsuite/gdb.opt/inline-bt.c13
-rw-r--r--gdb/testsuite/gdb.opt/inline-bt.exp2
-rw-r--r--gdb/testsuite/gdb.opt/inline-cmds.c19
-rw-r--r--gdb/testsuite/gdb.opt/inline-locals.c13
4 files changed, 37 insertions, 10 deletions
diff --git a/gdb/testsuite/gdb.opt/inline-bt.c b/gdb/testsuite/gdb.opt/inline-bt.c
index 476421de4d1..45933d6e4fa 100644
--- a/gdb/testsuite/gdb.opt/inline-bt.c
+++ b/gdb/testsuite/gdb.opt/inline-bt.c
@@ -13,18 +13,27 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+/* This is only ever run if it is compiled with a new-enough GCC, but
+ we don't want the compilation to fail if compiled by some other
+ compiler. */
+#ifdef __GNUC__
+#define ATTR __attribute__((always_inline))
+#else
+#define ATTR
+#endif
+
int x, y;
volatile int result;
void bar(void);
-inline int func1(void)
+inline ATTR int func1(void)
{
bar ();
return x * y;
}
-inline int func2(void)
+inline ATTR int func2(void)
{
return x * func1 ();
}
diff --git a/gdb/testsuite/gdb.opt/inline-bt.exp b/gdb/testsuite/gdb.opt/inline-bt.exp
index 92f1f8aeb4e..a3e1898c08d 100644
--- a/gdb/testsuite/gdb.opt/inline-bt.exp
+++ b/gdb/testsuite/gdb.opt/inline-bt.exp
@@ -22,7 +22,7 @@ set sources [list ${fullsrcfile} ${fullsrcfile2}]
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile ${sources} ${binfile} \
- executable {debug optimize=-O2}] != "" } {
+ executable {debug optimize=-O2 additional_flags=-Winline}] != "" } {
untested inline-bt.exp
return -1
}
diff --git a/gdb/testsuite/gdb.opt/inline-cmds.c b/gdb/testsuite/gdb.opt/inline-cmds.c
index 0bdede9e843..f8775326388 100644
--- a/gdb/testsuite/gdb.opt/inline-cmds.c
+++ b/gdb/testsuite/gdb.opt/inline-cmds.c
@@ -13,6 +13,15 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+/* This is only ever run if it is compiled with a new-enough GCC, but
+ we don't want the compilation to fail if compiled by some other
+ compiler. */
+#ifdef __GNUC__
+#define ATTR __attribute__((always_inline))
+#else
+#define ATTR
+#endif
+
int x, y;
volatile int result;
@@ -20,28 +29,28 @@ void bar(void);
void marker(void);
void noinline(void);
-inline int func1(void)
+inline ATTR int func1(void)
{
bar ();
return x * y;
}
-inline int func2(void)
+inline ATTR int func2(void)
{
return x * func1 ();
}
-inline void func3(void)
+inline ATTR void func3(void)
{
bar ();
}
-inline void outer_inline1(void)
+inline ATTR void outer_inline1(void)
{
noinline ();
}
-inline void outer_inline2(void)
+inline ATTR void outer_inline2(void)
{
outer_inline1 ();
}
diff --git a/gdb/testsuite/gdb.opt/inline-locals.c b/gdb/testsuite/gdb.opt/inline-locals.c
index b3028cb7e15..2d316817db0 100644
--- a/gdb/testsuite/gdb.opt/inline-locals.c
+++ b/gdb/testsuite/gdb.opt/inline-locals.c
@@ -13,13 +13,22 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+/* This is only ever run if it is compiled with a new-enough GCC, but
+ we don't want the compilation to fail if compiled by some other
+ compiler. */
+#ifdef __GNUC__
+#define ATTR __attribute__((always_inline))
+#else
+#define ATTR
+#endif
+
int x, y;
volatile int result;
volatile int *array_p;
void bar(void);
-inline int func1(int arg1)
+inline ATTR int func1(int arg1)
{
int array[64];
array_p = array;
@@ -29,7 +38,7 @@ inline int func1(int arg1)
return x * y + array_p[0] * arg1;
}
-inline int func2(int arg2)
+inline ATTR int func2(int arg2)
{
return x * func1 (arg2);
}