From patchwork Mon May 20 08:04:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Chestnykh X-Patchwork-Id: 1936958 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=kpIgGs45; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=uclibc-ng.org (client-ip=2a00:1828:2000:679::23; helo=helium.openadk.org; envelope-from=devel-bounces@uclibc-ng.org; receiver=patchwork.ozlabs.org) Received: from helium.openadk.org (helium.openadk.org [IPv6:2a00:1828:2000:679::23]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VjVVM4pCVz1ynR for ; Mon, 20 May 2024 18:05:13 +1000 (AEST) Received: from helium.openadk.org (localhost [IPv6:::1]) by helium.openadk.org (Postfix) with ESMTP id 53616353539B; Mon, 20 May 2024 10:04:56 +0200 (CEST) Authentication-Results: helium.openadk.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=kpIgGs45; dkim-atps=neutral Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) by helium.openadk.org (Postfix) with ESMTPS id 56D1735282F2 for ; Mon, 20 May 2024 10:04:51 +0200 (CEST) Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-5238b2ad2f6so377297e87.1 for ; Mon, 20 May 2024 01:04:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716192290; x=1716797090; darn=uclibc-ng.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=KH7IZJqWCPdJa94ZHtcG1dgkpmBjGLOvUYq0DJMayEs=; b=kpIgGs45wbA0yFQSmWN4cbK+F3Y+1J0Nyie+2QqCp2dLs8WDDPAmy0i4KP3GtksB6+ Z85mbBKdph5PwcyQ2Nny93Banp4Fz5q9Oq40Qt2dDKPzUP0RWS/bB4aRir/aE8WiPu7c KUO7thmwt4edSJ0kvNz25LLz+NqwK0RzHn4L7U9cYG3zppWVxLAkzIH5OLAayCqf8gky /GmB1wRVRLAvGPBSPiwc4tjWeKW9EfmimzB3KePQH99b7ikDq2+y/cyFQ+2CYrvLutSN dADoU4rz+rKnqr6AwGPLOi/05aEckUlwIDRCnOQCR61eqDqqKoVkxT4YtSO4TQQ9iRfK TVcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716192290; x=1716797090; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KH7IZJqWCPdJa94ZHtcG1dgkpmBjGLOvUYq0DJMayEs=; b=Iv/7MMkLw8fu3chdMmdcNRas6ip5kH9+QV9pIE4J9lJoy3uC/IKjrdKtmNRjblf7sT VJ61uhyL5L7qJZw+tYsAb/aSDOL9RGu790GrB59vPwr/xgIsMjrEovz/NQ2EU2N4IuBz VMThom0cq77bg/2PWmTgeHw8Zsi/kKdy3xkP3PyNnvJU3rYDuvTrb5gM2ThXv+LgioS7 ORz98MR43G1LMCbxl7Ov4bXmBKbMxu5VrHcsjYajS6Of12rajs1WZtF8+rzEk+J1bjJ+ HYLAqzDqYC/SUDsFFb97V/q91Ha4FEFzBNJ/jeG4jGFRq7o0iLb/BDEvkSdQxeMshbEi I7Sw== X-Gm-Message-State: AOJu0YwC20AUuNt9D2XaQzNW4IXQCGqJDdW6XF8CEUdccVW+9yZ8FdqJ DdcKc1GBd3U1HJFpE3qeW7mbEZcgLdQYLx+DVIn/KsQfM2ONzkp52LD+2Q== X-Google-Smtp-Source: AGHT+IGmqedSu+an/ujwTHQCgsG+9MQAyQ0nqZKKU5TdMk90N4txZnZ5XmFLW3lBM8lJoAPL6fl/6g== X-Received: by 2002:a05:6512:1586:b0:51f:40a6:234a with SMTP id 2adb3069b0e04-522105846f2mr18688249e87.4.1716192289724; Mon, 20 May 2024 01:04:49 -0700 (PDT) Received: from localhost.localdomain (109-252-38-243.nat.spd-mgts.ru. [109.252.38.243]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-521f35ba91dsm4185435e87.68.2024.05.20.01.04.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 01:04:49 -0700 (PDT) From: Dmitry Chestnykh To: devel@uclibc-ng.org Date: Mon, 20 May 2024 11:04:36 +0300 Message-ID: <20240520080436.195151-1-dm.chestnykh@gmail.com> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 Message-ID-Hash: TGXLNHPUSWAVA5526VJY5BZ5SG6CTGVU X-Message-ID-Hash: TGXLNHPUSWAVA5526VJY5BZ5SG6CTGVU X-MailFrom: dm.chestnykh@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Dmitry Chestnykh X-Mailman-Version: 3.3.3 Precedence: list Subject: [uclibc-ng-devel] [PATCH v3] Cast to proper types inside atomic macroses. List-Id: uClibc-ng Development Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: GCC-14 raises `-Wint-conversion` error if lvalues are of pointer types and rvalues are of integer types. Signed-off-by: Dmitry Chestnykh --- include/atomic.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/atomic.h b/include/atomic.h index 267aff5d5..3adcfbc5f 100644 --- a/include/atomic.h +++ b/include/atomic.h @@ -54,15 +54,15 @@ and following args. */ #define __atomic_val_bysize(pre, post, mem, ...) \ ({ \ - __typeof (*mem) __atg1_result; \ + __typeof ((__typeof (*(mem))) *(mem)) __atg1_result; \ if (sizeof (*mem) == 1) \ - __atg1_result = pre##_8_##post (mem, __VA_ARGS__); \ + __atg1_result = (__typeof ((__typeof (*(mem))) *(mem))) pre##_8_##post (mem, __VA_ARGS__); \ else if (sizeof (*mem) == 2) \ - __atg1_result = pre##_16_##post (mem, __VA_ARGS__); \ + __atg1_result = (__typeof ((__typeof (*(mem))) *(mem))) pre##_16_##post (mem, __VA_ARGS__); \ else if (sizeof (*mem) == 4) \ - __atg1_result = pre##_32_##post (mem, __VA_ARGS__); \ + __atg1_result = (__typeof ((__typeof (*(mem))) *(mem))) pre##_32_##post (mem, __VA_ARGS__); \ else if (sizeof (*mem) == 8) \ - __atg1_result = pre##_64_##post (mem, __VA_ARGS__); \ + __atg1_result = (__typeof ((__typeof (*(mem))) *(mem))) pre##_64_##post (mem, __VA_ARGS__); \ else \ abort (); \ __atg1_result; \ @@ -71,13 +71,13 @@ ({ \ int __atg2_result; \ if (sizeof (*mem) == 1) \ - __atg2_result = pre##_8_##post (mem, __VA_ARGS__); \ + __atg2_result = (int) pre##_8_##post (mem, __VA_ARGS__); \ else if (sizeof (*mem) == 2) \ - __atg2_result = pre##_16_##post (mem, __VA_ARGS__); \ + __atg2_result = (int) pre##_16_##post (mem, __VA_ARGS__); \ else if (sizeof (*mem) == 4) \ - __atg2_result = pre##_32_##post (mem, __VA_ARGS__); \ + __atg2_result = (int) pre##_32_##post (mem, __VA_ARGS__); \ else if (sizeof (*mem) == 8) \ - __atg2_result = pre##_64_##post (mem, __VA_ARGS__); \ + __atg2_result = (int) pre##_64_##post (mem, __VA_ARGS__); \ else \ abort (); \ __atg2_result; \