build: variadic macro tidy-ups
- delete unused `HAVE_VARIADIC_MACROS_C99/GCC` feature checks.
(both autotools and CMake.)
- delete duplicate `NULL` check in `Curl_trc_cf_infof()`.
- fix compiler warning in `CURL_DISABLE_VERBOSE_STRINGS` builds.
```
./lib/cf-socket.c:122:41: warning: unused parameter 'data' [-Wunused-parameter]
static void nosigpipe(struct Curl_easy *data,
^
```
- fix `#ifdef` comments in `lib/curl_trc.{c,h}`.
- fix indentation in some `infof()` calls.
Follow-up to dac293cfb7 #12167
Cherry-picked from #12105
Closes #12210
This commit is contained in:
parent
191e695fe4
commit
a426b5050f
@ -400,58 +400,6 @@ int main(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VARIADIC_MACROS_C99
|
||||
#define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__)
|
||||
#define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__)
|
||||
|
||||
int fun3(int arg1, int arg2, int arg3);
|
||||
int fun2(int arg1, int arg2);
|
||||
|
||||
int fun3(int arg1, int arg2, int arg3)
|
||||
{
|
||||
return arg1 + arg2 + arg3;
|
||||
}
|
||||
int fun2(int arg1, int arg2)
|
||||
{
|
||||
return arg1 + arg2;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int res3 = c99_vmacro3(1, 2, 3);
|
||||
int res2 = c99_vmacro2(1, 2);
|
||||
(void)res3;
|
||||
(void)res2;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VARIADIC_MACROS_GCC
|
||||
#define gcc_vmacro3(first, args...) fun3(first, args)
|
||||
#define gcc_vmacro2(first, args...) fun2(first, args)
|
||||
|
||||
int fun3(int arg1, int arg2, int arg3);
|
||||
int fun2(int arg1, int arg2);
|
||||
|
||||
int fun3(int arg1, int arg2, int arg3)
|
||||
{
|
||||
return arg1 + arg2 + arg3;
|
||||
}
|
||||
int fun2(int arg1, int arg2)
|
||||
{
|
||||
return arg1 + arg2;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int res3 = gcc_vmacro3(1, 2, 3);
|
||||
int res2 = gcc_vmacro2(1, 2);
|
||||
(void)res3;
|
||||
(void)res2;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ATOMIC
|
||||
/* includes start */
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
|
||||
@ -55,11 +55,6 @@ else()
|
||||
set(HAVE_LOCALE_H 1)
|
||||
set(HAVE_STDDEF_H 1) # detected by CMake internally in check_type_size()
|
||||
set(HAVE_STDATOMIC_H 0)
|
||||
if(NOT MSVC_VERSION LESS 1400)
|
||||
set(HAVE_VARIADIC_MACROS_C99 1)
|
||||
else()
|
||||
set(HAVE_VARIADIC_MACROS_C99 0)
|
||||
endif()
|
||||
if(NOT MSVC_VERSION LESS 1600)
|
||||
set(HAVE_STDINT_H 1)
|
||||
else()
|
||||
|
||||
@ -1297,8 +1297,6 @@ foreach(CURL_TEST
|
||||
HAVE_BOOL_T
|
||||
STDC_HEADERS
|
||||
HAVE_FILE_OFFSET_BITS
|
||||
HAVE_VARIADIC_MACROS_C99
|
||||
HAVE_VARIADIC_MACROS_GCC
|
||||
HAVE_ATOMIC
|
||||
)
|
||||
curl_internal_test(${CURL_TEST})
|
||||
|
||||
64
acinclude.m4
64
acinclude.m4
@ -1374,70 +1374,6 @@ int main()
|
||||
])
|
||||
|
||||
|
||||
dnl CURL_CHECK_VARIADIC_MACROS
|
||||
dnl -------------------------------------------------
|
||||
dnl Check compiler support of variadic macros
|
||||
|
||||
AC_DEFUN([CURL_CHECK_VARIADIC_MACROS], [
|
||||
AC_CACHE_CHECK([for compiler support of C99 variadic macro style],
|
||||
[curl_cv_variadic_macros_c99], [
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
#define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__)
|
||||
#define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__)
|
||||
int fun3(int arg1, int arg2, int arg3);
|
||||
int fun2(int arg1, int arg2);
|
||||
int fun3(int arg1, int arg2, int arg3)
|
||||
{ return arg1 + arg2 + arg3; }
|
||||
int fun2(int arg1, int arg2)
|
||||
{ return arg1 + arg2; }
|
||||
]],[[
|
||||
int res3 = c99_vmacro3(1, 2, 3);
|
||||
int res2 = c99_vmacro2(1, 2);
|
||||
]])
|
||||
],[
|
||||
curl_cv_variadic_macros_c99="yes"
|
||||
],[
|
||||
curl_cv_variadic_macros_c99="no"
|
||||
])
|
||||
])
|
||||
case "$curl_cv_variadic_macros_c99" in
|
||||
yes)
|
||||
AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_C99, 1,
|
||||
[Define to 1 if compiler supports C99 variadic macro style.])
|
||||
;;
|
||||
esac
|
||||
AC_CACHE_CHECK([for compiler support of old gcc variadic macro style],
|
||||
[curl_cv_variadic_macros_gcc], [
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
#define gcc_vmacro3(first, args...) fun3(first, args)
|
||||
#define gcc_vmacro2(first, args...) fun2(first, args)
|
||||
int fun3(int arg1, int arg2, int arg3);
|
||||
int fun2(int arg1, int arg2);
|
||||
int fun3(int arg1, int arg2, int arg3)
|
||||
{ return arg1 + arg2 + arg3; }
|
||||
int fun2(int arg1, int arg2)
|
||||
{ return arg1 + arg2; }
|
||||
]],[[
|
||||
int res3 = gcc_vmacro3(1, 2, 3);
|
||||
int res2 = gcc_vmacro2(1, 2);
|
||||
]])
|
||||
],[
|
||||
curl_cv_variadic_macros_gcc="yes"
|
||||
],[
|
||||
curl_cv_variadic_macros_gcc="no"
|
||||
])
|
||||
])
|
||||
case "$curl_cv_variadic_macros_gcc" in
|
||||
yes)
|
||||
AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_GCC, 1,
|
||||
[Define to 1 if compiler supports old gcc variadic macro style.])
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
|
||||
dnl CURL_CHECK_CA_BUNDLE
|
||||
dnl -------------------------------------------------
|
||||
dnl Check if a default ca-bundle should be used
|
||||
|
||||
@ -3418,7 +3418,6 @@ dnl default includes
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
CURL_CHECK_VARIADIC_MACROS
|
||||
AC_TYPE_SIZE_T
|
||||
|
||||
CURL_CHECK_STRUCT_TIMEVAL
|
||||
|
||||
@ -123,6 +123,7 @@ static void nosigpipe(struct Curl_easy *data,
|
||||
curl_socket_t sockfd)
|
||||
{
|
||||
int onoff = 1;
|
||||
(void)data;
|
||||
if(setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&onoff,
|
||||
sizeof(onoff)) < 0) {
|
||||
#if !defined(CURL_DISABLE_VERBOSE_STRINGS)
|
||||
|
||||
@ -122,7 +122,6 @@
|
||||
#define HAVE_SIGSETJMP 1
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
#define HAVE_TERMIOS_H 1
|
||||
#define HAVE_VARIADIC_MACROS_GCC 1
|
||||
|
||||
#elif defined(__HIGHC__)
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
@ -377,11 +377,6 @@
|
||||
/* Windows should not have HAVE_GMTIME_R defined */
|
||||
/* #undef HAVE_GMTIME_R */
|
||||
|
||||
/* Define if the compiler supports C99 variadic macro style. */
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||
#define HAVE_VARIADIC_MACROS_C99 1
|
||||
#endif
|
||||
|
||||
/* Define if the compiler supports the 'long long' data type. */
|
||||
#if defined(__MINGW32__) || \
|
||||
(defined(_MSC_VER) && (_MSC_VER >= 1310)) || \
|
||||
|
||||
@ -602,12 +602,6 @@
|
||||
/* Define to 1 if you have the <utime.h> header file. */
|
||||
#cmakedefine HAVE_UTIME_H 1
|
||||
|
||||
/* Define to 1 if compiler supports C99 variadic macro style. */
|
||||
#cmakedefine HAVE_VARIADIC_MACROS_C99 1
|
||||
|
||||
/* Define to 1 if compiler supports old gcc variadic macro style. */
|
||||
#cmakedefine HAVE_VARIADIC_MACROS_GCC 1
|
||||
|
||||
/* Define to 1 if you have the windows.h header file. */
|
||||
#cmakedefine HAVE_WINDOWS_H 1
|
||||
|
||||
|
||||
@ -130,7 +130,7 @@ void Curl_trc_cf_infof(struct Curl_easy *data, struct Curl_cfilter *cf,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
DEBUGASSERT(cf);
|
||||
if(data && Curl_trc_cf_is_verbose(cf, data)) {
|
||||
if(Curl_trc_cf_is_verbose(cf, data)) {
|
||||
va_list ap;
|
||||
int len;
|
||||
char buffer[MAXINFO + 2];
|
||||
@ -228,14 +228,14 @@ CURLcode Curl_trc_init(void)
|
||||
if(config) {
|
||||
return Curl_trc_opt(config);
|
||||
}
|
||||
#endif
|
||||
#endif /* DEBUGBUILD */
|
||||
return CURLE_OK;
|
||||
}
|
||||
#else /* !CURL_DISABLE_VERBOSE_STRINGS) */
|
||||
#else /* defined(CURL_DISABLE_VERBOSE_STRINGS) */
|
||||
|
||||
CURLcode Curl_trc_init(void)
|
||||
{
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
#endif /* !DEBUGBUILD */
|
||||
#endif /* !defined(CURL_DISABLE_VERBOSE_STRINGS) */
|
||||
|
||||
@ -123,7 +123,7 @@ void Curl_trc_cf_infof(struct Curl_easy *data, struct Curl_cfilter *cf,
|
||||
const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
#else /* !CURL_DISABLE_VERBOSE_STRINGS */
|
||||
#else /* defined(CURL_DISABLE_VERBOSE_STRINGS) */
|
||||
/* All informational messages are not compiled in for size savings */
|
||||
|
||||
#define Curl_trc_is_verbose(d) ((void)(d), FALSE)
|
||||
@ -141,6 +141,6 @@ static void Curl_trc_cf_infof(struct Curl_easy *data,
|
||||
(void)data; (void)cf; (void)fmt;
|
||||
}
|
||||
|
||||
#endif /* CURL_DISABLE_VERBOSE_STRINGS */
|
||||
#endif /* !defined(CURL_DISABLE_VERBOSE_STRINGS) */
|
||||
|
||||
#endif /* HEADER_CURL_TRC_H */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user