From patchwork Sun Mar 28 01:53:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1669 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director11.mail.ord1d.rsapps.net ([172.27.255.53]) by backend30.mail.ord1d.rsapps.net with LMTP id OGf2LXp8YGDuOwAAIUCqbw (envelope-from ) for ; Sun, 28 Mar 2021 08:54:18 -0400 Received: from proxy14.mail.iad3a.rsapps.net ([172.27.255.53]) by director11.mail.ord1d.rsapps.net with LMTP id KHLELXp8YGCNdQAAvGGmqA (envelope-from ) for ; Sun, 28 Mar 2021 08:54:18 -0400 Received: from smtp19.gate.iad3a ([172.27.255.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy14.mail.iad3a.rsapps.net with LMTPS id ANuWFXx8YGAefgAA1+b4IQ (envelope-from ) for ; Sun, 28 Mar 2021 08:54:20 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp19.gate.iad3a.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=none (p=nil; dis=none) header.from=rfc2549.org X-Suspicious-Flag: YES X-Classification-ID: b4de3c80-8fc4-11eb-941e-5254005d39f2-1-1 Received: from [216.105.38.7] ([216.105.38.7:51032] helo=lists.sourceforge.net) by smtp19.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id C9/5B-04446-A7C70606; Sun, 28 Mar 2021 08:54:18 -0400 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.92.3) (envelope-from ) id 1lQUuu-0001ib-A5; Sun, 28 Mar 2021 12:53:20 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1lQUus-0001iU-PM for openvpn-devel@lists.sourceforge.net; Sun, 28 Mar 2021 12:53:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=aLK1VL3btdwJYkQI/aaU6Ftp/UFpYmDIgMtXR37/6Qo=; b=P0/bL17k7EB8T0VT+3I2Az9R70 hoafDpS4bJ33qtdMLu9M406fAbV87f9FpHAoZWiYrGuVAoBjm2BQ5KuGRQKNmvsg84G8ireTCNC3e HcRColyUhyenhuPco4ev8MpzNbS//jrhsQHN+DZ/HzA8+Pu1EYHPnL0cTOZn3Uu91bvU=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:MIME-Version: Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=aLK1VL3btdwJYkQI/aaU6Ftp/UFpYmDIgMtXR37/6Qo=; b=ALnpuL49tv9Wu+VcjNVTJPIJU0 PjJA5IDLEgeXbDtvJg21utzU8VJ3JkqTUtr4KPQvbNjZW1mp0f3w+/93cR5WLLHnOAT2LzAjrc2h6 XRN7MErCfp7xgrTjwQigxg/wuCeukEpbpXsDcTwgZh/t3OHQ97xL2x+Q+C4J6AlLlLKc=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1lQUum-004NS6-Oa for openvpn-devel@lists.sourceforge.net; Sun, 28 Mar 2021 12:53:18 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.94 (FreeBSD)) (envelope-from ) id 1lQUud-0003E9-Uo for openvpn-devel@lists.sourceforge.net; Sun, 28 Mar 2021 14:53:03 +0200 Received: (nullmailer pid 371 invoked by uid 10006); Sun, 28 Mar 2021 12:53:03 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Sun, 28 Mar 2021 14:53:03 +0200 Message-Id: <20210328125303.326-1-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: rfc2549.org] 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Headers-End: 1lQUum-004NS6-Oa Subject: [Openvpn-devel] [PATCH] Remove support for non ISO C99 vararg support X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox We 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. Signed-off-by: Arne Schwabe Acked-by: Steffan Karger --- config-msvc.h | 1 - m4/ax_varargs.m4 | 77 --------------------------------------------- src/openvpn/error.c | 4 --- src/openvpn/error.h | 21 ------------- src/tapctl/error.h | 1 - 5 files changed, 104 deletions(-) delete mode 100644 m4/ax_varargs.m4 diff --git a/config-msvc.h b/config-msvc.h index 0260927ce..4db9efae2 100644 --- a/config-msvc.h +++ b/config-msvc.h @@ -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 diff --git a/m4/ax_varargs.m4 b/m4/ax_varargs.m4 deleted file mode 100644 index c295d21f4..000000000 --- a/m4/ax_varargs.m4 +++ /dev/null @@ -1,77 +0,0 @@ -dnl @synopsis AX_CPP_VARARG_MACRO_GCC -dnl -dnl Test if the preprocessor understands GNU GCC-style vararg macros. -dnl If it does, defines HAVE_CPP_VARARG_MACRO_GCC to 1. -dnl -dnl @version -dnl @author James Yonan , Matthias Andree -AC_DEFUN([AX_CPP_VARARG_MACRO_GCC], [dnl - AS_VAR_PUSHDEF([VAR], [ax_cv_cpp_vararg_macro_gcc])dnl - AC_CACHE_CHECK( - [for GNU GCC vararg macro support], - [VAR], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ -#define macro(a, b...) func(a, b) -int func(int a, int b, int c); - ]], - [[ -int i = macro(1, 2, 3); - ]] - )], - [VAR=yes], - [VAR=no] - )] - )dnl - - AS_VAR_IF( - [VAR], - [yes], - [AC_DEFINE( - [HAVE_CPP_VARARG_MACRO_GCC], - [1], - [Define to 1 if your compiler supports GNU GCC-style variadic macros] - )] - )dnl - AS_VAR_POPDEF([VAR])dnl -]) - -dnl @synopsis AX_CPP_VARARG_MACRO_ISO -dnl -dnl Test if the preprocessor understands ISO C 1999 vararg macros. -dnl If it does, defines HAVE_CPP_VARARG_MACRO_ISO to 1. -dnl -dnl @version -dnl @author James Yonan , Matthias Andree -AC_DEFUN([AX_CPP_VARARG_MACRO_ISO], [dnl - AS_VAR_PUSHDEF([VAR],[ax_cv_cpp_vararg_macro_iso])dnl - AC_CACHE_CHECK( - [for ISO C 1999 vararg macro support], - [VAR], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ -#define macro(a, ...) func(a, __VA_ARGS__) -int func(int a, int b, int c); - ]], - [[ -int i = macro(1, 2, 3); - ]] - )], - [VAR=yes], - [VAR=no] - )] - )dnl - - AS_VAR_IF( - [VAR], - [yes], - [AC_DEFINE( - [HAVE_CPP_VARARG_MACRO_ISO], - [1], - [Define to 1 if your compiler supports ISO C99 variadic macros] - )] - )dnl - AS_VAR_POPDEF([VAR])dnl -]) diff --git a/src/openvpn/error.c b/src/openvpn/error.c index 0ecbfc330..e6f7ff0ff 100644 --- a/src/openvpn/error.c +++ b/src/openvpn/error.c @@ -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); diff --git a/src/openvpn/error.h b/src/openvpn/error.h index eaedf172c..1a5521654 100644 --- a/src/openvpn/error.h +++ b/src/openvpn/error.h @@ -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__ diff --git a/src/tapctl/error.h b/src/tapctl/error.h index 924cbbe89..cea50ba52 100644 --- a/src/tapctl/error.h +++ b/src/tapctl/error.h @@ -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)