2024-05-11 20:16:48 +00:00
|
|
|
# extern-inline.m4
|
|
|
|
# serial 1
|
2024-01-02 01:47:10 +00:00
|
|
|
dnl Copyright 2012-2024 Free Software Foundation, Inc.
|
2012-08-02 04:46:10 +00:00
|
|
|
dnl This file is free software; the Free Software Foundation
|
|
|
|
dnl gives unlimited permission to copy and/or distribute it,
|
|
|
|
dnl with or without modifications, as long as this notice is preserved.
|
|
|
|
|
2024-05-11 20:16:48 +00:00
|
|
|
dnl 'extern inline' a la ISO C99.
|
|
|
|
|
2012-08-02 04:46:10 +00:00
|
|
|
AC_DEFUN([gl_EXTERN_INLINE],
|
|
|
|
[
|
2022-02-23 19:11:52 +00:00
|
|
|
AC_CACHE_CHECK([whether ctype.h defines __header_inline],
|
|
|
|
[gl_cv_have___header_inline],
|
|
|
|
[AC_PREPROC_IFELSE(
|
|
|
|
[AC_LANG_SOURCE([[#include <ctype.h>
|
|
|
|
#ifndef __header_inline
|
|
|
|
#error "<ctype.h> does not define __header_inline"
|
|
|
|
#endif
|
|
|
|
]])],
|
|
|
|
[gl_cv_have___header_inline=yes],
|
|
|
|
[gl_cv_have___header_inline=no])])
|
|
|
|
if test "$gl_cv_have___header_inline" = yes; then
|
|
|
|
AC_DEFINE([HAVE___HEADER_INLINE], [1],
|
|
|
|
[Define to 1 if ctype.h defines __header_inline.])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AH_VERBATIM([HAVE___HEADER_INLINE_1],
|
2013-06-18 21:31:00 +00:00
|
|
|
[/* Please see the Gnulib manual for how to use these macros.
|
2012-12-11 18:18:13 +00:00
|
|
|
|
2013-03-01 15:16:43 +00:00
|
|
|
Suppress extern inline with HP-UX cc, as it appears to be broken; see
|
Merge from Gnulib
This incorporates:
2017-11-23 stat: work around Solaris bug with tv_nsec < 0
2017-11-12 maint: shorten https://lists.gnu.org/archive/html/... links
* build-aux/config.sub, doc/misc/texinfo.tex, lib/allocator.h:
* lib/fstatat.c, lib/intprops.h, lib/lstat.c, lib/signal.in.h:
* lib/stat-time.h, lib/stdio-impl.h, lib/stdio.in.h:
* lib/timespec.h, m4/alloca.m4, m4/extern-inline.m4:
* m4/faccessat.m4, m4/fstatat.m4, m4/gnulib-common.m4:
* m4/lstat.m4, m4/std-gnu11.m4, m4/sys_types_h.m4:
* m4/vararrays.m4:
Copy from Gnulib.
2017-11-26 06:28:31 +00:00
|
|
|
<https://lists.gnu.org/r/bug-texinfo/2013-02/msg00030.html>.
|
2013-03-01 15:16:43 +00:00
|
|
|
|
2013-04-29 04:48:30 +00:00
|
|
|
Suppress extern inline with Sun C in standards-conformance mode, as it
|
|
|
|
mishandles inline functions that call each other. E.g., for 'inline void f
|
|
|
|
(void) { } inline void g (void) { f (); }', c99 incorrectly complains
|
|
|
|
'reference to static identifier "f" in extern inline function'.
|
Update from Gnulib
Make the following changes by hand, and run 'admin/merge-gnulib'.
* .gitignore: Add lib/malloc/*.gl.h.
* admin/merge-gnulib: Copy lib/af_alg.h and lib/save-cwd.h
directly from Gnulib, without worrying about Gnulib modules,
as these files are special cases.
(AVOIDED_MODULES): Remove malloc-posix.
* lib/malloc.c, lib/realloc.c, m4/malloc.m4, m4/realloc.m4:
* m4/year2038.m4: New files, copied from Gnulib.
* lib/malloca.c, lib/malloca.h:
* m4/close-stream.m4, m4/glibc21.m4, m4/malloca.m4:
Remove. These are either no longer present in Gnulib, or are no
longer needed by modules that Emacs uses.
* oldXMenu/AddPane.c, oldXmenu/Addsel.c: Include XmenuInt.h first;
needed for new Gnulib.
* src/xmenu.c: Call emacs_abort, not abort.
2021-10-04 19:11:39 +00:00
|
|
|
This bug was observed with Oracle Developer Studio 12.6
|
|
|
|
(Sun C 5.15 SunOS_sparc 2017/05/30).
|
2013-04-29 04:48:30 +00:00
|
|
|
|
2014-08-04 18:44:49 +00:00
|
|
|
Suppress extern inline (with or without __attribute__ ((__gnu_inline__)))
|
|
|
|
on configurations that mistakenly use 'static inline' to implement
|
|
|
|
functions or macros in standard C headers like <ctype.h>. For example,
|
|
|
|
if isdigit is mistakenly implemented via a static inline function,
|
|
|
|
a program containing an extern inline function that calls isdigit
|
|
|
|
may not work since the C standard prohibits extern inline functions
|
2018-08-06 00:40:22 +00:00
|
|
|
from calling static functions (ISO C 99 section 6.7.4.(3).
|
|
|
|
This bug is known to occur on:
|
2014-08-04 18:44:49 +00:00
|
|
|
|
|
|
|
OS X 10.8 and earlier; see:
|
Merge from Gnulib
This incorporates:
2017-11-23 stat: work around Solaris bug with tv_nsec < 0
2017-11-12 maint: shorten https://lists.gnu.org/archive/html/... links
* build-aux/config.sub, doc/misc/texinfo.tex, lib/allocator.h:
* lib/fstatat.c, lib/intprops.h, lib/lstat.c, lib/signal.in.h:
* lib/stat-time.h, lib/stdio-impl.h, lib/stdio.in.h:
* lib/timespec.h, m4/alloca.m4, m4/extern-inline.m4:
* m4/faccessat.m4, m4/fstatat.m4, m4/gnulib-common.m4:
* m4/lstat.m4, m4/std-gnu11.m4, m4/sys_types_h.m4:
* m4/vararrays.m4:
Copy from Gnulib.
2017-11-26 06:28:31 +00:00
|
|
|
https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html
|
2014-08-04 18:44:49 +00:00
|
|
|
|
|
|
|
DragonFly; see
|
Update from Gnulib
This incorporates:
2019-09-22 Update some URLs
2019-09-15 fcntl-h: fix compilation error of creat.c on MSVC
2019-09-15 creat: new module
2019-09-15 access: new module
2019-09-09 Add option to assume best, not worst, when cross-compiling.
* build-aux/config.guess, build-aux/config.sub, doc/misc/texinfo.tex:
* lib/careadlinkat.c, lib/careadlinkat.h, lib/count-leading-zeros.h:
* lib/count-trailing-zeros.h, lib/diffseq.h, lib/fcntl.in.h:
* lib/ftoastr.c, lib/get-permissions.c:
* lib/ieee754.in.h, lib/inttypes.in.h, lib/mktime.c, lib/open.c:
* lib/pathmax.h, lib/pipe2.c, lib/stddef.in.h, lib/stdint.in.h:
* lib/stdlib.in.h, lib/str-two-way.h, lib/string.in.h, lib/time.in.h:
* lib/timegm.c, lib/unistd.in.h, m4/canonicalize.m4:
* m4/extern-inline.m4, m4/fcntl_h.m4, m4/fdopendir.m4:
* m4/getgroups.m4, m4/getopt.m4, m4/gettimeofday.m4:
* m4/gnulib-common.m4, m4/largefile.m4:
* m4/lstat.m4, m4/memmem.m4, m4/mktime.m4, m4/nocrash.m4, m4/open.m4:
* m4/pselect.m4, m4/putenv.m4, m4/readlink.m4, m4/regex.m4:
* m4/symlink.m4, m4/unistd_h.m4, m4/utimens.m4, m4/utimes.m4:
Copy from Gnulib.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* m4/open-slash.m4: New file, copied from Gnulib.
2019-09-23 06:50:59 +00:00
|
|
|
http://muscles.dragonflybsd.org/bulk/clang-master-potential/20141111_102002/logs/ah-tty-0.3.12.log
|
2014-08-04 18:44:49 +00:00
|
|
|
|
|
|
|
FreeBSD; see:
|
Merge from Gnulib
This incorporates:
2017-11-23 stat: work around Solaris bug with tv_nsec < 0
2017-11-12 maint: shorten https://lists.gnu.org/archive/html/... links
* build-aux/config.sub, doc/misc/texinfo.tex, lib/allocator.h:
* lib/fstatat.c, lib/intprops.h, lib/lstat.c, lib/signal.in.h:
* lib/stat-time.h, lib/stdio-impl.h, lib/stdio.in.h:
* lib/timespec.h, m4/alloca.m4, m4/extern-inline.m4:
* m4/faccessat.m4, m4/fstatat.m4, m4/gnulib-common.m4:
* m4/lstat.m4, m4/std-gnu11.m4, m4/sys_types_h.m4:
* m4/vararrays.m4:
Copy from Gnulib.
2017-11-26 06:28:31 +00:00
|
|
|
https://lists.gnu.org/r/bug-gnulib/2014-07/msg00104.html
|
2014-08-04 18:44:49 +00:00
|
|
|
|
2013-11-08 16:24:40 +00:00
|
|
|
OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and
|
Merge from Gnulib
This incorporates:
2017-09-16 manywarnings: port to GCC on 64-bit MS-Windows
2017-09-13 all: Replace many more http URLs by https URLs
* build-aux/config.guess, build-aux/config.sub:
* build-aux/gitlog-to-changelog, doc/misc/texinfo.tex:
* lib/allocator.h, lib/count-leading-zeros.h:
* lib/count-trailing-zeros.h, lib/dup2.c, lib/filevercmp.c:
* lib/fstatat.c, lib/fsync.c, lib/ftoastr.c, lib/ftoastr.h:
* lib/intprops.h, lib/signal.in.h, lib/stdio-impl.h, lib/stdio.in.h:
* lib/unistd.in.h, lib/utimens.c, m4/alloca.m4, m4/extern-inline.m4:
* m4/fstatat.m4, m4/gnulib-common.m4, m4/manywarnings.m4:
* m4/std-gnu11.m4, m4/sys_types_h.m4, m4/vararrays.m4:
Copy from Gnulib.
* lib/gnulib.mk.in: Regenerate.
2017-09-17 19:56:00 +00:00
|
|
|
for clang but remains for g++; see <https://trac.macports.org/ticket/41033>.
|
2018-08-06 00:40:22 +00:00
|
|
|
Assume DragonFly and FreeBSD will be similar.
|
|
|
|
|
|
|
|
GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
|
|
|
|
inline semantics, unless -fgnu89-inline is used. It defines a macro
|
|
|
|
__GNUC_STDC_INLINE__ to indicate this situation or a macro
|
|
|
|
__GNUC_GNU_INLINE__ to indicate the opposite situation.
|
|
|
|
GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline
|
|
|
|
semantics but warns, unless -fgnu89-inline is used:
|
|
|
|
warning: C99 inline functions are not supported; using GNU89
|
|
|
|
warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute
|
|
|
|
It defines a macro __GNUC_GNU_INLINE__ to indicate this situation.
|
|
|
|
*/
|
2014-08-04 18:44:49 +00:00
|
|
|
#if (((defined __APPLE__ && defined __MACH__) \
|
|
|
|
|| defined __DragonFly__ || defined __FreeBSD__) \
|
2022-02-23 19:11:52 +00:00
|
|
|
&& (defined HAVE___HEADER_INLINE \
|
2013-11-08 16:24:40 +00:00
|
|
|
? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \
|
|
|
|
&& ! defined __clang__) \
|
|
|
|
: ((! defined _DONT_USE_CTYPE_INLINE_ \
|
|
|
|
&& (defined __GNUC__ || defined __cplusplus)) \
|
|
|
|
|| (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
|
|
|
|
&& defined __GNUC__ && ! defined __cplusplus))))
|
2014-08-04 18:44:49 +00:00
|
|
|
# define _GL_EXTERN_INLINE_STDHEADER_BUG
|
2013-09-19 21:40:08 +00:00
|
|
|
#endif
|
2012-12-11 18:18:13 +00:00
|
|
|
#if ((__GNUC__ \
|
2023-05-15 01:51:22 +00:00
|
|
|
? (defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
|
|
|
|
&& !defined __PCC__) \
|
2013-04-29 04:48:30 +00:00
|
|
|
: (199901L <= __STDC_VERSION__ \
|
|
|
|
&& !defined __HP_cc \
|
2016-03-10 15:55:38 +00:00
|
|
|
&& !defined __PGI \
|
2013-04-29 04:48:30 +00:00
|
|
|
&& !(defined __SUNPRO_C && __STDC__))) \
|
2014-08-04 18:44:49 +00:00
|
|
|
&& !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
|
2012-08-02 04:46:10 +00:00
|
|
|
# define _GL_INLINE inline
|
|
|
|
# define _GL_EXTERN_INLINE extern inline
|
2013-09-19 21:40:08 +00:00
|
|
|
# define _GL_EXTERN_INLINE_IN_USE
|
2013-07-01 23:43:19 +00:00
|
|
|
#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \
|
2023-05-15 01:51:22 +00:00
|
|
|
&& !defined __PCC__ \
|
2014-08-04 18:44:49 +00:00
|
|
|
&& !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
|
2013-10-23 04:01:46 +00:00
|
|
|
# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__
|
2012-08-21 14:37:56 +00:00
|
|
|
/* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */
|
|
|
|
# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
|
|
|
|
# else
|
|
|
|
# define _GL_INLINE extern inline
|
2012-08-02 04:46:10 +00:00
|
|
|
# endif
|
2012-08-21 14:37:56 +00:00
|
|
|
# define _GL_EXTERN_INLINE extern
|
2013-09-19 21:40:08 +00:00
|
|
|
# define _GL_EXTERN_INLINE_IN_USE
|
2012-08-02 04:46:10 +00:00
|
|
|
#else
|
Update from Gnulib
Make the following changes by hand, and run 'admin/merge-gnulib'.
* .gitignore: Add lib/malloc/*.gl.h.
* admin/merge-gnulib: Copy lib/af_alg.h and lib/save-cwd.h
directly from Gnulib, without worrying about Gnulib modules,
as these files are special cases.
(AVOIDED_MODULES): Remove malloc-posix.
* lib/malloc.c, lib/realloc.c, m4/malloc.m4, m4/realloc.m4:
* m4/year2038.m4: New files, copied from Gnulib.
* lib/malloca.c, lib/malloca.h:
* m4/close-stream.m4, m4/glibc21.m4, m4/malloca.m4:
Remove. These are either no longer present in Gnulib, or are no
longer needed by modules that Emacs uses.
* oldXMenu/AddPane.c, oldXmenu/Addsel.c: Include XmenuInt.h first;
needed for new Gnulib.
* src/xmenu.c: Call emacs_abort, not abort.
2021-10-04 19:11:39 +00:00
|
|
|
# define _GL_INLINE _GL_UNUSED static
|
|
|
|
# define _GL_EXTERN_INLINE _GL_UNUSED static
|
2012-08-02 04:46:10 +00:00
|
|
|
#endif
|
|
|
|
|
2015-04-30 03:11:59 +00:00
|
|
|
/* In GCC 4.6 (inclusive) to 5.1 (exclusive),
|
|
|
|
suppress bogus "no previous prototype for 'FOO'"
|
2014-11-14 20:23:11 +00:00
|
|
|
and "no previous declaration for 'FOO'" diagnostics,
|
|
|
|
when FOO is an inline function in the header; see
|
|
|
|
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and
|
|
|
|
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>. */
|
2015-04-30 03:11:59 +00:00
|
|
|
#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__
|
2012-09-30 04:19:32 +00:00
|
|
|
# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
|
2012-08-21 14:37:56 +00:00
|
|
|
# define _GL_INLINE_HEADER_CONST_PRAGMA
|
|
|
|
# else
|
|
|
|
# define _GL_INLINE_HEADER_CONST_PRAGMA \
|
|
|
|
_Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
|
|
|
|
# endif
|
|
|
|
# define _GL_INLINE_HEADER_BEGIN \
|
|
|
|
_Pragma ("GCC diagnostic push") \
|
|
|
|
_Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
|
|
|
|
_Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \
|
|
|
|
_GL_INLINE_HEADER_CONST_PRAGMA
|
|
|
|
# define _GL_INLINE_HEADER_END \
|
|
|
|
_Pragma ("GCC diagnostic pop")
|
|
|
|
#else
|
2012-08-02 04:46:10 +00:00
|
|
|
# define _GL_INLINE_HEADER_BEGIN
|
|
|
|
# define _GL_INLINE_HEADER_END
|
|
|
|
#endif])
|
|
|
|
])
|