Skip to content

Commit 382717d

Browse files
Karlson2kbagder
authored andcommitted
curl_setup.h: detect 'inline' support
Closes #13355
1 parent 3572dd6 commit 382717d

File tree

4 files changed

+25
-28
lines changed

4 files changed

+25
-28
lines changed

configure.ac

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,6 @@ fi
497497
AC_SUBST(REQUIRE_LIB_DEPS)
498498
AM_CONDITIONAL(USE_EXPLICIT_LIB_DEPS, test x$REQUIRE_LIB_DEPS = xyes)
499499

500-
dnl check if there's a way to force code inline
501-
AC_C_INLINE
502-
503500
dnl **********************************************************************
504501
dnl platform/compiler/architecture specific checks/flags
505502
dnl **********************************************************************

lib/curl_config.h.cmake

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -776,12 +776,6 @@ ${SIZEOF_TIME_T_CODE}
776776
/* Type to use in place of in_addr_t when system does not provide it. */
777777
#cmakedefine in_addr_t ${in_addr_t}
778778

779-
/* Define to `__inline__' or `__inline' if that's what the C compiler
780-
calls it, or to nothing if 'inline' is not supported under any name. */
781-
#ifndef __cplusplus
782-
#undef inline
783-
#endif
784-
785779
/* Define to `unsigned int' if <sys/types.h> does not define. */
786780
#cmakedefine size_t ${size_t}
787781

lib/curl_setup.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,4 +891,26 @@ int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf,
891891
#define OPENSSL_SUPPRESS_DEPRECATED
892892
#endif
893893

894+
#if defined(inline)
895+
/* 'inline' is defined as macro and assumed to be correct */
896+
/* No need for 'inline' replacement */
897+
#elif defined(__cplusplus)
898+
/* The code is compiled with C++ compiler.
899+
C++ always supports 'inline'. */
900+
/* No need for 'inline' replacement */
901+
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901
902+
/* C99 (and later) supports 'inline' keyword */
903+
/* No need for 'inline' replacement */
904+
#elif defined(__GNUC__) && __GNUC__ >= 3
905+
/* GCC supports '__inline__' as an extension */
906+
# define inline __inline__
907+
#elif defined(_MSC_VER) && _MSC_VER >= 1400
908+
/* MSC supports '__inline' from VS 2005 (or even earlier) */
909+
# define inline __inline
910+
#else
911+
/* Probably 'inline' is not supported by compiler.
912+
Define to the empty string to be on the safe side. */
913+
# define inline /* empty */
914+
#endif
915+
894916
#endif /* HEADER_CURL_SETUP_H */

lib/curl_sha512_256.c

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -286,29 +286,13 @@ Curl_sha512_256_finish(unsigned char *digest,
286286
defined(_MSC_VER) && !defined(__GNUC__) && !defined(__clang__)
287287
# if _MSC_VER >= 1400
288288
# define MHDX_INLINE __forceinline
289-
# else
290-
# define MHDX_INLINE /* empty */
291289
# endif
292290
#endif
293291

294292
#if !defined(MHDX_INLINE)
295-
# if defined(inline)
296-
/* Assume that 'inline' macro was already defined correctly by
297-
* the build system. */
298-
# define MHDX_INLINE inline
299-
# elif defined(__cplusplus)
300-
/* The code is compiled with C++ compiler.
301-
* C++ always supports 'inline'. */
302-
# define MHDX_INLINE inline
303-
# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901
304-
/* C99 (and later) supports 'inline' keyword */
305-
# define MHDX_INLINE inline
306-
# elif defined(__GNUC__) && __GNUC__ >= 3
307-
/* GCC supports '__inline__' as an extension */
308-
# define MHDX_INLINE __inline__
309-
# else
310-
# define MHDX_INLINE /* empty */
311-
# endif
293+
/* Assume that 'inline' keyword works or the
294+
* macro was already defined correctly. */
295+
# define MHDX_INLINE inline
312296
#endif
313297

314298
/* Bits manipulation macros and functions.

0 commit comments

Comments
 (0)