Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp359513lqh; Tue, 7 May 2024 00:56:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXJ0a7G+wH60m39OivvmzKVITnE1HpBSVjJV3DcfuvSwn5V9UoRQYMSSdTy+4e0J2UagXbTz2oYwi2iKhfSAPyEiYtNDG6TIq8eoLYC8w== X-Google-Smtp-Source: AGHT+IEZ573dVY40qF8rhGCZlkhFSk60TJsVfQfGxIQX8Rebjt0Cw4uT5l27XgNsj+kDbjqDmBvR X-Received: by 2002:a05:6214:27c8:b0:69b:1d1b:5609 with SMTP id ge8-20020a05621427c800b0069b1d1b5609mr14633137qvb.65.1715068617314; Tue, 07 May 2024 00:56:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715068617; cv=pass; d=google.com; s=arc-20160816; b=JfiyYW/BTIMvgmsAESWAyA5XkJoCRTpomCcz0VyGyeHKY16btfJ+gnyhS0fS6JljH4 yl7UIrDQlp10jQGIEY6lkozgy/YpO+4i9S3G9hTjr6umTX9yn54J5KTgOh1T03y7gmGA QNF2rTBdPPVipYSOw6uY+GFv00C/u6btJPepcEwH3/oQp4TPXlxHKTuGy6Y8/daEW8nA 5WQ7pjmKuM8EWrYEMwc+W0ShHUKmPXVkWLXKyief2cETdNRUPCPQRbG+lCk6Cb1d6SNC lyHqg2RuzMnpisFxitljJ8J2WJEj4ZzHqJKcFG/YiG98/m8uPrnlJLnSUL6qNdDPNIem YDEA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=7T4whit5j1fRsEVbaW2LMAO29pvi+DKf06DiC9PWKa4=; fh=B48armJ0GcWJbawvoPKHzyAqGTwcjlaxUux31ITNdjg=; b=oaWIqZFkHt+TCYRnexI59McP/SoZCLGvDhG3yCsNcZinOE4gR1JuI7pE/89xqEyxQ9 L2Fvghsrql1Y4toI80DuZquIjAW/S1L5iuJaAXCIkzFAOsrzVQ0ywrx6AepcsZQXY517 eBNUZjjGBMRrliaYhJ0wzvQcTPc81PQPmsXcN+uAriSfma8EzprarsRfO/FVzY8QJDoc 1hPsHrlKL8X0udhlMz1cac9LA3uJ8JdFWmKgssAxeKER7Sa/WrP2QCSbN28eI3L3fgFe xE57jhxEtq+2Mav3pLuir3CTDc1AoVvnbjPJZmy5CwnyS6xx6ncApxZk+Q62nx4dMhRB Go9g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BcQvIL6y; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-170762-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170762-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j12-20020a05621419cc00b006a094278bf1si10981566qvc.328.2024.05.07.00.56.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 00:56:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170762-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BcQvIL6y; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-170762-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170762-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 99CE61C21C4F for ; Tue, 7 May 2024 06:38:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 056AB78C92; Tue, 7 May 2024 06:38:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="BcQvIL6y" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90AEA74267; Tue, 7 May 2024 06:38:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715063888; cv=none; b=ilaes5hP+JPTyTM3riSDfOK4R06O78mMLy5DqJLyGycNFfRmdUv2AmqNYhXyI9CtDpfW6WCzBIDD/l7D+Tciyr7nCcFTWMJF9Y3DccozL356OAe2Bci1JzxZvnrcTojVZmx/g1EvE7IdVTQ+21zGgUere1k+HqDWZYqNEzth/gs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715063888; c=relaxed/simple; bh=al2uTCbUkaO+YN6iS/CsFF1oIj/GnxrR8GTTZRDImpY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=m1q59kGR3dpkG7TvmKQKatHUciC/m7i2/TMMfo4uju+MTEooYd0pOHgpygWx/h7nv6Q2krAzitY22W18eVj+93PJbQnHaXb3FQZh3kfAv0pjqkoWo+GKWxTkpUV6I9Q5BrKqv4SNNVI3FOqlKeXfnYtCVjf3LhgBftLrGkpG6vg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=BcQvIL6y; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715063887; x=1746599887; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=al2uTCbUkaO+YN6iS/CsFF1oIj/GnxrR8GTTZRDImpY=; b=BcQvIL6yQcsTT3xBivU+wKVFTzJGuB/n0/87nk5kf4Srm7vRn4kpqWx2 T0sb8OOg7vPWyRu4wpKwa/4uflLF+Iq879gRJlXoBl2f/dop+3skUH6J7 jlRT9w08ol9Qkh0N6R1XdC/LtHfFeGyIeREGWVcNerlk4+gO6JUmsCKl7 CUqYuy6/thrjQRAw85ay2lGvB02ONtG4nEReeI30jSqm2Sj1+I3A3ncM+ 85ADFyhJYj7WPy5nxQa5xhbJYB+0tU8IiUQvmyL0J9CZLfq01ldR68aFj thTqp6CcEWzS1goEvlqf+v0cvmUc3grqqntOjtyLG57DiKd6/oudWM/Ab g==; X-CSE-ConnectionGUID: ytcKcyc+Q5SmMDe+NMFAZQ== X-CSE-MsgGUID: 7RdM4LPVSzCnnBv5DrS6lA== X-IronPort-AV: E=McAfee;i="6600,9927,11065"; a="28360753" X-IronPort-AV: E=Sophos;i="6.07,260,1708416000"; d="scan'208";a="28360753" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 23:38:06 -0700 X-CSE-ConnectionGUID: 0rO5EyK9SOGK0zZ0OrTZ8w== X-CSE-MsgGUID: d7fc7jBVRbqxLmJn3Qedww== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,260,1708416000"; d="scan'208";a="65861231" Received: from unknown (HELO st-server.bj.intel.com) ([10.240.193.102]) by orviesa001.jf.intel.com with ESMTP; 06 May 2024 23:38:00 -0700 From: Tao Su To: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-rtc@vger.kernel.org, linux-sgx@vger.kernel.org Cc: akpm@linux-foundation.org, edliaw@google.com, ivan.orlov0322@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, shuah@kernel.org, seanjc@google.com, pbonzini@redhat.com, bongsu.jeon@samsung.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, alexandre.belloni@bootlin.com, jarkko@kernel.org, dave.hansen@linux.intel.com, tao1.su@linux.intel.com Subject: [PATCH] selftests: Add _GNU_SOURCE definition when including kselftest_harness.h Date: Tue, 7 May 2024 14:35:34 +0800 Message-Id: <20240507063534.4191447-1-tao1.su@linux.intel.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit asprintf() is declared in stdio.h when defining _GNU_SOURCE, but stdio.h is so common that many files don’t define _GNU_SOURCE before including stdio.h, and defining _GNU_SOURCE after including stdio.h will no longer take effect. Since kselftest_harness.h introduces asprintf(), it is necessary to add _GNU_SOURCE definition in all selftests including kselftest_harness.h, otherwise, there will be warnings or even errors during compilation. There are already many selftests that define _GNU_SOURCE or put the include of kselftest_harness.h at the very beginning of the .c file, just add the _GNU_SOURCE definition in the tests that have compilation warnings. Fixes: 809216233555 ("selftests/harness: remove use of LINE_MAX") Signed-off-by: Tao Su --- tools/testing/selftests/alsa/test-pcmtest-driver.c | 1 + tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c | 1 + tools/testing/selftests/nci/nci_dev.c | 1 + tools/testing/selftests/net/bind_wildcard.c | 1 + tools/testing/selftests/net/ip_local_port_range.c | 1 + tools/testing/selftests/net/reuseaddr_ports_exhausted.c | 1 + tools/testing/selftests/prctl/set-anon-vma-name-test.c | 1 + tools/testing/selftests/prctl/set-process-name.c | 1 + tools/testing/selftests/rtc/rtctest.c | 1 + tools/testing/selftests/sgx/main.c | 1 + tools/testing/selftests/tdx/tdx_guest_test.c | 1 + tools/testing/selftests/user_events/dyn_test.c | 1 + tools/testing/selftests/user_events/ftrace_test.c | 1 + tools/testing/selftests/user_events/perf_test.c | 1 + 14 files changed, 14 insertions(+) diff --git a/tools/testing/selftests/alsa/test-pcmtest-driver.c b/tools/testing/selftests/alsa/test-pcmtest-driver.c index ca81afa4ee90..5a01100d459d 100644 --- a/tools/testing/selftests/alsa/test-pcmtest-driver.c +++ b/tools/testing/selftests/alsa/test-pcmtest-driver.c @@ -5,6 +5,7 @@ * * Copyright 2023 Ivan Orlov */ +#define _GNU_SOURCE #include #include #include "../kselftest_harness.h" diff --git a/tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c b/tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c index f3c2239228b1..40f3e81b1a6c 100644 --- a/tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c +++ b/tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c @@ -4,6 +4,7 @@ * * Tests for KVM paravirtual feature disablement */ +#define _GNU_SOURCE #include #include #include diff --git a/tools/testing/selftests/nci/nci_dev.c b/tools/testing/selftests/nci/nci_dev.c index 1562aa7d60b0..7cf18aced644 100644 --- a/tools/testing/selftests/nci/nci_dev.c +++ b/tools/testing/selftests/nci/nci_dev.c @@ -6,6 +6,7 @@ * Test code for nci */ +#define _GNU_SOURCE #include #include #include diff --git a/tools/testing/selftests/net/bind_wildcard.c b/tools/testing/selftests/net/bind_wildcard.c index b7b54d646b93..f271e2ee6c7a 100644 --- a/tools/testing/selftests/net/bind_wildcard.c +++ b/tools/testing/selftests/net/bind_wildcard.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright Amazon.com Inc. or its affiliates. */ +#define _GNU_SOURCE #include #include diff --git a/tools/testing/selftests/net/ip_local_port_range.c b/tools/testing/selftests/net/ip_local_port_range.c index 193b82745fd8..fadefb0ab147 100644 --- a/tools/testing/selftests/net/ip_local_port_range.c +++ b/tools/testing/selftests/net/ip_local_port_range.c @@ -7,6 +7,7 @@ * Don't run these directly but with ip_local_port_range.sh script. */ +#define _GNU_SOURCE #include #include diff --git a/tools/testing/selftests/net/reuseaddr_ports_exhausted.c b/tools/testing/selftests/net/reuseaddr_ports_exhausted.c index 066efd30e294..4f6fb2fbb96d 100644 --- a/tools/testing/selftests/net/reuseaddr_ports_exhausted.c +++ b/tools/testing/selftests/net/reuseaddr_ports_exhausted.c @@ -17,6 +17,7 @@ * * Author: Kuniyuki Iwashima */ +#define _GNU_SOURCE #include #include #include diff --git a/tools/testing/selftests/prctl/set-anon-vma-name-test.c b/tools/testing/selftests/prctl/set-anon-vma-name-test.c index 4275cb256dce..e5ea821be241 100644 --- a/tools/testing/selftests/prctl/set-anon-vma-name-test.c +++ b/tools/testing/selftests/prctl/set-anon-vma-name-test.c @@ -3,6 +3,7 @@ * This test covers the anonymous VMA naming functionality through prctl calls */ +#define _GNU_SOURCE #include #include #include diff --git a/tools/testing/selftests/prctl/set-process-name.c b/tools/testing/selftests/prctl/set-process-name.c index 562f707ba771..9cbfe9d38d72 100644 --- a/tools/testing/selftests/prctl/set-process-name.c +++ b/tools/testing/selftests/prctl/set-process-name.c @@ -3,6 +3,7 @@ * This test covers the PR_SET_NAME functionality of prctl calls */ +#define _GNU_SOURCE #include #include #include diff --git a/tools/testing/selftests/rtc/rtctest.c b/tools/testing/selftests/rtc/rtctest.c index 63ce02d1d5cc..2ace7a75c638 100644 --- a/tools/testing/selftests/rtc/rtctest.c +++ b/tools/testing/selftests/rtc/rtctest.c @@ -5,6 +5,7 @@ * Copyright (c) 2018 Alexandre Belloni */ +#define _GNU_SOURCE #include #include #include diff --git a/tools/testing/selftests/sgx/main.c b/tools/testing/selftests/sgx/main.c index 9820b3809c69..bb6e795d06e2 100644 --- a/tools/testing/selftests/sgx/main.c +++ b/tools/testing/selftests/sgx/main.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright(c) 2016-20 Intel Corporation. */ +#define _GNU_SOURCE #include #include #include diff --git a/tools/testing/selftests/tdx/tdx_guest_test.c b/tools/testing/selftests/tdx/tdx_guest_test.c index 81d8cb88ea1a..f966467d1ef1 100644 --- a/tools/testing/selftests/tdx/tdx_guest_test.c +++ b/tools/testing/selftests/tdx/tdx_guest_test.c @@ -7,6 +7,7 @@ * Author: Kuppuswamy Sathyanarayanan */ +#define _GNU_SOURCE #include #include diff --git a/tools/testing/selftests/user_events/dyn_test.c b/tools/testing/selftests/user_events/dyn_test.c index bdf9ab127488..9d090ba3bfc3 100644 --- a/tools/testing/selftests/user_events/dyn_test.c +++ b/tools/testing/selftests/user_events/dyn_test.c @@ -5,6 +5,7 @@ * Copyright (c) 2021 Beau Belgrave */ +#define _GNU_SOURCE #include #include #include diff --git a/tools/testing/selftests/user_events/ftrace_test.c b/tools/testing/selftests/user_events/ftrace_test.c index dcd7509fe2e0..25adef590a94 100644 --- a/tools/testing/selftests/user_events/ftrace_test.c +++ b/tools/testing/selftests/user_events/ftrace_test.c @@ -5,6 +5,7 @@ * Copyright (c) 2021 Beau Belgrave */ +#define _GNU_SOURCE #include #include #include diff --git a/tools/testing/selftests/user_events/perf_test.c b/tools/testing/selftests/user_events/perf_test.c index 5288e768b207..176740a0fc02 100644 --- a/tools/testing/selftests/user_events/perf_test.c +++ b/tools/testing/selftests/user_events/perf_test.c @@ -5,6 +5,7 @@ * Copyright (c) 2021 Beau Belgrave */ +#define _GNU_SOURCE #include #include #include base-commit: dccb07f2914cdab2ac3a5b6c98406f765acab803 -- 2.34.1