[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libunwind-devel] [PATCH 44/57] Define and use `NOINLINE'
From: |
Tommi Rantala |
Subject: |
[Libunwind-devel] [PATCH 44/57] Define and use `NOINLINE' |
Date: |
Fri, 21 Sep 2012 14:11:45 +0300 |
---
include/compiler.h | 2 ++
tests/Gperf-simple.c | 7 ++++---
tests/Gperf-trace.c | 7 ++++---
tests/Ltest-varargs.c | 14 +++++---------
tests/crasher.c | 12 +++++-------
5 files changed, 20 insertions(+), 22 deletions(-)
diff --git a/include/compiler.h b/include/compiler.h
index f519877..e15f7a7 100644
--- a/include/compiler.h
+++ b/include/compiler.h
@@ -33,6 +33,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. */
#ifdef __GNUC__
# define ALIGNED(x) __attribute__((aligned(x)))
# define UNUSED __attribute__((unused))
+# define NOINLINE __attribute__((noinline))
# define NORETURN __attribute__((noreturn))
# define ALIAS(name) __attribute__((alias (#name)))
# if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
@@ -55,6 +56,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. */
# define ALIGNED(x)
# define ALWAYS_INLINE
# define UNUSED
+# define NOINLINE
# define NORETURN
# define ALIAS(name)
# define HIDDEN
diff --git a/tests/Gperf-simple.c b/tests/Gperf-simple.c
index ab46008..2173406 100644
--- a/tests/Gperf-simple.c
+++ b/tests/Gperf-simple.c
@@ -27,6 +27,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. */
#include <unistd.h>
#include <libunwind.h>
+#include "compiler.h"
#include <sys/resource.h>
#include <sys/time.h>
@@ -53,7 +54,7 @@ gettime (void)
return tv.tv_sec + 1e-6*tv.tv_usec;
}
-static int __attribute__((noinline))
+static int NOINLINE
measure_unwind (int maxlevel, double *step)
{
double stop, start;
@@ -88,7 +89,7 @@ measure_unwind (int maxlevel, double *step)
static int f1 (int, int, double *);
-static int __attribute__((noinline))
+static int NOINLINE
g1 (int level, int maxlevel, double *step)
{
if (level == maxlevel)
@@ -98,7 +99,7 @@ g1 (int level, int maxlevel, double *step)
return f1 (level + 1, maxlevel, step) + level;
}
-static int __attribute__((noinline))
+static int NOINLINE
f1 (int level, int maxlevel, double *step)
{
if (level == maxlevel)
diff --git a/tests/Gperf-trace.c b/tests/Gperf-trace.c
index 7e95e66..cc4fac6 100644
--- a/tests/Gperf-trace.c
+++ b/tests/Gperf-trace.c
@@ -27,6 +27,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. */
#include <unistd.h>
#include <libunwind.h>
+#include "compiler.h"
#include <sys/resource.h>
#include <sys/time.h>
@@ -53,7 +54,7 @@ gettime (void)
return tv.tv_sec + 1e-6*tv.tv_usec;
}
-static int __attribute__((noinline))
+static int NOINLINE
measure_unwind (int maxlevel, double *step)
{
double stop, start;
@@ -74,7 +75,7 @@ measure_unwind (int maxlevel, double *step)
static int f1 (int, int, double *);
-static int __attribute__((noinline))
+static int NOINLINE
g1 (int level, int maxlevel, double *step)
{
if (level == maxlevel)
@@ -84,7 +85,7 @@ g1 (int level, int maxlevel, double *step)
return f1 (level + 1, maxlevel, step) + level;
}
-static int __attribute__((noinline))
+static int NOINLINE
f1 (int level, int maxlevel, double *step)
{
if (level == maxlevel)
diff --git a/tests/Ltest-varargs.c b/tests/Ltest-varargs.c
index aeb0ba8..755bd1d 100644
--- a/tests/Ltest-varargs.c
+++ b/tests/Ltest-varargs.c
@@ -1,5 +1,7 @@
#define UNW_LOCAL_ONLY
#include <libunwind.h>
+#include "compiler.h"
+
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@@ -8,13 +10,7 @@
int ok;
int verbose;
-#ifdef __GNUC__
-void a (int, ...) __attribute__((noinline));
-void b (void) __attribute__((noinline));
-void c (void) __attribute__((noinline));
-#endif
-
-void
+void NOINLINE
b (void)
{
void *v[20];
@@ -33,13 +29,13 @@ b (void)
printf ("[%d] %p\n", i, v[i]);
}
-void
+void NOINLINE
c (void)
{
b ();
}
-void
+void NOINLINE
a (int d, ...)
{
switch (d)
diff --git a/tests/crasher.c b/tests/crasher.c
index 9a005b9..2cf65e8 100644
--- a/tests/crasher.c
+++ b/tests/crasher.c
@@ -1,5 +1,7 @@
/* This program should crash and produce coredump */
+#include "compiler.h"
+
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
@@ -85,24 +87,20 @@ write_maps(char *fname)
#endif
#ifdef __GNUC__
-int a(void) __attribute__((noinline));
-int b(int x) __attribute__((noinline));
-int c(int x) __attribute__((noinline, alias("b")));
+int c(int x) NOINLINE __attribute__((alias("b")));
#define compiler_barrier() asm volatile("");
#else
-int a(void);
-int b(int x);
int c(int x);
#define compiler_barrier()
#endif
-int a(void)
+int NOINLINE a(void)
{
*(volatile int *)32 = 1;
return 1;
}
-int b(int x)
+int NOINLINE b(int x)
{
int r;
--
1.7.9.5
- [Libunwind-devel] [PATCH 56/57] Add arguments to malloc and calloc prototypes in Ltest-nocalloc, (continued)
- [Libunwind-devel] [PATCH 56/57] Add arguments to malloc and calloc prototypes in Ltest-nocalloc, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 55/57] Remove unused variable in Ltest-nocalloc, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 53/57] Prefer NULL over zero, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 35/57] SuperH port, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 47/57] Plug in `ALIAS' attribute, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 42/57] IA64: constify read only arrays in `tdep_init()', Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 45/57] Define and use `WEAK', Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 46/57] Define and use `CONST_ATTR', Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 43/57] Plug in `ARRAY_SIZE' in ptrace code, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 57/57] Assign `func' just once in Ltest-nocalloc glibc case, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 44/57] Define and use `NOINLINE',
Tommi Rantala <=