diff options
author | Mark Wielaard <mark@klomp.org> | 2020-07-19 21:51:16 +0200 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2020-07-23 22:46:46 +0200 |
commit | 15495182302edbe0142101ec3a09e478901ab994 (patch) | |
tree | 5c9815b156d25a8f5dc1d5700108e28a7866c2ba | |
parent | 4a3f7f0e4dc1ad2906d05a1014d74c4728817965 (diff) | |
download | elfutils-15495182302edbe0142101ec3a09e478901ab994.tar.gz |
Only typedef Ebl once.
Since commit 287a18452 libasm.h defines an opague Ebl handle.
This is fine, except for (internal) code that also includes libebl.h.
Since C11 having multiple typedefs for the same thing is fine, but we
do build using GNU/C99. This also allows multiple same typedefs, except
for (very) old GCCs.
This only affects internal code, since libebl.h isn't a public header.
For internal code, only add the typedef in libebl.h when libasm.h
hasn't been included. Make sure all code that includes both headers
includes libasm.h first.
Signed-off-by: Mark Wielaard <mark@klomp.org>
-rw-r--r-- | libasm/ChangeLog | 4 | ||||
-rw-r--r-- | libasm/libasmP.h | 2 | ||||
-rw-r--r-- | libebl/ChangeLog | 4 | ||||
-rw-r--r-- | libebl/libebl.h | 4 | ||||
-rw-r--r-- | tests/ChangeLog | 12 | ||||
-rw-r--r-- | tests/asm-tst1.c | 2 | ||||
-rw-r--r-- | tests/asm-tst2.c | 2 | ||||
-rw-r--r-- | tests/asm-tst3.c | 2 | ||||
-rw-r--r-- | tests/asm-tst4.c | 2 | ||||
-rw-r--r-- | tests/asm-tst5.c | 2 | ||||
-rw-r--r-- | tests/asm-tst6.c | 2 | ||||
-rw-r--r-- | tests/asm-tst7.c | 2 | ||||
-rw-r--r-- | tests/asm-tst8.c | 2 | ||||
-rw-r--r-- | tests/asm-tst9.c | 2 |
14 files changed, 33 insertions, 11 deletions
diff --git a/libasm/ChangeLog b/libasm/ChangeLog index 8ed7fc20..83a65492 100644 --- a/libasm/ChangeLog +++ b/libasm/ChangeLog @@ -1,3 +1,7 @@ +2020-07-19 Mark Wielaard <mark@klomp.org> + + * libasmP.h: Include libebl.h after libasm.h. + 2020-07-05 Mark Wielaard <mark@klomp.org> * libasm.h: Include gelf.h. diff --git a/libasm/libasmP.h b/libasm/libasmP.h index a4703fc3..53d8f3a0 100644 --- a/libasm/libasmP.h +++ b/libasm/libasmP.h @@ -31,8 +31,8 @@ #include <stdio.h> -#include "libebl.h" #include <libasm.h> +#include "libebl.h" #include "libdwelf.h" diff --git a/libebl/ChangeLog b/libebl/ChangeLog index fa6dd037..e54aa2c9 100644 --- a/libebl/ChangeLog +++ b/libebl/ChangeLog @@ -1,3 +1,7 @@ +2020-07-19 Mark Wielaard <mark@klomp.org> + + * libebl.h: Only typedef Ebl if _LIBASM_H is undefined. + 2020-06-10 Mark Wielaard <mark@klomp.org> * eblopenbackend.c (i386_init, sh_init, x86_64_init, ia64_init, diff --git a/libebl/libebl.h b/libebl/libebl.h index 06a14c45..23c0e950 100644 --- a/libebl/libebl.h +++ b/libebl/libebl.h @@ -45,8 +45,10 @@ #include "elf-knowledge.h" -/* Opaque type for the handle. */ +/* Opaque type for the handle. libasm.h defined the same thing. */ +#ifndef _LIBASM_H typedef struct ebl Ebl; +#endif #ifdef __cplusplus diff --git a/tests/ChangeLog b/tests/ChangeLog index b5d332a0..047100b0 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,15 @@ +2020-07-19 Mark Wielaard <mark@klomp.org> + + * asm-tst1.c: Include libebl.h after libasm.h. + * asm-tst2.c: Likewise. + * asm-tst3.c: Likewise. + * asm-tst4.c: Likewise. + * asm-tst5.c: Likewise. + * asm-tst6.c: Likewise. + * asm-tst7.c: Likewise. + * asm-tst8.c: Likewise. + * asm-tst9.c: Likewise. + 2020-07-05 Mark Wielaard <mark@klomp.org> * run-test-includes.sh: New test. diff --git a/tests/asm-tst1.c b/tests/asm-tst1.c index cdf2a921..d03a4361 100644 --- a/tests/asm-tst1.c +++ b/tests/asm-tst1.c @@ -20,8 +20,8 @@ #endif #include <fcntl.h> -#include ELFUTILS_HEADER(ebl) #include ELFUTILS_HEADER(asm) +#include ELFUTILS_HEADER(ebl) #include <libelf.h> #include <stdio.h> #include <string.h> diff --git a/tests/asm-tst2.c b/tests/asm-tst2.c index 9e88b70c..e65a9d2f 100644 --- a/tests/asm-tst2.c +++ b/tests/asm-tst2.c @@ -20,8 +20,8 @@ #endif #include <fcntl.h> -#include ELFUTILS_HEADER(ebl) #include ELFUTILS_HEADER(asm) +#include ELFUTILS_HEADER(ebl) #include <libelf.h> #include <stdio.h> #include <string.h> diff --git a/tests/asm-tst3.c b/tests/asm-tst3.c index 39c1d90c..e45fa16a 100644 --- a/tests/asm-tst3.c +++ b/tests/asm-tst3.c @@ -20,8 +20,8 @@ #endif #include <fcntl.h> -#include ELFUTILS_HEADER(ebl) #include ELFUTILS_HEADER(asm) +#include ELFUTILS_HEADER(ebl) #include <libelf.h> #include <stdio.h> #include <string.h> diff --git a/tests/asm-tst4.c b/tests/asm-tst4.c index 5114938b..1a05bfcc 100644 --- a/tests/asm-tst4.c +++ b/tests/asm-tst4.c @@ -20,8 +20,8 @@ #endif #include <fcntl.h> -#include ELFUTILS_HEADER(ebl) #include ELFUTILS_HEADER(asm) +#include ELFUTILS_HEADER(ebl) #include <libelf.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/asm-tst5.c b/tests/asm-tst5.c index dcb852f8..256873f0 100644 --- a/tests/asm-tst5.c +++ b/tests/asm-tst5.c @@ -20,8 +20,8 @@ #endif #include <fcntl.h> -#include ELFUTILS_HEADER(ebl) #include ELFUTILS_HEADER(asm) +#include ELFUTILS_HEADER(ebl) #include <libelf.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/asm-tst6.c b/tests/asm-tst6.c index 829cd90c..4a665ed0 100644 --- a/tests/asm-tst6.c +++ b/tests/asm-tst6.c @@ -19,8 +19,8 @@ # include <config.h> #endif -#include ELFUTILS_HEADER(ebl) #include ELFUTILS_HEADER(asm) +#include ELFUTILS_HEADER(ebl) #include <libelf.h> #include <stdio.h> #include <stdlib.h> diff --git a/tests/asm-tst7.c b/tests/asm-tst7.c index 90179769..87c21485 100644 --- a/tests/asm-tst7.c +++ b/tests/asm-tst7.c @@ -21,8 +21,8 @@ #include <fcntl.h> #include <inttypes.h> -#include ELFUTILS_HEADER(ebl) #include ELFUTILS_HEADER(asm) +#include ELFUTILS_HEADER(ebl) #include <libelf.h> #include <stdio.h> #include <unistd.h> diff --git a/tests/asm-tst8.c b/tests/asm-tst8.c index a65509fe..7dbac10f 100644 --- a/tests/asm-tst8.c +++ b/tests/asm-tst8.c @@ -21,8 +21,8 @@ #include <fcntl.h> #include <inttypes.h> -#include ELFUTILS_HEADER(ebl) #include ELFUTILS_HEADER(asm) +#include ELFUTILS_HEADER(ebl) #include <libelf.h> #include <stdio.h> #include <unistd.h> diff --git a/tests/asm-tst9.c b/tests/asm-tst9.c index 681e872d..6bec3f6e 100644 --- a/tests/asm-tst9.c +++ b/tests/asm-tst9.c @@ -21,8 +21,8 @@ #include <fcntl.h> #include <inttypes.h> -#include ELFUTILS_HEADER(ebl) #include ELFUTILS_HEADER(asm) +#include ELFUTILS_HEADER(ebl) #include <libelf.h> #include <stdio.h> #include <string.h> |