From patchwork Mon Jun 24 23:26:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Liaw X-Patchwork-Id: 13710262 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8610C1A2C1F for ; Mon, 24 Jun 2024 23:29:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719271750; cv=none; b=DruSs6UahKi2fqhpgG441DkLV+PAPhDCQH0y59JQKHrE3yG4T2tj6pKuduwJRIQkrY9MesGecBfnuPElnsv5Q+KACHU84PxTmGzxoV5arTrHoC8yEyFxY9kv/kQ3lPUqb+/7s3GxyNjOgkeBOWrlEiA1v7aQwJ3eIMRyt0vzeRY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719271750; c=relaxed/simple; bh=xwftBfRu5G8w7ol9IF7MUG9BSiGvoLKlVTWAOAeO/Is=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ael4w5QRxFB+hI9qR+JLsUIu6WY6LQNkaZvuluDXrvz+5OBF4na1jLCy5wjXqfxf0TvgHrc5CTDRxmiO0QR2KhGopMCYJRcRarBS+qJZ++A/4xgw2FIncdOTPYBf1Dp0ssFeWHh+nVZxGjYK5AIxQb0PsfrLHC5x6rSdvz8eAm0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edliaw.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=upDGTY+V; arc=none smtp.client-ip=209.85.215.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edliaw.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="upDGTY+V" Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-6e3341c8865so6340399a12.1 for ; Mon, 24 Jun 2024 16:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1719271747; x=1719876547; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Y7F8R5HE+eZyxlB2ebQLwW1FMzverfSOUo2IuXKNmLY=; b=upDGTY+VAWxjOiGt1aN8qq/MXQcXxCGhECKCR+u/ehZUHokbQYBzXGPPb67Ib14AYJ WS+Icm1jnUp19BMdXpFSNeL98mC+XEUCbkDJQQdWPHozIzclQDGsE2NnJ/l/XJ+h7O1m BssvmwEpWtykYwfNxyQEQFmdtvyoEdRIcIsrBkQADycUJB0CmlZmdQklWhhB6zAEHG/I qmHXlzQINVs+7F8iOa8zPeFNnGQXynyT4+QVgszv5DndlHQ29J5RjVYvVlGrSXxJBBls 8ZRfhzFO9fvFPh6hFHx772LXsRysy4ieIYujQB+oSWpQi4Cn3AKoENJq6O/tqt0a8G82 yRAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719271747; x=1719876547; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Y7F8R5HE+eZyxlB2ebQLwW1FMzverfSOUo2IuXKNmLY=; b=VES8usLm7Da9aoCByvd++kToH6zyWjKAQJ7Ic7xrXGiJW2TqBRpxDGSyFYKkWxr5P4 8r3JnQnKVBjiwkPBwkeIJr9ZOJjJWsO/hKA0IG3kSVUvCHNIlIGjdludvrqo3VSLTROZ E+Hc8ymAc4wkgYztDWozUGDjMWljSlstiIr4amEV7Q2/D95igG40Eh6cxXdKoL8R6iI5 HdNnh5rWAwWVq3yk4QSabOrirn35Pfl1T3oY3KQ6SuGy00WVt6/3sdh3ueHyOtV+npKa S9E92ml1ZAO38vCx+1WbN38ODlw4mh0xRL5lpzszfOcD//nVg+TcaHyjZJ3IphGa1H07 KX6g== X-Forwarded-Encrypted: i=1; AJvYcCXf3etq0b7jmE91/dUGMVUnK3Yh1xhtZ5vu//SbAyldDQk393/JEUw1+HJg/hnSn4rOl8JQmGb5gFhUnizJK7BsjelvdR4V0U1iVOYs2Q== X-Gm-Message-State: AOJu0YxljD1mS6vT7vCf3oh+33dQTgJNDKcpVENjtj3q7UQvmT7ZkgmU uoXchHa+4p6tznLjc9gtJ7SLPaWepj+eDi9yPn8G9qhrwbTnPJmesFDgPV8mNgnMxmZdhp30tml ggQ== X-Google-Smtp-Source: AGHT+IFY6zwuM+fBRs+r7yFjUxfbkM+X5No4nRI5eUjSYyy4xzwRR2NKqiye6S+BJr7Hl1+KVMRcw6AW1Us= X-Received: from edliaw.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:305d]) (user=edliaw job=sendgmr) by 2002:a17:902:f693:b0:1f7:3763:5ff0 with SMTP id d9443c01a7336-1fa158d034emr7382275ad.1.1719271746792; Mon, 24 Jun 2024 16:29:06 -0700 (PDT) Date: Mon, 24 Jun 2024 23:26:11 +0000 In-Reply-To: <20240624232718.1154427-1-edliaw@google.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240624232718.1154427-1-edliaw@google.com> X-Mailer: git-send-email 2.45.2.741.gdbec12cfda-goog Message-ID: <20240624232718.1154427-3-edliaw@google.com> Subject: [PATCH v6 02/13] selftests: Add -D_GNU_SOURCE= to CFLAGS in lib.mk From: Edward Liaw To: linux-kselftest@vger.kernel.org, Eric Biederman , Kees Cook , Shuah Khan , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Darren Hart , Davidlohr Bueso , " =?utf-8?q?Andr=C3=A9_Almeida?= " , Jason Gunthorpe , Kevin Tian , Paolo Bonzini , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Fenghua Yu , Reinette Chatre , Paul Walmsley , Palmer Dabbelt , Albert Ou , Jarkko Sakkinen , Dave Hansen Cc: linux-kernel@vger.kernel.org, usama.anjum@collabora.com, seanjc@google.com, kernel-team@android.com, Edward Liaw , linux-mm@kvack.org, iommu@lists.linux.dev, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sgx@vger.kernel.org, John Hubbard Centralizes the _GNU_SOURCE definition to CFLAGS in lib.mk. This uses the form "-D_GNU_SOURCE=", which is equivalent to "#define _GNU_SOURCE". Otherwise using "-D_GNU_SOURCE" is equivalent to "-D_GNU_SOURCE=1" and "#define _GNU_SOURCE 1", which is less commonly seen in source code and would require many changes in selftests to avoid redefinition warnings. Suggested-by: John Hubbard Signed-off-by: Edward Liaw --- tools/testing/selftests/lib.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index 7b299ed5ff45..d6edcfcb5be8 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -196,6 +196,9 @@ endef clean: $(if $(TEST_GEN_MODS_DIR),clean_mods_dir) $(CLEAN) +# Build with _GNU_SOURCE by default +CFLAGS += -D_GNU_SOURCE= + # Enables to extend CFLAGS and LDFLAGS from command line, e.g. # make USERCFLAGS=-Werror USERLDFLAGS=-static CFLAGS += $(USERCFLAGS)