[V2,3/6] Android NDK/Clang: fix implicit macro define

Submitted by Zhang, Ning A on April 2, 2019, 2:43 a.m.

Details

Message ID 20190402024304.9899-4-ning.a.zhang@intel.com
State New
Series "patches for build CRIU with Android NDK"
Headers show

Commit Message

Zhang, Ning A April 2, 2019, 2:43 a.m.
From: Zhang Ning <ning.a.zhang@intel.com>

it reports:
criu/pie/util-vdso-elf32.c:255:8: error: implicit declaration of function 'ELF32_ST_TYPE' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                        if (ELF_ST_TYPE(sym->st_info) != STT_FUNC &&
                            ^
criu/include/util-vdso.h:72:21: note: expanded from macro 'ELF_ST_TYPE'
                        ^
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64//sysroot/usr/include/linux/elf.h:114:26: note: expanded from macro 'ELF32_ST_TYPE'
                         ^
criu/include/util-vdso.h:72:21: note: expanded from macro 'ELF_ST_TYPE'

add #ifndef to check whether these macro is already defined.

Cc: Chen Hu <hu1.chen@intel.com>
Signed-off-by: Zhang Ning <ning.a.zhang@intel.com>
---
 criu/include/util-vdso.h | 4 ++++
 1 file changed, 4 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/include/util-vdso.h b/criu/include/util-vdso.h
index 1318a595..05b8326f 100644
--- a/criu/include/util-vdso.h
+++ b/criu/include/util-vdso.h
@@ -68,8 +68,12 @@  struct vdso_maps {
 #define Word_t		Elf32_Word
 #define Dyn_t		Elf32_Dyn
 
+#ifndef ELF_ST_TYPE
 #define ELF_ST_TYPE	ELF32_ST_TYPE
+#endif
+#ifndef ELF_ST_BIND
 #define ELF_ST_BIND	ELF32_ST_BIND
+#endif
 
 #else /* CONFIG_VDSO_32 */
 

Comments

Dmitry Safonov April 2, 2019, 2:42 p.m.
On Tue, 2 Apr 2019 at 03:44, <ning.a.zhang@intel.com> wrote:
>
> From: Zhang Ning <ning.a.zhang@intel.com>
>
> it reports:
> criu/pie/util-vdso-elf32.c:255:8: error: implicit declaration of function 'ELF32_ST_TYPE' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
>                         if (ELF_ST_TYPE(sym->st_info) != STT_FUNC &&
>                             ^
> criu/include/util-vdso.h:72:21: note: expanded from macro 'ELF_ST_TYPE'
>                         ^
> /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64//sysroot/usr/include/linux/elf.h:114:26: note: expanded from macro 'ELF32_ST_TYPE'
>                          ^
> criu/include/util-vdso.h:72:21: note: expanded from macro 'ELF_ST_TYPE'
>
> add #ifndef to check whether these macro is already defined.
>
> Cc: Chen Hu <hu1.chen@intel.com>
> Signed-off-by: Zhang Ning <ning.a.zhang@intel.com>

Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com>

> ---
>  criu/include/util-vdso.h | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/criu/include/util-vdso.h b/criu/include/util-vdso.h
> index 1318a595..05b8326f 100644
> --- a/criu/include/util-vdso.h
> +++ b/criu/include/util-vdso.h
> @@ -68,8 +68,12 @@ struct vdso_maps {
>  #define Word_t         Elf32_Word
>  #define Dyn_t          Elf32_Dyn
>
> +#ifndef ELF_ST_TYPE
>  #define ELF_ST_TYPE    ELF32_ST_TYPE
> +#endif
> +#ifndef ELF_ST_BIND
>  #define ELF_ST_BIND    ELF32_ST_BIND
> +#endif
>
>  #else /* CONFIG_VDSO_32 */
>
> --
> 2.20.1
>
> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu