From patchwork Thu Jun 29 21:56:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 3262 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7301:3c07:b0:d9:b492:11d6 with SMTP id ki7csp2113009dyb; Thu, 29 Jun 2023 14:57:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlHgUMre+fIPWZDHrnw2oahNAQmaKsTteIcIEDzXf0GOTOevBCjUe82Z/mgnGlPoLI2ktwKA X-Received: by 2002:a05:6a00:3983:b0:668:731b:517e with SMTP id fi3-20020a056a00398300b00668731b517emr1415528pfb.24.1688075835714; Thu, 29 Jun 2023 14:57:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688075835; cv=none; d=google.com; s=arc-20160816; b=QFhmmihjfstBnqu8RbXYHUAOTWgni/Oi3CXHFLlY6jM9ldN9KOUEK5fB6wHb99bmNd CKkP/3noqmdAqGS7GamX03T9yjWuAayrprffOt4IQ2s7iVB/nI26gZ2Mh677nqK2HIJI 0lwWZCr3xUzkFxxl3BySfBQbJEbaEAbrwhOYqPwsenIstX8D/HxsBg5s4mqrTtw9RLrw EfYnNOvHoPj/rNTXVMu0mRb5JvPbLSEjjm2hELHbnEk+xoVt2CVsg441n93Rxe4OXkqd 8d9AcPt4ToVAPcF4JXM2YiDdNfQXLo2iNTc7u4ooM7BTMW3MJ7o9ZlsAOgx+yuc0MNjs Dydg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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; bh=MWtovdK/3uz2LYIsdCKmQKFU5HPO0poKnsffvN4gA+4=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=CTPN1I4kDY4+aHxls8dgNGVt6pmLbb7IMKH7T7I5ba2/zsLxM5KXWUjCeZWptLVD4X +B69czBj+HbgvvXp4LV3bqEQCI6MqXFv5Li513nyQfS87A7cbogzk6SBajATi4q00+Qv FHUWoVtjRxIxSd30HyhLVzE0UzE8ZSQUo+xXHWGar3QwccPKaLrk26LrYeG6KLcUVtaJ Vn9O6SUJRU39HWC+PQFTH+5cWiLJmt6PYXb6r53yK8c1zL/TMyBo0ofKgyfNiw+vzUm9 2+/uved3Gv4RkzFENkoZdRGIXHWjjnX1ZbkMMa7p9CKxwfb66/W6XatzrmgxjvcT4uez fdDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=dE6uufOc; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=gHYUQF3H; 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 Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id cm26-20020a056a00339a00b0067d2eeacad6si5536017pfb.338.2023.06.29.14.57.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Jun 2023 14:57:15 -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=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=dE6uufOc; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=gHYUQF3H; 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 Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1qEzcq-0007qw-Tz; Thu, 29 Jun 2023 21:56:29 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qEzcm-0007qd-I1 for openvpn-devel@lists.sourceforge.net; Thu, 29 Jun 2023 21:56:24 +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=MHl/WMg7Lr+JaoekX6EyIecsRfprV6B4kFSvb3Vzx2c=; b=dE6uufOcvtS9kLUChKfEF3eKv7 REsDuG93YAjgSG3gMSzw2kckR8O5MjLP/enyeihPAeP8Q3z1R+2i1udqWtIWEYpJ3CfhfvbNvvHxT 0KAm4fYti33/Uj6KDiOMTJhfx4BNEGmQY8wfH2yKz4ZzYFaaPc2YcMxg3yAdOQWi1Hoo=; 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=MHl/WMg7Lr+JaoekX6EyIecsRfprV6B4kFSvb3Vzx2c=; b=gHYUQF3H2kMtoOLBV9ftw+8FgE zPfU/eNG/Hjxivsv+2KOPk64s37Ab2UdvpA34Qcgw30YDXAQIw4vVt0Z4hA0aeXJGpQlCuyyFSDHS ztBEBj4zWZum0qp0PHmpuzvpdJW4hzr9RBuUYo+dMjVY1U69x4VR2S+aqe86tqAppVqY=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1qEzcm-0002GQ-74 for openvpn-devel@lists.sourceforge.net; Thu, 29 Jun 2023 21:56:24 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.95 (FreeBSD)) (envelope-from ) id 1qEzcZ-0004WV-Fs for openvpn-devel@lists.sourceforge.net; Thu, 29 Jun 2023 23:56:11 +0200 Received: (nullmailer pid 3292839 invoked by uid 10006); Thu, 29 Jun 2023 21:56:11 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Thu, 29 Jun 2023 23:56:08 +0200 Message-Id: <20230629215611.3292788-3-arne@rfc2549.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230629215611.3292788-1-arne@rfc2549.org> References: <20230629215611.3292788-1-arne@rfc2549.org> MIME-Version: 1.0 X-Spam-Score: 0.3 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-1.v13.lw.sourceforge.com", 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: The -Wno-stringop-truncation flag is only supported by some GCC versions and not by Clang (macOS, FreeBSD) at all. Move the includes to the top the file to have them available when running the check_c_compiler_flag. Content analysis details: (0.3 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 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: 1qEzcm-0002GQ-74 Subject: [Openvpn-devel] [PATCH 2/4] [CMake] Only add -Wno-stringop-truncation on supported compilers 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?1770075807364637940?= X-GMAIL-MSGID: =?utf-8?q?1770075807364637940?= The -Wno-stringop-truncation flag is only supported by some GCC versions and not by Clang (macOS, FreeBSD) at all. Move the includes to the top the file to have them available when running the check_c_compiler_flag. Change-Id: I452bc4ee935d13f8e9095d0a31805a3bbaff0cec Signed-off-by: Arne Schwabe Acked-by: Frank Lichtenheld --- CMakeLists.txt | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3cbba5a38..acebbb73c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,14 @@ project(openvpn) # and OpenSSL having version 1.1.1+ and generally does not offer the same # configurability like autoconf +find_package(PkgConfig REQUIRED) +include(CheckSymbolExists) +include(CheckIncludeFiles) +include(CheckCCompilerFlag) +include(CheckTypeSize) +include(CheckStructHasMember) +include(CTest) + option(UNSUPPORTED_BUILDS "Allow unsupported builds" OFF) if (NOT WIN32 AND NOT ${UNSUPPORTED_BUILDS}) @@ -70,7 +78,12 @@ else () set(CMAKE_CXX_FLAGS_RELEASE "-O2") set(CMAKE_C_FLAGS_DEBUG "-g -O1") set(CMAKE_CXX_FLAGS_DEBUG "-g -O1") - add_compile_options(-Wall -Wuninitialized -Wno-stringop-truncation) + add_compile_options(-Wall -Wuninitialized) + check_c_compiler_flag(-Wno-stringop-truncation NoStringOpTruncation) + + if (${NoStringOpTruncation}) + add_compile_options(-Wno-stringop-truncation) + endif() # We are not ready for this #add_compile_options(-Wconversion -Wno-sign-conversion -Wsign-compare) if (USE_WERROR) @@ -78,13 +91,6 @@ else () endif () endif () -find_package(PkgConfig REQUIRED) -include(CheckSymbolExists) -include(CheckIncludeFiles) -include(CheckTypeSize) -include(CheckStructHasMember) -include(CTest) - find_program(PYTHON NAMES python3 python) execute_process( COMMAND ${PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/contrib/cmake/parse-version.m4.py ${CMAKE_CURRENT_SOURCE_DIR}/version.m4