Skip to content

Commit

Permalink
Remove support for non ISO C99 vararg support
Browse files Browse the repository at this point in the history
We require ISO C99 as minimum support for our source code and all compilers
should support the ISO C99 macros. Especially gcc does not need
the gcc extensions anymore. Also MSVC has support for it (as defined
in the config-msvc.h but also double checked)

LCLINT seems to be a C analyzer that history has forgotten about. I could
only find https://splint.org/release1.3.html and an similarly old research
paper.

Patch V2: Also remove AX_ macros from configure.ac

Signed-off-by: Arne Schwabe <[email protected]>
Acked-by: Steffan Karger <[email protected]>
Acked-by: Gert Doering <[email protected]>
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg21883.html
Signed-off-by: Gert Doering <[email protected]>
  • Loading branch information
schwabe authored and cron2 committed Mar 28, 2021
1 parent 7975e33 commit f91e211
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 106 deletions.
1 change: 0 additions & 1 deletion config-msvc.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
#define HAVE_ACCESS 1
#define HAVE_CHDIR 1
#define HAVE_CHSIZE 1
#define HAVE_CPP_VARARG_MACRO_ISO 1
#define HAVE_CTIME 1
#define HAVE_EVP_CIPHER_CTX_SET_KEY_LENGTH 1
#define HAVE_IN_PKTINFO 1
Expand Down
2 changes: 0 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,6 @@ AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_SIGNAL
AX_CPP_VARARG_MACRO_ISO
AX_CPP_VARARG_MACRO_GCC
AX_TYPE_SOCKLEN_T
AC_CHECK_SIZEOF([unsigned int])
AC_CHECK_SIZEOF([unsigned long])
Expand Down
77 changes: 0 additions & 77 deletions m4/ax_varargs.m4

This file was deleted.

4 changes: 0 additions & 4 deletions src/openvpn/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,26 +236,22 @@ x_msg_va(const unsigned int flags, const char *format, va_list arglist)

void usage_small(void);

#ifndef HAVE_VARARG_MACROS
/* the macro has checked this otherwise */
if (!msg_test(flags))
{
return;
}
#endif

e = openvpn_errno();

/*
* Apply muting filter.
*/
#ifndef HAVE_VARARG_MACROS
/* the macro has checked this otherwise */
if (!dont_mute(flags))
{
return;
}
#endif

gc_init(&gc);

Expand Down
21 changes: 0 additions & 21 deletions src/openvpn/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,33 +146,12 @@ bool dont_mute(unsigned int flags);
/* Macro to ensure (and teach static analysis tools) we exit on fatal errors */
#define EXIT_FATAL(flags) do { if ((flags) & M_FATAL) {_exit(1);}} while (false)

#if defined(HAVE_CPP_VARARG_MACRO_ISO) && !defined(__LCLINT__)
#define HAVE_VARARG_MACROS
#define msg(flags, ...) do { if (msg_test(flags)) {x_msg((flags), __VA_ARGS__);} EXIT_FATAL(flags); } while (false)
#ifdef ENABLE_DEBUG
#define dmsg(flags, ...) do { if (msg_test(flags)) {x_msg((flags), __VA_ARGS__);} EXIT_FATAL(flags); } while (false)
#else
#define dmsg(flags, ...)
#endif
#elif defined(HAVE_CPP_VARARG_MACRO_GCC) && !defined(__LCLINT__)
#define HAVE_VARARG_MACROS
#define msg(flags, args ...) do { if (msg_test(flags)) {x_msg((flags), args);} EXIT_FATAL(flags); } while (false)
#ifdef ENABLE_DEBUG
#define dmsg(flags, args ...) do { if (msg_test(flags)) {x_msg((flags), args);} EXIT_FATAL(flags); } while (false)
#else
#define dmsg(flags, args ...)
#endif
#else /* if defined(HAVE_CPP_VARARG_MACRO_ISO) && !defined(__LCLINT__) */
#if !PEDANTIC
#ifdef _MSC_VER
#pragma message("this compiler appears to lack vararg macros which will cause a significant degradation in efficiency")
#else
#warning this compiler appears to lack vararg macros which will cause a significant degradation in efficiency (you can ignore this warning if you are using LCLINT)
#endif
#endif
#define msg x_msg
#define dmsg x_msg
#endif /* if defined(HAVE_CPP_VARARG_MACRO_ISO) && !defined(__LCLINT__) */

void x_msg(const unsigned int flags, const char *format, ...)
#ifdef __GNUC__
Expand Down
1 change: 0 additions & 1 deletion src/tapctl/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ bool dont_mute(unsigned int flags);
#endif
#define EXIT_FATAL(flags) do { if ((flags) & M_FATAL) {_exit(1);}} while (false)

#define HAVE_VARARG_MACROS
#define msg(flags, ...) do { if (msg_test(flags)) {x_msg((flags), __VA_ARGS__);} EXIT_FATAL(flags); } while (false)
#ifdef ENABLE_DEBUG
#define dmsg(flags, ...) do { if (msg_test(flags)) {x_msg((flags), __VA_ARGS__);} EXIT_FATAL(flags); } while (false)
Expand Down

0 comments on commit f91e211

Please sign in to comment.