From patchwork Tue Sep 23 14:08:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4440 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:c08a:b0:72f:f16c:e055 with SMTP id jr10csp889902mab; Tue, 23 Sep 2025 07:09:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWSnISkKtipLT6DFbOcFxLl0arXFv1fjr3dp2R3kYrgYixR5W99u4Z2qoBe2GfgsaJb78jgdrGCBxo=@openvpn.net X-Google-Smtp-Source: AGHT+IF4bCvuXTrnS08buLvy2sS42ZdcmYI0x1k14mlvHY/OU9OHRiXIcVhzTJBM82ls6t6O1pC+ X-Received: by 2002:a05:6870:328a:b0:346:865e:d049 with SMTP id 586e51a60fabf-34c8522e45cmr1395475fac.33.1758636551865; Tue, 23 Sep 2025 07:09:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1758636551; cv=none; d=google.com; s=arc-20240605; b=I9ISkynhE//o/MUXqe2UeW6UyN+o03M6wmdDZZ/RTOCI16OBOTacaQ8V9ISCPkmySC OhBEMA33CwZOwt0DIYIv+CDAndCvb6JjY1hcRSwvLsqPY/dACGK8BhbrVCW5TevBp/f2 +dDn2yQIuFbrJjH7VAPXwolfA33MbtTwnpfo6arLS3z4Fvhezi+kCLUiF/PVyaMNLEub VO5oSwvJrHFqBl/6HdC6DtTSNNQUnusGuLaCCduiqNcLMLhrZ+vcR+7FcYZKWDrUNRgg uBs1cbcK1UEmg607z+hM6qCKxtSNzl/+ftEHxdhnJ/8kYJWzACk/V9XMCaUSWG/vD3Ya pLYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=2hfLX2eZ+TRuQn3LrAFsjW6QGs6n7ty/tmWEA1TYxdc=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=jzh2zEYgaL+iwLimewsE752hORqVIywR4654f2R0WuPzslxGCFCsMZyb0C1olpCKL9 ijgg9CCydmtlXYD56mICRqF1ltTwUQt9ANFzqPC8hMtQ3xjKF2n0iiaIzEWIeW8a7z6/ VD+TmlGYIAaXGgvL1SpPLjvcwZ4IE8kAeG3B3FDBBKKyMIswKP2yFFyo+37CEo3G7S4F VFtSFOUth6j9Bp29e+rzOD0gSBnflzWsJPihsp3xVmpt0GdyDAQb81vuxQgL3lZ1wqGH i/PTtbA43wivqYuwF8oxJa0qQThR8CnKEkw9I/1DBMvLd8ZwT15EECmuCfvkULinUcAb C5cw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=HokTIwLR; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=DYeog9Fi; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=R406tW6I; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 586e51a60fabf-349a2adebccsi926334fac.144.2025.09.23.07.09.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Sep 2025 07:09:11 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=HokTIwLR; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=DYeog9Fi; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=R406tW6I; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2hfLX2eZ+TRuQn3LrAFsjW6QGs6n7ty/tmWEA1TYxdc=; b=HokTIwLRcI8oKlA3ZyJsPZVbsp NF4I9Z4y3gY7dqCAlA+IJJi9OCRS5WgxuQEjueyi5dAeNPyuBEbp+eCOI0Sgm+K03XYdERtkptaoM sRYO4tertqewV9dY7tNSpf71KbrKya5j1sdn55blTehOhsFVwMo8e9W9e9e4zHCOIx24=; 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.95) (envelope-from ) id 1v13hc-0007w2-SD; Tue, 23 Sep 2025 14:09:09 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1v13hb-0007vm-Ex for openvpn-devel@lists.sourceforge.net; Tue, 23 Sep 2025 14:09:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZICHKkhzkJek/Qv7kEnztTfm2jWmW7h+42YABjbEd4w=; b=DYeog9Fi1r5Ifa7nsvWsf+0EXZ z5MVaAML9EFxD6/cnrWtSM8Ki9N73cvwSfWrjDUvhJGH/VB0+pc1o++ywJmEinVpacnZ3OyxtUkNq YAj9DVVEnamRLHGuwiRSbnNomKwNTggQLVt1NChO7tnkCFKKn4++9POLI/lYqL0SXGik=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ZICHKkhzkJek/Qv7kEnztTfm2jWmW7h+42YABjbEd4w=; b=R406tW6IX0z28D9ewbIE5NhmCV SWYXgXWxqO84FcwLMZcNU5x3roF/Jc/8IXk2iWOIQ5unHB35GNjwMk5PXrDQ0F+fhI8CibNRg+XoO VPDCHFh5o1bT3+fmjA9bME2eh+ezTx5dzZJZauTWkInYYyYH2XdA7SbuwSOlOnt8A33E=; Received: from [193.149.48.134] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1v13ha-00016r-Um for openvpn-devel@lists.sourceforge.net; Tue, 23 Sep 2025 14:09:08 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 58NE8tXr021782 for ; Tue, 23 Sep 2025 16:08:55 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 58NE8tQb021781 for openvpn-devel@lists.sourceforge.net; Tue, 23 Sep 2025 16:08:55 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Tue, 23 Sep 2025 16:08:48 +0200 Message-ID: <20250923140854.21766-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.49.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-1.hosts.colo.sdot.me", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Frank Lichtenheld - Includes fixes for - -Wimplicit-fallthrough=2 (=3 is default but requires replacing all fallthrough comments) - -Wmissing-field-initializers - -Wold-style-declaration - All other warnings that would [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1v13ha-00016r-Um Subject: [Openvpn-devel] [PATCH v3] Enable a subset of -Wextra 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: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1844064081270005404?= X-GMAIL-MSGID: =?utf-8?q?1844064081270005404?= From: Frank Lichtenheld - Includes fixes for - -Wimplicit-fallthrough=2 (=3 is default but requires replacing all fallthrough comments) - -Wmissing-field-initializers - -Wold-style-declaration - All other warnings that would need fixes are disabled for now. Change-Id: I9ce664d073a4e6a6d433e9e6f986a5086dae8aa1 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1202 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1202 This mail reflects revision 3 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/CMakeLists.txt b/CMakeLists.txt index f027b01..fdc0162 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,7 +114,14 @@ check_and_add_compiler_flag(-Wstrict-prototypes StrictPrototypes) check_and_add_compiler_flag(-Wold-style-definition OldStyleDefinition) # We are not ready for this - #add_compile_options(-Wconversion -Wno-sign-conversion -Wsign-compare) + #add_compile_options(-Wconversion -Wno-sign-conversion) + add_compile_options(-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter) + # clang doesn't have the different levels but also doesn't include it in -Wextra + check_and_add_compiler_flag(-Wimplicit-fallthrough=2 GCCImplicitFallthrough) + if (WIN32) + # Not sure how to deal with GetProcAddress + add_compile_options(-Wno-cast-function-type) + endif () if (USE_WERROR) add_compile_options(-Werror) endif () diff --git a/configure.ac b/configure.ac index 38b14a1..a5485b0 100644 --- a/configure.ac +++ b/configure.ac @@ -1398,6 +1398,13 @@ ACL_CHECK_ADD_COMPILE_FLAGS([-Wstrict-prototypes]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wold-style-definition]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wall]) +ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter]) +# clang doesn't have the different levels but also doesn't include it in -Wextra +ACL_CHECK_ADD_COMPILE_FLAGS([-Wimplicit-fallthrough=2]) +if test "${WIN32}" = "yes"; then + # Not sure how to deal with GetProcAddress + ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-cast-function-type]) +fi if test "${enable_pedantic}" = "yes"; then enable_strict="yes" diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c index 59bf52b..0922326 100644 --- a/src/openvpn/misc.c +++ b/src/openvpn/misc.c @@ -733,7 +733,7 @@ { return false; } - + /* Intentional [[fallthrough]]; */ case 2: /* after the '=', replace non-printable or shell meta with '_' */ if (!isprint(c) || isspace(c) || c == '$' || c == '(' || c == '`') diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 9618301..c213c4b 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -84,10 +84,10 @@ #ifdef _WIN32 -const static GUID GUID_DEVCLASS_NET = { +static const GUID GUID_DEVCLASS_NET = { 0x4d36e972L, 0xe325, 0x11ce, { 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 } }; -const static GUID GUID_DEVINTERFACE_NET = { +static const GUID GUID_DEVINTERFACE_NET = { 0xcac88484, 0x7515, 0x4c03, { 0x82, 0xe6, 0x71, 0xa8, 0x7a, 0xba, 0xc3, 0x61 } }; diff --git a/src/tapctl/tap.c b/src/tapctl/tap.c index b633e77..9731602 100644 --- a/src/tapctl/tap.c +++ b/src/tapctl/tap.c @@ -40,11 +40,11 @@ #endif -const static GUID GUID_DEVCLASS_NET = { +static const GUID GUID_DEVCLASS_NET = { 0x4d36e972L, 0xe325, 0x11ce, { 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 } }; -const static WCHAR szAdapterRegKeyPathTemplate[] = +static const WCHAR szAdapterRegKeyPathTemplate[] = L"SYSTEM\\CurrentControlSet\\Control\\Network\\%ls\\%ls\\Connection"; #define ADAPTER_REGKEY_PATH_MAX \ (_countof(L"SYSTEM\\CurrentControlSet\\Control\\Network\\") - 1 + 38 + _countof(L"\\") - 1 \ diff --git a/tests/unit_tests/openvpn/test_pkt.c b/tests/unit_tests/openvpn/test_pkt.c index b5211cd..1423d46 100644 --- a/tests/unit_tests/openvpn/test_pkt.c +++ b/tests/unit_tests/openvpn/test_pkt.c @@ -164,7 +164,7 @@ init_tas_auth(int key_direction) { struct tls_auth_standalone tas = { 0 }; - struct frame frame = { { .headroom = 200, .payload_size = 1400 }, 0 }; + struct frame frame = { .buf = { .headroom = 200, .payload_size = 1400 }, 0 }; tas.frame = frame; tas.tls_wrap.mode = TLS_WRAP_AUTH; @@ -591,7 +591,7 @@ enum first_packet_verdict verdict; tas.tls_wrap.mode = TLS_WRAP_NONE; - struct frame frame = { { .headroom = 200, .payload_size = 1400 }, 0 }; + struct frame frame = { .buf = { .headroom = 200, .payload_size = 1400 }, 0 }; tas.frame = frame; tas.workbuf = alloc_buf(1600);