diff options
author | Pino Toscano <[email protected]> | 2015-06-26 20:36:01 +0200 |
---|---|---|
committer | Mark Wielaard <[email protected]> | 2015-06-27 14:56:12 +0200 |
commit | 65251494ae6eae66bfdf9134189fd11b1ee8e9b5 (patch) | |
tree | fb82fd40028bc0216e429aba592f918791edff0b | |
parent | faf0d3d73dd8e97218e09d631e1305e5ff1c89e2 (diff) |
Reduce scope of some includes
Use some includes only according to the #ifdef block of the respective
code, or matching the fact they are Linux-only. This way, includes
potentially unportable are not unconditionally used.
Signed-off-by: Pino Toscano <[email protected]>
-rw-r--r-- | backends/ChangeLog | 4 | ||||
-rw-r--r-- | backends/i386_initreg.c | 2 | ||||
-rw-r--r-- | tests/ChangeLog | 7 | ||||
-rw-r--r-- | tests/backtrace-data.c | 2 | ||||
-rw-r--r-- | tests/backtrace.c | 2 | ||||
-rw-r--r-- | tests/deleted.c | 2 |
6 files changed, 18 insertions, 1 deletions
diff --git a/backends/ChangeLog b/backends/ChangeLog index fe61d9cc..c95e80f1 100644 --- a/backends/ChangeLog +++ b/backends/ChangeLog @@ -1,3 +1,7 @@ +2015-06-26 Pino Toscano <[email protected]> + + * i386_initreg.c: Reduce scope of some includes to match their usage. + 2015-04-28 Mark Wielaard <[email protected]> * aarch64_reloc.def: Drop "64" from TLS_DTPMOD64, TLS_DTPREL64 and diff --git a/backends/i386_initreg.c b/backends/i386_initreg.c index 51fd9ea6..c3442823 100644 --- a/backends/i386_initreg.c +++ b/backends/i386_initreg.c @@ -30,7 +30,7 @@ # include <config.h> #endif -#if defined __i386__ || defined __x86_64__ +#if (defined __i386__ || defined __x86_64__) && defined(__linux__) # include <sys/types.h> # include <sys/user.h> # include <sys/ptrace.h> diff --git a/tests/ChangeLog b/tests/ChangeLog index 34f89cc4..3a7d3125 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,10 @@ +2015-06-26 Pino Toscano <[email protected]> + + * tests/backtrace-data.c: Reduce scope of some includes to match their + usage. + * tests/backtrace.c: Likewise. + * tests/deleted.c: Likewise. + 2015-06-16 Mark Wielaard <[email protected]> * run-strip-test.sh: Add strip-in-place (eu-strip without -o) test diff --git a/tests/backtrace-data.c b/tests/backtrace-data.c index 5a93a9cc..bc5ceba0 100644 --- a/tests/backtrace-data.c +++ b/tests/backtrace-data.c @@ -30,6 +30,7 @@ #include <error.h> #include <unistd.h> #include <dwarf.h> +#if defined(__x86_64__) && defined(__linux__) #include <sys/resource.h> #include <sys/ptrace.h> #include <signal.h> @@ -39,6 +40,7 @@ #include <fcntl.h> #include <string.h> #include ELFUTILS_HEADER(dwfl) +#endif #if !defined(__x86_64__) || !defined(__linux__) diff --git a/tests/backtrace.c b/tests/backtrace.c index abd56ab6..12476430 100644 --- a/tests/backtrace.c +++ b/tests/backtrace.c @@ -27,6 +27,7 @@ #include <error.h> #include <unistd.h> #include <dwarf.h> +#ifdef __linux__ #include <sys/resource.h> #include <sys/ptrace.h> #include <signal.h> @@ -37,6 +38,7 @@ #include <string.h> #include <argp.h> #include ELFUTILS_HEADER(dwfl) +#endif #ifndef __linux__ diff --git a/tests/deleted.c b/tests/deleted.c index d071bf79..6be35bc2 100644 --- a/tests/deleted.c +++ b/tests/deleted.c @@ -23,7 +23,9 @@ #include <stdio.h> #include <error.h> #include <errno.h> +#ifdef __linux__ #include <sys/prctl.h> +#endif extern void libfunc (void); |