Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t9WOq-00Afj2-6D for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Nov 2024 21:20:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t9WOl-00DTzZ-Su for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Nov 2024 21:20:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t9WOl-00DTzQ-HP for pgsql-hackers@lists.postgresql.org; Fri, 08 Nov 2024 21:20:08 +0000 Received: from mail-il1-x133.google.com ([2607:f8b0:4864:20::133]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t9WOh-000uZL-O9 for pgsql-hackers@lists.postgresql.org; Fri, 08 Nov 2024 21:20:07 +0000 Received: by mail-il1-x133.google.com with SMTP id e9e14a558f8ab-3a5e0a3ac48so10551245ab.1 for ; Fri, 08 Nov 2024 13:20:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731100803; x=1731705603; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ttXRXq2ohLMBcUUybiMcPphQTT2RtfLiYy24cKcZmkw=; b=FTyZmI1v/48xc51i8Q6KGCh3mM+WYImyReFSLe9G1SfF4HM1/VlTutwcl5+NcFCdWx B7On7siTpQQBT19dEgUzSJoSww+hdfc+3OGsIUoTwOT4bfjxbMLl29ZF9xKYusF88WUz h5Dc5PZCtti8lAOs0fU43tSRXFznwC99DqsOoK79U4/4K91EehHKMuGqPT48I/lveObg WzBf0I6MOM/YHj5DXQuIR6A4kaYPAxU/X3l/BwIX0AUH+ev4WC/YDiRuCisSgNyPckwb pJC2MN3G3npYms1uezQvJpqxsjCBN4M2xydHKh4OkVDhK/jNXW88aLpHnqdY+G6zCBo9 n1IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731100803; x=1731705603; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ttXRXq2ohLMBcUUybiMcPphQTT2RtfLiYy24cKcZmkw=; b=wEVgoUfiM7ReZdK1fgtOC5+HJUpEdrALJGLpCVkn0xggWq0eM6lwi/7Yzq+YeU42jK 0dXcpaTF3I3KCHR0mX4uuwhRmvE5KJ/QPJl3eazC0Qe2UbsWxsuywJKF/gxgMmMz/CYE sdfOWhzQauYwlr6U7cQ6aEnXURUXcAXhe26n+kPZq1H6isVfjDanivLP9KE3JJcxhWOB S4Br+Bnx/BxuAomiOXyzL1UILB4s3NBCvJC8OFb7TozRgneRvSQP/XN31hpMyIwdbHPo IrvM5kd128I8b2abAVIXde5cDTqA2lq6uSGFXDjc4GM2z9Fr/kXVfU5kF6JONSL6nXZd XClw== X-Gm-Message-State: AOJu0Yy06uIkV7viZinFdrFXDNsuRg3T+w7UgmRxMr+kCE5dWx/IlejS QEu0RKDV2r5KYDaQBg6/x0KUzJFrUFj7pB12c/ChdGLqxBoIdxcw X-Google-Smtp-Source: AGHT+IHRZo/pi0jwyeCqm33Vw/1NaKfPQk0vQX+m1mBFa1LS3r2LFY2wRGHE0FJYyKas+LFPglJyjA== X-Received: by 2002:a05:6e02:1a82:b0:3a4:e377:d906 with SMTP id e9e14a558f8ab-3a6f19ca3f8mr42855195ab.1.1731100802673; Fri, 08 Nov 2024 13:20:02 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6ead1b74csm10531955ab.63.2024.11.08.13.20.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 13:20:01 -0800 (PST) Date: Fri, 8 Nov 2024 15:20:00 -0600 From: Nathan Bossart To: Wolfgang Walther Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Fix port/pg_iovec.h building extensions on x86_64-darwin Message-ID: References: <16989737-1aa8-48fd-8dfe-b7ada06509ab@technowledgy.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="KaAdjNLAXvgKQ+yE" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --KaAdjNLAXvgKQ+yE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Here is a new version of the patch with an updated commit message. The cfbot results [0] look good, so I plan to commit this one shortly unless someone objects. [0] https://cirrus-ci.com/build/6599760059039744 -- nathan --KaAdjNLAXvgKQ+yE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="v2-0001-Fix-sign-compare-warnings-in-pg_iovec.h.patch" From 5e7156defd3a169323e2bc354c3a3c4cb232fa67 Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Fri, 8 Nov 2024 15:16:41 -0600 Subject: [PATCH v2 1/1] Fix sign-compare warnings in pg_iovec.h. The code in question (pg_preadv() and pg_pwritev()) has been around for a while, but commit 15c9ac3629 moved it to a header file. If third-party code that includes this header file is built with -Wsign-compare on a system without preadv() or pwritev(), warnings ensue. This commit fixes said warnings by casting the result of pg_pread()/pg_pwrite() to size_t, which should be safe because we have already checked for a negative value. Author: Wolfgang Walther Discussion: https://postgr.es/m/16989737-1aa8-48fd-8dfe-b7ada06509ab%40technowledgy.de Backpatch-through: 17 --- src/include/port/pg_iovec.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/port/pg_iovec.h b/src/include/port/pg_iovec.h index 7255c1bd91..e5fe677b37 100644 --- a/src/include/port/pg_iovec.h +++ b/src/include/port/pg_iovec.h @@ -68,7 +68,7 @@ pg_preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset) } sum += part; offset += part; - if (part < iov[i].iov_len) + if ((size_t) part < iov[i].iov_len) return sum; } return sum; @@ -107,7 +107,7 @@ pg_pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset) } sum += part; offset += part; - if (part < iov[i].iov_len) + if ((size_t) part < iov[i].iov_len) return sum; } return sum; -- 2.39.5 (Apple Git-154) --KaAdjNLAXvgKQ+yE--