+2024-12-30 Bruno Haible <bruno@clisp.org>
+
+ doc: Document the 'inline' module.
+ * doc/static-inline.texi: Document the 'inline' module.
+ * m4/inline.m4: Fix comment.
+
2024-12-30 Bruno Haible <bruno@clisp.org>
signal: Deprecate old stub module.
-@c GNU static-inline module documentation
+@c Documentation of gnulib module 'inline'.
@c Copyright (C) 2019--2024 Free Software Foundation, Inc.
@cindex static inline
@cindex inline
-In order to mark functions as @code{static inline}, the only
-prerequisite you need is an @code{AC_REQUIRE([AC_C_INLINE])}.
+In order to mark functions as @code{static inline} in @code{.c} files,
+the only prerequisite you need is an @code{AC_REQUIRE([AC_C_INLINE])}.
No Gnulib module is needed.
+
+@mindex inline
+When marking functions as @code{static inline} in @code{.h} files,
+on the other hand,
+it is useful to avoid the following problem:
+When gcc or clang is not optimizing, it generates the same object code
+for every @code{static inline} function
+that is actually used in the current compilation unit,
+thus bloating the size of the resulting binary.
+(Code of @code{static inline} functions
+that are unused in the current compilation unit gets dropped;
+that is not an issue.)
+To avoid this problem, use the Gnulib module @samp{inline}
+and make the @code{static inline} function definition conditional
+on the value of the C macro @code{HAVE_INLINE}.
# inline.m4
-# serial 4
+# serial 5
dnl Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl Define 'inline' to a supported equivalent, or to nothing if not supported,
dnl like AC_C_INLINE does. Also, define HAVE_INLINE if 'inline' or an
dnl equivalent is effectively supported, i.e. if the compiler is likely to
-dnl drop unused 'static inline' functions.
+dnl actually inline 'static inline' functions when there are used. (All
+dnl versions of gcc and clang actually drop the code of 'static inline'
+dnl functions that are unused in the current compilation unit.)
AC_DEFUN([gl_INLINE],
[
AC_REQUIRE([AC_C_INLINE])