From patchwork Sun Dec 22 00:04:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 852890 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp2770091wrq; Sat, 21 Dec 2024 16:16:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUPZTPFNtZqo0bCKX+2kz1/ulHVfbMxbIRqmy0/LZ6aHjPw85/VWRdWwnpNrNQpmOziOPeYhw==@linaro.org X-Google-Smtp-Source: AGHT+IGWucPnozxz8bxJ2v2Jw5UiqWBXxo9s9ugVYH+0TeH6n8RsI6GJ9JE4C18VSuZTQyBSol8K X-Received: by 2002:a05:620a:2492:b0:7b6:e697:2090 with SMTP id af79cd13be357-7b9ba6efae9mr1229901385a.2.1734826580826; Sat, 21 Dec 2024 16:16:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1734826580; cv=pass; d=google.com; s=arc-20240605; b=kEGWOoy4PrjDpYthF+JFPAG7UaviLBCKbicXFlA4eDWldm+LK1Gj+I9U1n5zxlUhYM iYTcRbhUaw3GYIoqEXrv3SWW4QoRv7aHuPliCmjIWSFO97fOZvtziMdF/27mTpyHUuPU wZAxxUO3E/CNtFZjN69zrIfvczZ9MXWpZA/lqGApcTg4snRIlStqaYyu54C2l4ykNtE/ NAq+pMcVmC993dNAP2I61ZlTyqA4OCc4qPjvJQa4rWpWo3kSl8xbnoF4GrI5l7hfao8V WvhJw5+sS2sAUr44Ave9gBp/bpYImPScYJqrmGd4VzNNlHVz2KbtkToywPrpwAMVY4qD Jm/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=pwrrHyujSS4Myl2i2NgXhGJUi/gyp4PWMg+knDULkbE=; fh=uKlFkH9AUukvL1xmvBA9M7Oe4ntiJIR8HCR4+3TPd4w=; b=PCzCf5PokJhoSJoyeZ2gI3nepBpPTTEOmMzMsMgjySY6YLlEasbA4LI8H1C3Uk+0uj YhNMucvzKhNzpRvyMJAqkVz8vxzi1NQjYJIxYPS7tuBHTr37l0s1HttD7iIJESPXXfXF f6UoqZOKp0U9tSLLoSdY+EX2D1cF8oVxx4FRbX7VS9/i/4cBvVYGl4mMVYx2qo+tIBL7 r44mMcisDOZUw9CzLWI1FWDejUqnx8kVQupgLgiLkqGxu5XjpRPr692Ztt1dLsrqxNt3 KGQRnLzQ0RKA+30RgQcv7On/itQaGM1uc0JFbzdnHQ51RbMXLk6sgTfU5aljl/81ZFks ExKQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jD9LdCDU; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id af79cd13be357-7b9ac4facb3si760390485a.548.2024.12.21.16.16.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Dec 2024 16:16:20 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jD9LdCDU; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6A5303858C35 for ; Sun, 22 Dec 2024 00:16:20 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id 8DD433857C63 for ; Sun, 22 Dec 2024 00:05:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8DD433857C63 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8DD433857C63 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734825930; cv=none; b=J8BHTYg995I0ROYKFZmKifbzz157HSb5OKsQ/q1glRPHApBmJ/i5J0bWdMy036ZcuGLuJ84ZPf3wNhtQVU4nPnm0XDYc0TMief2FHp4w1a+5t0DdJzl2gDeRm5A4x5k4gYEaAtX1ipnRATiRSg/+IreOLzebTell1mo/Myl4q4Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734825930; c=relaxed/simple; bh=8SVyivs9vqtv8qzMUALBsbSzGRRMOV2z+J19fsFCvIs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=QQ06j5OW9/BWtUu97kvl8m6rz86L6W9YZQY+WrjP+SmwVA9qsnK+kzrBYLcQtYdM2suehsGhY5ysZgGbWlELDzoDRQT22rxtiLV2CRbE4ApHdn8Xl32jNN0bBZYD/6m2FmyCxDOrPLJUr3GILMNbgGg8IM6d1L5hfLpg3o/SrKo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-218c8aca5f1so34008765ad.0 for ; Sat, 21 Dec 2024 16:05:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734825924; x=1735430724; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pwrrHyujSS4Myl2i2NgXhGJUi/gyp4PWMg+knDULkbE=; b=jD9LdCDUmDPcBSjTTksyVprU6R0eulkpDMgCE8lfuhf6nsSLaZlprlBP3YpcZl74p4 Vl1UJbYmgwkD9q/PIXxoDfgbz3nr4LbPxN6RulvPyb5JU5KIkEaIuduub18gvX7Nvf7f sKP++gEc9LPo+A8tXJqCoGWkdk/pLgqkBJ91+YC0OeqdqYauWualfqxOsBh6o281rGEr KL5CETDXlMygRNZ+YJF5bFQthoJbJWOX1NnSxUcO003AsgDAluc1LGlWFl8qojnDq0Mj laFdVDYPulzufj5ce+0w/395t01fRUdhTNRkpVsnXLYXacuLNDttWb2Ao6ZT57aYAVRp 50Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734825924; x=1735430724; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pwrrHyujSS4Myl2i2NgXhGJUi/gyp4PWMg+knDULkbE=; b=icOb01ikyzP5JSTFTVWEYxTEeOEFaVmJgFhvAmazOpgNaq0lQcZuNKcePpn7eDZmSj eNOeFyNCmCuc1HBiA+iYd7oYs5IUK24krtFF1BFwrDw2CtkIBqnGDvpY1EMkHs6SmfvX JJGEaFmQy/Vi5iLHnxuZs1+byNog78bbRqIO5WndslrWd2+veGjHk0vLn3sFcmIXiIvy 3BfJuSXuGXGZxDfBmfxT0T2IolxROv9GIvJBxXusmS8rhHT5nv5X3jpi+MR1r+XPRLK+ lFmg+708WzFhW2wQXSbqZLQGcbR/3cxTZ4BaTTIpZMIk2TlJGuvxlHBZxYTnGLAECZXc mAhg== X-Gm-Message-State: AOJu0YxUHBnW9QochkUCi7KEVnMDtq9H/x9wbfhcIrkN3NqNNHLT3Wle byNnlZdNFmp8mbkfapE48ibjUSI1WH5tIKHnib6CCiz+vBdfqRvEm+yF7DGE8Ff9oQ== X-Gm-Gg: ASbGncs2Vz6Oq7kFag3IsQRF2P2ODYOM5VmDn1iotF00TsUJAKIvbvtkfzrytJzpZBa r5fIbxse9dSoqrGlwlhy4/Vsj/3DQQUuyyf8IFqnerTNgvxocaGxvkZe4e51iFn4cstuMZ82Pma 9l4FQsEbQjYa6o8AbhcFfzx+zkpNc7u4YiINXUvnRhHerq0OMmE2YPfadoyZjuR58ixiKlBV9HG TwM7+nbwDthr42TogJKxBA/Sy6vvWv5WJGnIf/nYkV7L3tS4foT4FHnW6x5jtt/axQ4tDI= X-Received: by 2002:a17:902:d2c6:b0:216:2bd7:1c36 with SMTP id d9443c01a7336-219e6e8bbb6mr113427095ad.1.1734825924602; Sat, 21 Dec 2024 16:05:24 -0800 (PST) Received: from gnu-tgl-3.localdomain ([120.204.185.181]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc9630cesm49330995ad.44.2024.12.21.16.05.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Dec 2024 16:05:24 -0800 (PST) Received: from gnu-tgl-3.lan (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id 23B12C0840; Sun, 22 Dec 2024 08:05:15 +0800 (CST) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: sam@gentoo.org, Adhemerval Zanella Subject: [PATCH 22/39] Add clang specific warnings suppress macros Date: Sun, 22 Dec 2024 08:04:45 +0800 Message-ID: <20241222000509.2205895-23-hjl.tools@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241222000509.2205895-1-hjl.tools@gmail.com> References: <20241222000509.2205895-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patch=linaro.org@sourceware.org From: Adhemerval Zanella Four new macros are added: * DIAG_{PUSH,POP}_NEEDS_COMMENT_CLANG are similar to DIAG_{PUSH,POP}_NEEDS_COMMENT, but enable clang specific pragmas to handle warnings for options only supported by clang. * DIAG_IGNORE_NEEDS_COMMENT_{CLANG,GCC} are similar to DIAG_IGNORE_NEEDS_COMMENT, but enable the warning suppression only for the referenced compiler. Reviewed-by: Sam James --- include/libc-diag.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/libc-diag.h b/include/libc-diag.h index 4b1c916756..7666a386f3 100644 --- a/include/libc-diag.h +++ b/include/libc-diag.h @@ -38,6 +38,16 @@ /* Pop diagnostic state. */ #define DIAG_POP_NEEDS_COMMENT _Pragma ("GCC diagnostic pop") +/* These macros are used to push/pop diagnostic states for warnings only + supported by clang. */ +#ifdef __clang__ +# define DIAG_PUSH_NEEDS_COMMENT_CLANG _Pragma ("clang diagnostic push") +# define DIAG_POP_NEEDS_COMMENT_CLANG _Pragma ("clang diagnostic pop") +#else +# define DIAG_PUSH_NEEDS_COMMENT_CLANG +# define DIAG_POP_NEEDS_COMMENT_CLANG +#endif + #define _DIAG_STR1(s) #s #define _DIAG_STR(s) _DIAG_STR1(s) @@ -71,4 +81,16 @@ # define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option) #endif +/* Similar to DIAG_IGNORE_NEEDS_COMMENT, these macros should be used + to suppress warning supported by the specific compiler. */ +#ifndef __clang__ +# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING) \ + DIAG_IGNORE_NEEDS_COMMENT (VERSION, WARNING) +# define DIAG_IGNORE_NEEDS_COMMENT_CLANG(version, option) +#else +# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING) +# define DIAG_IGNORE_NEEDS_COMMENT_CLANG(version, option) \ + _Pragma (_DIAG_STR (clang diagnostic ignored option)) +#endif + #endif /* libc-diag.h */