bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: malloc-h: Fix compilation error in C++ mode on Android


From: Bruno Haible
Subject: Re: malloc-h: Fix compilation error in C++ mode on Android
Date: Mon, 09 Jan 2023 21:22:56 +0100

I wrote:
> +
> +#@INCLUDE_NEXT@ @NEXT_MALLOC_H@
> +
> +#else
> +/* Normal invocation convention.  */
> +
> +#ifndef _@GUARD_PREFIX@_MALLOC_H
> +
> +#define _GL_ALREADY_INCLUDING_MALLOC_H
> +
>  /* The include_next requires a split double-inclusion guard.  */
>  #if @HAVE_MALLOC_H@
>  # @INCLUDE_NEXT@ @NEXT_MALLOC_H@

For better portability, these @INCLUDE_NEXT@ @NEXT_MALLOC_H@ lines should
be written differently:


2023-01-09  Bruno Haible  <bruno@clisp.org>

        malloc-h: Improve portability.
        * lib/malloc.in.h: Use INCLUDE_NEXT_AS_FIRST_DIRECTIVE when possible.
        * modules/malloc-h (Makefile.am): Substitute
        INCLUDE_NEXT_AS_FIRST_DIRECTIVE and NEXT_AS_FIRST_DIRECTIVE_MALLOC_H.

diff --git a/lib/malloc.in.h b/lib/malloc.in.h
index 52319a1fc4..4921f6e994 100644
--- a/lib/malloc.in.h
+++ b/lib/malloc.in.h
@@ -27,7 +27,7 @@
      In this situation, in C++ mode, the declaration of memalign might be used
      before it actually occurs.  */
 
-#@INCLUDE_NEXT@ @NEXT_MALLOC_H@
+#@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MALLOC_H@
 
 #else
 /* Normal invocation convention.  */
@@ -38,7 +38,7 @@
 
 /* The include_next requires a split double-inclusion guard.  */
 #if @HAVE_MALLOC_H@
-# @INCLUDE_NEXT@ @NEXT_MALLOC_H@
+# @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MALLOC_H@
 #endif
 
 #undef _GL_ALREADY_INCLUDING_MALLOC_H
diff --git a/modules/malloc-h b/modules/malloc-h
index 9717c90b67..7c241d2943 100644
--- a/modules/malloc-h
+++ b/modules/malloc-h
@@ -26,10 +26,12 @@ malloc.h: malloc.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(WARN_ON_USE_H
 @NMD@  $(AM_V_GEN)$(MKDIR_P) '%reldir%'
        $(gl_V_at)$(SED_HEADER_STDOUT) \
              -e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \
+             -e 
's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \
              -e 's|@''HAVE_MALLOC_H''@|$(HAVE_MALLOC_H)|g' \
              -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+             -e 
's|@''NEXT_AS_FIRST_DIRECTIVE_MALLOC_H''@|$(NEXT_AS_FIRST_DIRECTIVE_MALLOC_H)|g'
 \
              -e 's|@''NEXT_MALLOC_H''@|$(NEXT_MALLOC_H)|g' \
              -e 's/@''GNULIB_FREE_POSIX''@/$(GNULIB_FREE_POSIX)/g' \
              -e 's/@''GNULIB_MEMALIGN''@/$(GNULIB_MEMALIGN)/g' \






reply via email to

[Prev in Thread] Current Thread [Next in Thread]