From patchwork Wed Sep 30 15:26:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Passaro via GitGitGadget X-Patchwork-Id: 11809461 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B45292C for ; Wed, 30 Sep 2020 15:27:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 67F73207C3 for ; Wed, 30 Sep 2020 15:27:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BaYfolE1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730824AbgI3P0r (ORCPT ); Wed, 30 Sep 2020 11:26:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727426AbgI3P03 (ORCPT ); Wed, 30 Sep 2020 11:26:29 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88452C0613D0 for ; Wed, 30 Sep 2020 08:26:29 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id k18so2228107wmj.5 for ; Wed, 30 Sep 2020 08:26:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:mime-version :content-transfer-encoding:fcc:to:cc; bh=NRU+SyTyOR4yAioixTSvvEKcxKmJ15EAGq7udR67d4Y=; b=BaYfolE1k4gtzbrmB3kd5A0Q+Er3Eof09LV6v9UZR+9pGAoR6jt4sc07SeDEtD8mbG oyykklRfFeLtgPBnYm9IHrSPWCW+NIIbB7Jhgdr936MnDkSTeWAqxgwMY9T3ZT4Ndkr8 FY5Auzuy/vziCB2wyb5r+OFq/iC6wMzD3LjUC7DXEYZVFikUJzK8zRw92E9PlOSGoVD6 6kw3GtUbc4hhcqZZIx9uep6r57nVkCzIcuorHbbG3cnS9fNXQWcQ4qJuRyxpS4qSNkVQ Z4MmVQ6DFqw5fa42oE69dSmxB0kkoNMC0eG6dakR9St514YQgdnBb+5HegNZB6U/U4/O 81eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:mime-version:content-transfer-encoding:fcc:to:cc; bh=NRU+SyTyOR4yAioixTSvvEKcxKmJ15EAGq7udR67d4Y=; b=RA1vJ8CTevucKoyrP1UYOHKGeHIQI04XNXctVk/DzX/EzUPxFs9M4fN4z6ExFxKKt0 h8ZG2uhdnbS6wL8hJIyAeBKRDb8A4dGScKXzB6A7b2NOVmk5fJtdZD2TUQhTt+WIw/AA 3KklxUET6hj/brJFiLU5zgu9hNPiD1jZpkx/BJoBq1v5NGFww6K0gMfXDHA80xS7pnhd lXiGQiW3fV+mAajS5eE6OQEFJYZsEzA3D0rLq8J0rDE5tWMSjMOYFXgrcUX/MC/y9NL6 26F9kpXdNXV4c6lbhLP7wpTQ0Z74nWqV2M8qJ/tS3CDrTNnTzZzmYsrLnKilABHqlKHx 6WtQ== X-Gm-Message-State: AOAM5309c58bHjZGxyzsMNzF6fPTVbnOX3drqVkgwHkAVb5CSFaba8vc HOWu8BDqTpmb3N2FuB7Sd4G7bD4JMpQ= X-Google-Smtp-Source: ABdhPJwbq016pamqGSvc6vnVv/0YxEUqPnyzsCrja8whMvHiUcvCeaEHJ8z4hcEJuyo/qQR0+g7Nyw== X-Received: by 2002:a1c:b409:: with SMTP id d9mr152985wmf.106.1601479587041; Wed, 30 Sep 2020 08:26:27 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id i15sm3678789wrb.91.2020.09.30.08.26.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 08:26:26 -0700 (PDT) Message-Id: <9c7a96451937c752899eb0e2aeaa0e6fc49cc62e.1601479585.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Date: Wed, 30 Sep 2020 15:26:15 +0000 Subject: [PATCH v4 01/10] cmake: ignore files generated by CMake as run in Visual Studio MIME-Version: 1.0 Fcc: Sent To: git@vger.kernel.org Cc: Sibi Siddharthan , =?utf-8?b?xJBvw6Bu?= =?utf-8?b?IFRy4bqnbiBDw7RuZw==?= Danh , SZEDER =?utf-8?b?R8OhYm9y?= , Eric Sunshine , Johannes Schindelin , =?utf-8?q?=C3=98ystein?= Walle , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin As of recent Visual Studio versions, CMake support is built-in: https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=vs-2019 All that needs to be done is to open the worktree as a folder, and Visual Studio will find the `CMakeLists.txt` file and automatically generate the project files. Let's ignore the entirety of those generated files. Helped-by: Đoàn Trần Công Danh Signed-off-by: Johannes Schindelin --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 800b812c6a..6232d33924 100644 --- a/.gitignore +++ b/.gitignore @@ -242,3 +242,4 @@ Release/ /git.VC.VC.opendb /git.VC.db *.dSYM +/contrib/buildsystems/out From patchwork Wed Sep 30 15:26:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Passaro via GitGitGadget X-Patchwork-Id: 11809457 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB3C6618 for ; Wed, 30 Sep 2020 15:27:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 810152085B for ; Wed, 30 Sep 2020 15:27:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TtuH6Wtu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730933AbgI3P0s (ORCPT ); Wed, 30 Sep 2020 11:26:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725872AbgI3P03 (ORCPT ); Wed, 30 Sep 2020 11:26:29 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 606D5C061755 for ; Wed, 30 Sep 2020 08:26:29 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id x23so2148135wmi.3 for ; Wed, 30 Sep 2020 08:26:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:mime-version :content-transfer-encoding:fcc:to:cc; bh=wJhsn9s9LUmr1GfM3h5PzVUuBc9RI5okijDIrwGDNOI=; b=TtuH6WtuHHaG+qXmRVxyx0NpB6jNUKhkMYEsftk44Z++AT23SSZ5UeYFGve20ZUU6c LaTHhPYi4xXYT+d088xmYE73rRmGBXqjk6J8kEM4DvnHEZE4x1sZmPebknmcMC3GGRis gcy0/8Ejx5Ie26WoG7strjqGW3/NItHWm71+J7Q1obFyUF/Z7TA2slnwrKEEnjVOlPo6 naEg/44zLA24kkoVsxrw20Vdwr7nY9NLS9gYZnNPG8A1WvRBIRmljmPKkg4sypR+Z7wl iajo5NT9AcLiEztv/ntgEG1rHhbNFbQV6jjmC5sRsvUv2/S4HUUDbjaiHusR898gOIcQ +ucw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:mime-version:content-transfer-encoding:fcc:to:cc; bh=wJhsn9s9LUmr1GfM3h5PzVUuBc9RI5okijDIrwGDNOI=; b=cZgVl9FZjbpOiaQLT4nV/PCZ2x4l1DVh5ExsOo5x7GINKu+CT8S4QCaBjAHdkv0PYn BPXhN6i5kTkRk05pmWbHtCSrjg0FJ+NSh0CkiMGz3BjtiDFD2mR8u7nwiWWcBLqa49Nl D+LZN6lhxQNkmEFOv4Jaf566bTQt1kglMqfjP1Z4b8prulho0uobUmT4UgR7pjgDGABP 6dkGkw7gb9DkLidIdOqG9tGRiQpsMEjpeQJrqq7Ud6LhaS0J+B65zmh5rbSdCd9tzqB/ rJq/EPfNHlgk2x84aMuII5DEkB8ut4u6TjUr7HOtloode4SGVmCnt3X9BWOLlsqQoskJ g6jA== X-Gm-Message-State: AOAM530cAglIZX/Olv4D0/dBsOH0lKE3s+L4O5ZiX4KiCUCyC1K4iF8F JsXTiXg9DE5kdAilV71JCLYtN6YCvH0= X-Google-Smtp-Source: ABdhPJx8Jpm0a4ZJSRy5Z1DtA2BEhX6zR2OKIIdj5UUH7SjouZ6PeNxjyYgXQEFQ+Ai7PuM+80ck3Q== X-Received: by 2002:a7b:ca42:: with SMTP id m2mr3757833wml.145.1601479587876; Wed, 30 Sep 2020 08:26:27 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id i26sm3674794wmb.17.2020.09.30.08.26.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 08:26:27 -0700 (PDT) Message-Id: <3b467360bbc2c03474a7f704d23b1fe1df56dc49.1601479585.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Date: Wed, 30 Sep 2020 15:26:16 +0000 Subject: [PATCH v4 02/10] cmake: do find Git for Windows' shell interpreter MIME-Version: 1.0 Fcc: Sent To: git@vger.kernel.org Cc: Sibi Siddharthan , =?utf-8?b?xJBvw6Bu?= =?utf-8?b?IFRy4bqnbiBDw7RuZw==?= Danh , SZEDER =?utf-8?b?R8OhYm9y?= , Eric Sunshine , Johannes Schindelin , =?utf-8?q?=C3=98ystein?= Walle , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin By default, Git for Windows does not install its `sh.exe` into the `PATH`. However, our current `CMakeLists.txt` expects to find a shell interpreter in the `PATH`. So let's fall back to looking in the default location where Git for Windows _does_ install a relatively convenient `sh.exe`: `C:\Program Files\Git\bin\sh.exe` Helped-by: Øystein Walle Signed-off-by: Johannes Schindelin --- contrib/buildsystems/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 5007f173f1..1847a6fd58 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -41,7 +41,7 @@ cmake_minimum_required(VERSION 3.14) #set the source directory to root of git set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..) -find_program(SH_EXE sh) +find_program(SH_EXE sh PATHS "C:/Program Files/Git/bin") if(NOT SH_EXE) message(FATAL_ERROR "sh: shell interpreter was not found in your path, please install one." "On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/") From patchwork Wed Sep 30 15:26:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Passaro via GitGitGadget X-Patchwork-Id: 11809459 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 86C93618 for ; Wed, 30 Sep 2020 15:27:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5D74020789 for ; Wed, 30 Sep 2020 15:27:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ikhLWGJl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730908AbgI3P0s (ORCPT ); Wed, 30 Sep 2020 11:26:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728385AbgI3P0a (ORCPT ); Wed, 30 Sep 2020 11:26:30 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 229B0C061755 for ; Wed, 30 Sep 2020 08:26:30 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id k10so2276734wru.6 for ; Wed, 30 Sep 2020 08:26:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=vcskzXK9EhFcrWXUKoLHVMIaYwYhGcUQ60l9JuhR1gY=; b=ikhLWGJlKz6CPou13x0OKDtHDc7XQwgXqYew0xGhZuwYxkyjDsVPjFpweKgEGfaTlG s72Tyl5E9jSQYKAKZTC4aVZpHEXFOKwQmDjkPf2qmRD3ZntxnfdIU/ryV2Agv/Esq796 YAz6uM6Zq4qLN1jAg/z7gfkJUKz4YGBzCUjAvlNsw+MJILRaY/adtBiLLrxWsH7yx7D0 a0fAfqNqwGSd06qMM8kOg1GzlcKONty+rnQqhEWelUyw0Jf4DsMtdQl6TzvUNAuqNWcR YOpG11vZsp1CiuVUbM/htHEp9Kxb7y6hLF5DVVCHNfrVyFxOK/rf2gyXJDR1sTu9DgZn zdRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=vcskzXK9EhFcrWXUKoLHVMIaYwYhGcUQ60l9JuhR1gY=; b=jYhDkwCyQfmxDkupVIxdiksm6VUxgH4fV5kM40RM2cCewtCbFL24zzYad5zShti0i6 dSRDFDp80NpE5EeSuac5YuWA/UHjcb1wZbhrX2TTAXqVbpJkNaohN3P51yLa5hK1xedS bO3nQwS3rI1ieDTprcJXcCbZUir2i7zvERq/O07cNbO+KYFkN7O2hcRYb81PPEmo2ZOy C6bA0KDFzQeOubYW2DHEVfJddUghUlyjWwHHSZpySU63/Stj+6pP5wbfVYLM7ZNOGgf9 HDxtESfMFvCkquWjWkLprskyQf0uKG1QlvOKoPZExSPYEPhydkG/T9Sym3ipf5Bn+zAj qfbg== X-Gm-Message-State: AOAM533cBT+qvWIeGEEHRFFz0/5paFFm/XYQgRuQtE0CkPDXR/yF/vBA uOibwhzgp50ksJH4NXnW8OhTdJh/kgY= X-Google-Smtp-Source: ABdhPJw5/fM4+eJ0uCU3WrbfO/WjEc8SyscnEjDZ+0fEZn4ggueSx6qr3CKV0DoQFm8Y5cGgddXBlQ== X-Received: by 2002:adf:f701:: with SMTP id r1mr3799397wrp.341.1601479588661; Wed, 30 Sep 2020 08:26:28 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id a81sm3814093wmf.32.2020.09.30.08.26.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 08:26:28 -0700 (PDT) Message-Id: In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Date: Wed, 30 Sep 2020 15:26:17 +0000 Subject: [PATCH v4 03/10] cmake: ensure that the `vcpkg` packages are found on Windows Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Sibi Siddharthan , =?utf-8?b?xJBvw6Bu?= =?utf-8?b?IFRy4bqnbiBDw7RuZw==?= Danh , SZEDER =?utf-8?b?R8OhYm9y?= , Eric Sunshine , Johannes Schindelin , =?utf-8?q?=C3=98ystein?= Walle , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin On Windows, we use the `vcpkg` project to manage the dependencies, via `compat/vcbuild/`. Let's make sure that these dependencies are found by default. This is needed because we are about to recommend loading the Git worktree as a folder into Visual Studio, relying on the automatic CMake support (which would make it relatively cumbersome to adjust the search path used by CMake manually). Signed-off-by: Johannes Schindelin --- contrib/buildsystems/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 1847a6fd58..12268f61ba 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -40,6 +40,13 @@ cmake_minimum_required(VERSION 3.14) #set the source directory to root of git set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..) +if(WIN32) + set(VCPKG_DIR "${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg") + list(APPEND CMAKE_PREFIX_PATH "${VCPKG_DIR}/installed/x64-windows") + + # In the vcpkg edition, we need this to be able to link to libcurl + set(CURL_NO_CURL_CMAKE ON) +endif() find_program(SH_EXE sh PATHS "C:/Program Files/Git/bin") if(NOT SH_EXE) From patchwork Wed Sep 30 15:26:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Passaro via GitGitGadget X-Patchwork-Id: 11809439 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 44E8A13B2 for ; Wed, 30 Sep 2020 15:26:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D2062071E for ; Wed, 30 Sep 2020 15:26:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AjxxmHNE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730929AbgI3P0j (ORCPT ); Wed, 30 Sep 2020 11:26:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728570AbgI3P0b (ORCPT ); Wed, 30 Sep 2020 11:26:31 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6373C061755 for ; Wed, 30 Sep 2020 08:26:30 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id x23so2148225wmi.3 for ; Wed, 30 Sep 2020 08:26:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=qAro7NjDp0noRnLCqwMHT6ZhXkC5gSBxmctQSbFtfaU=; b=AjxxmHNETSQwAuwuZUG6jWqKlYqh6HCWuUJTS4Q7Cs0mw7aZ9sleIkUKMxxeD+WjsE xj5oeDQ0lVdm4vlyWKYGXXY1muXugBDLgZ4GjTceV2chK8vayxDAeu3F77B8e/5UrdWc YLP2XS9IUuwYVPCrZ6rMlIyeWPoNU60ZsGi2eGQs51qMd6ayEenoFEwHWunl6HhYY3ma VJFl762Kozf8vp/o2obAAHDgn3aBpsypAwiI5OntrtmNR4o+xav1u/ppNuIHpuiVwYBH lC0rOYlB0BWcgdCRQB2Sqc9g2BECyZ4Tzeb/VN5OsnMy49/CutsUTnHnytfhJRzohIvq ASeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=qAro7NjDp0noRnLCqwMHT6ZhXkC5gSBxmctQSbFtfaU=; b=EIaTkdxqhxIRYYGveT/W97903P7fQMncAok1Xf5WGmhlOy7hn3WcwXagkXKtd8WEDG eA525opmohqvsJ52Mk1mJ5bEr/8RfKzpBdS34/ZiWla0fF2ckAMKgzV2hG6ODwyXusHW HkpkCA6y3bLdpYEC6ZBW59Rxnmm+inXCXlGgEoJ5rWo/1+enCR5wmbCd/1Bnf3Iz0mJW zPgM5/ftr4vWdX2Q7n69e2QWk1mjTUEY8woYdC5glDOGEIJgDEbdytmIgrWsRx7VL9Q0 5ZdW2+2mrlwzk4BCABr8qOq+A1Eul6DMZdlaBOQVueWfBbW8gFtD/5KBVwT61RIaHlaS qVgQ== X-Gm-Message-State: AOAM533ZHWNc3NXzCWXdE/C8vxJS8pKQmpWjhbHELcH7j2RH5qrkqMJF deocIrSOFhYOPqsJs+VXn+ul9z26OMA= X-Google-Smtp-Source: ABdhPJykfNAMJGqQGPFiYw7J4sIdo1HU3ocHXnvAKZGgE0X89A1sqNAGN3fj/4J4pfTD/k7wwn5Phw== X-Received: by 2002:a1c:7e90:: with SMTP id z138mr3589404wmc.122.1601479589482; Wed, 30 Sep 2020 08:26:29 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id t6sm4297860wre.30.2020.09.30.08.26.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 08:26:29 -0700 (PDT) Message-Id: <56cfdb2ee9de3c60baedb10496f4dc628c910a41.1601479585.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Date: Wed, 30 Sep 2020 15:26:18 +0000 Subject: [PATCH v4 04/10] cmake: fall back to using `vcpkg`'s `msgfmt.exe` on Windows Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Sibi Siddharthan , =?utf-8?b?xJBvw6Bu?= =?utf-8?b?IFRy4bqnbiBDw7RuZw==?= Danh , SZEDER =?utf-8?b?R8OhYm9y?= , Eric Sunshine , Johannes Schindelin , =?utf-8?q?=C3=98ystein?= Walle , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin We are already relying on `vcpkg` to manage our dependencies, including `libiconv`. Let's also use the `msgfmt.exe` from there. Signed-off-by: Johannes Schindelin --- contrib/buildsystems/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 12268f61ba..02241dcc77 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -152,7 +152,11 @@ endif() find_program(MSGFMT_EXE msgfmt) if(NOT MSGFMT_EXE) - message(WARNING "Text Translations won't be build") + set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe) + if(NOT EXISTS ${MSGFMT_EXE}) + message(WARNING "Text Translations won't be built") + unset(MSGFMT_EXE) + endif() endif() #Force all visual studio outputs to CMAKE_BINARY_DIR From patchwork Wed Sep 30 15:26:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Passaro via GitGitGadget X-Patchwork-Id: 11809437 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0309F92C for ; Wed, 30 Sep 2020 15:26:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE390207FB for ; Wed, 30 Sep 2020 15:26:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="It+jM2cp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730927AbgI3P0i (ORCPT ); Wed, 30 Sep 2020 11:26:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728663AbgI3P0b (ORCPT ); Wed, 30 Sep 2020 11:26:31 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96CB8C061755 for ; Wed, 30 Sep 2020 08:26:31 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id c18so2267813wrm.9 for ; Wed, 30 Sep 2020 08:26:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=mG1q8NYUTU7tMmbucRUbK3iRETU2aTi6t7uRcRPBRYQ=; b=It+jM2cpwlK8wVkcm4C1rXDGQVIjWgaHZ+eGK2MHf+aQLS4WQKUtbyqCAN1cFGwVoJ WZrWLfDSHkDH46eyHgnT7vVt/TU3CE84jlAU8o6MhE44xSj53GMsaHoqqlb+8dKf4+eM m1e/ivY9ORIeBGuzzzxjZK5/qWvvxGu0sjEYT5QeYVNyJnfcSPNbBPOF63XtoO5+WiSZ 2Cj1Oj/GGt6St50dpdxac3HjBqrrLL6AQdgTQ91zAmNpfljEaduv/WzZQsviQpYoGMa4 qC3n2i4d9L6SBGovgIrMnrtgDOnlLsn9xMm8YovdB/lCy3uO53rWSdzbe+RqTG9vic1o mixg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=mG1q8NYUTU7tMmbucRUbK3iRETU2aTi6t7uRcRPBRYQ=; b=I4SW3qW42kfeJhY+0HugXYEO7exy4LN4iHL6rHt5/iNa+x3mMghqVAJ9hfqT3PApYQ WGje97xT+3XGt+1e57sxPt2tYNzutdJF8q2ZSZdqHD9ftIEGBuLPiGwwo7L2ZNrRAiW4 XrNAZW2lvSkvrU/DLe7Avn4OS6Ih3vkafQPG8qQWPjV0Vb0fU3Oy+DaVyCYHvsOtjGIU aogivAKM+fwRU0yq91h9LL5xHv+chDjABxqVEGlH1RCmplyIpn6VbxKbX/Kp78QVIehr gFHXPQrLiearrqJtPN/eBAt9SGhY9J+E65hspn2B31flmFRb+1BZrx/TxfBiUgMnKl+P Kzwg== X-Gm-Message-State: AOAM5304UdQB7lURsFOx3wxxYoYfZO5ttE4YAfjp9QsDe/kMliPWpzXq ccg8Y6rWlGor4G6joRvmJSWsMP9m0wY= X-Google-Smtp-Source: ABdhPJzkcgN68L+Hx6Jgb9rpwKI8hPobh8gmV64JnQnlaBVnpqtqVP7omd9iZFs4LllrnyXg4tiNVA== X-Received: by 2002:a5d:46cf:: with SMTP id g15mr3808030wrs.107.1601479590209; Wed, 30 Sep 2020 08:26:30 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id 18sm3324222wmj.28.2020.09.30.08.26.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 08:26:29 -0700 (PDT) Message-Id: In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Date: Wed, 30 Sep 2020 15:26:19 +0000 Subject: [PATCH v4 05/10] cmake: quote the path accurately when editing `test-lib.sh` Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Sibi Siddharthan , =?utf-8?b?xJBvw6Bu?= =?utf-8?b?IFRy4bqnbiBDw7RuZw==?= Danh , SZEDER =?utf-8?b?R8OhYm9y?= , Eric Sunshine , Johannes Schindelin , =?utf-8?q?=C3=98ystein?= Walle , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin By default, the build directory will be called something like `contrib/buildsystems/out/build/x64-Debug (default)` (note the space and the parentheses). We need to make sure that such a path is quoted properly when editing the assignment of the `GIT_BUILD_DIR` variable. Signed-off-by: Johannes Schindelin --- contrib/buildsystems/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 02241dcc77..3bb74337e1 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -949,7 +949,7 @@ if(NOT ${CMAKE_BINARY_DIR}/CMakeCache.txt STREQUAL ${CACHE_PATH}) file(WRITE ${CMAKE_BINARY_DIR}/CTestCustom.cmake "file(STRINGS ${CMAKE_SOURCE_DIR}/t/test-lib.sh GIT_BUILD_DIR_REPL REGEX \"GIT_BUILD_DIR=(.*)\")\n" "file(STRINGS ${CMAKE_SOURCE_DIR}/t/test-lib.sh content NEWLINE_CONSUME)\n" - "string(REPLACE \"\${GIT_BUILD_DIR_REPL}\" \"GIT_BUILD_DIR=\\\"$TEST_DIRECTORY\\\"/../${BUILD_DIR_RELATIVE}\" content \"\${content}\")\n" + "string(REPLACE \"\${GIT_BUILD_DIR_REPL}\" \"GIT_BUILD_DIR=\\\"$TEST_DIRECTORY/../${BUILD_DIR_RELATIVE}\\\"\" content \"\${content}\")\n" "file(WRITE ${CMAKE_SOURCE_DIR}/t/test-lib.sh \${content})") #misc copies file(COPY ${CMAKE_SOURCE_DIR}/t/chainlint.sed DESTINATION ${CMAKE_BINARY_DIR}/t/) From patchwork Wed Sep 30 15:26:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Passaro via GitGitGadget X-Patchwork-Id: 11809441 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EB71513B2 for ; Wed, 30 Sep 2020 15:26:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C65F8208B8 for ; Wed, 30 Sep 2020 15:26:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nXlMUbRi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730913AbgI3P0i (ORCPT ); Wed, 30 Sep 2020 11:26:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729395AbgI3P0c (ORCPT ); Wed, 30 Sep 2020 11:26:32 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A861C061755 for ; Wed, 30 Sep 2020 08:26:32 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id e16so2294357wrm.2 for ; Wed, 30 Sep 2020 08:26:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=3+v/NPeohgIj/LltCpX/xIOVrwjdX9QYWXChmKgwU2E=; b=nXlMUbRisPRmHqM9fSZaURr82pp8iLQHAqD+/grrgpw4y/u4IgSFgb8j4H+tSAXpLt i0g6F08OD5hV+3yxShJN7ciiRCJxAVP+OYheL+NgTG55zOvG8T6JxA+/HPu3Pw5MWWHo /mH7EAYZe8ipW3vpZeDY2/UghrdYEqR9FcWXTQTIX5Ix8dmGZKL1tjRbaMJ9hPx/rdWX uFNeFrTirEXHInnVosjaIkVAv+kaN07sziLk19VRwcj1yPRkGJuUKwyyi1F293v4eB74 NfRYau3ovS/qVP22DXPTjiDZqBHKec7afwcWuiHkB+e+A2pZsqdXgrNI+GOu7rZt+jku bdjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=3+v/NPeohgIj/LltCpX/xIOVrwjdX9QYWXChmKgwU2E=; b=Lv0inJo7qsI+e86jgMKYlxPuZDhdy6x2BiaJV+0QBDuXLUNiHrJ50MoM8qpdd2AJ5D lBu2kPMOPjVJ5aV+HqxHRHi7mhXmd9c4AIJTV1LtuyuOPu1VZbR36029yM6hw9yotpw9 7UtuAw35x0htELdrEMXDdAT4QkBfw/AENwp/g4hdjAnueFG1vF43NU5mT792ZFM+vKB6 ud4nLCX0cmGacSdkF1g/qX9OOa0/8wnHsCGbmLqWqP5TmdqXPsY6hItnKGv9a5XEl+NM YkG4rJO/xWluYRkwVRUqW19tavtZjsp3l2aoUq+VVD9DK6RznHKzQo2N/HPArYVVg1RT X59g== X-Gm-Message-State: AOAM533DbSTQ4GQSGFmSKzp4UQKs8S3tQMYXL4szaVzXg11cO8JRAe/B nMeV2PVa/ED8SUVNx1HQaALzkfypAhQ= X-Google-Smtp-Source: ABdhPJzDNRG/7lt53h22vZHdLDuzlg+oOPE4ZYxC96/l+yQNcs7oGD87v3d92Uw5D4qjN0nSsDEwig== X-Received: by 2002:a5d:4c86:: with SMTP id z6mr3612126wrs.23.1601479591005; Wed, 30 Sep 2020 08:26:31 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id s26sm3426252wmh.44.2020.09.30.08.26.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 08:26:30 -0700 (PDT) Message-Id: In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Date: Wed, 30 Sep 2020 15:26:20 +0000 Subject: [PATCH v4 06/10] cmake (Windows): let the `.dll` files be found when running the tests Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Sibi Siddharthan , =?utf-8?b?xJBvw6Bu?= =?utf-8?b?IFRy4bqnbiBDw7RuZw==?= Danh , SZEDER =?utf-8?b?R8OhYm9y?= , Eric Sunshine , Johannes Schindelin , =?utf-8?q?=C3=98ystein?= Walle , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin Contrary to Unix-ish platforms, the dependencies' shared libraries are not usually found in one central place. In our case, since we use `vcpkg`, they are to be found inside the `compat/vcbuild/vcpkg/` tree. Let's make sure that they are in the search path when running the tests. Signed-off-by: Johannes Schindelin --- contrib/buildsystems/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 3bb74337e1..55d0960002 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -939,6 +939,9 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n") +if(WIN32) + file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n") +endif() #Make the tests work when building out of the source tree get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE) From patchwork Wed Sep 30 15:26:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Passaro via GitGitGadget X-Patchwork-Id: 11809443 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6E8FF618 for ; Wed, 30 Sep 2020 15:26:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4C46A2087D for ; Wed, 30 Sep 2020 15:26:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qhKTGH2s" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730910AbgI3P0i (ORCPT ); Wed, 30 Sep 2020 11:26:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730405AbgI3P0d (ORCPT ); Wed, 30 Sep 2020 11:26:33 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B6C4C061755 for ; Wed, 30 Sep 2020 08:26:33 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id e16so2294409wrm.2 for ; Wed, 30 Sep 2020 08:26:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=kItUiuMF+nPlM0/CHYf8311+S+IUXrTOtwdzzttdUoA=; b=qhKTGH2sRM9LhgfyHpLr0pc2nQlrvlK8VHcsqgymZQM88Esb7CQ2rfAkaEFqsuNRLn hvYRypMpzH6+ZGd/BWslGvSpCtxqam8pWzpEtnQwq0dBokqM6x+/mdtmIyntvgWl/WiA eg+MjHRIz14+Ud789A9Z06lb72LpbYIZK9RURYNr/+MQY7X5ctKqqD/1qaGFPZAsNlXs eUStquSDupSdmRLEkAvCjDbnNL8UrvxhUvm00K3NV6vEq7Oki1nXPU3YIJyHSaKzy194 Yc2QX2EHqroI81NvFMmsMQHc4IetbE232eJPbB09hOxg89jQWU/eeikZsT01hBBQSIes Rl9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=kItUiuMF+nPlM0/CHYf8311+S+IUXrTOtwdzzttdUoA=; b=if9Wv9Fw/A39ZgfzSwFDuN/G8Do2QV2MLAbf8nKNqO6aYRDtOHjfwlFHVQEtxSM8A0 DMY2gAByFb71pWpV6QVoGWJ2Q+Qw+t3FwOsjJvJ95cO4BqcPC6MHeBvQZpHCWLN4TPdv P+z9u7qrxRblBHVFC46dE/cz/bZMcxchn7CAJYip/2D3TUD0RZS8+OXd+wgAUT8i+jq1 7Xt79pHntZNwyYmSkT+l6RyCKKdC9ZDqc6sZMG7hEFNG2y3MY2U9xCGvcAK3WnltP9SG 9ay4EEt1IDycxu7xzosdC8pDNKKV6opGpcJJfGlhrAVo1gwYJpHK4L9qEjSU4FoDR5fo JEDA== X-Gm-Message-State: AOAM533hwSvNRdZA+1JcGRglQ1TdOWIoZJAgFBoi/Ng747pCoDtuRRxc ebzbVzhWynUWFp5G+FxtSD4/EF9WYRw= X-Google-Smtp-Source: ABdhPJwb/lnf51RG8oiFw7l/yZ5A4HVYc0ODLzPr1cb9VE8rOdzEwljJ1MFThdrVUrLA3397EbAg5A== X-Received: by 2002:a5d:5090:: with SMTP id a16mr3988795wrt.247.1601479591761; Wed, 30 Sep 2020 08:26:31 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id y6sm3630253wrn.41.2020.09.30.08.26.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 08:26:31 -0700 (PDT) Message-Id: <0e7fdfddb4105032226d7ff16447a8cdc3020f33.1601479585.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Date: Wed, 30 Sep 2020 15:26:21 +0000 Subject: [PATCH v4 07/10] cmake (Windows): complain when encountering an unknown compiler Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Sibi Siddharthan , =?utf-8?b?xJBvw6Bu?= =?utf-8?b?IFRy4bqnbiBDw7RuZw==?= Danh , SZEDER =?utf-8?b?R8OhYm9y?= , Eric Sunshine , Johannes Schindelin , =?utf-8?q?=C3=98ystein?= Walle , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin We have some custom handling regarding the link options, which are specific to each compiler. Therefore: let's not just continue without setting the link options if configuring for a currently unhandled compiler, but error out. Signed-off-by: Johannes Schindelin --- contrib/buildsystems/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 55d0960002..78b90abe5e 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -617,6 +617,8 @@ if(WIN32) target_link_options(common-main PUBLIC -municode -Wl,-nxcompat -Wl,-dynamicbase -Wl,-entry:wmainCRTStartup -Wl,invalidcontinue.obj) elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC") target_link_options(common-main PUBLIC /IGNORE:4217 /IGNORE:4049 /NOLOGO /ENTRY:wmainCRTStartup /SUBSYSTEM:CONSOLE invalidcontinue.obj) + else() + message(FATAL_ERROR "Unhandled compiler: ${CMAKE_C_COMPILER_ID}") endif() elseif(UNIX) target_link_libraries(common-main pthread rt) From patchwork Wed Sep 30 15:26:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Passaro via GitGitGadget X-Patchwork-Id: 11809445 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B68592C for ; Wed, 30 Sep 2020 15:26:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6DA6920789 for ; Wed, 30 Sep 2020 15:26:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Oe0PdGkQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730905AbgI3P0i (ORCPT ); Wed, 30 Sep 2020 11:26:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730804AbgI3P0e (ORCPT ); Wed, 30 Sep 2020 11:26:34 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBB26C061755 for ; Wed, 30 Sep 2020 08:26:33 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id k10so2276977wru.6 for ; Wed, 30 Sep 2020 08:26:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=1Y7JiewA7VkJhtRHwveP6+buQvtiiaFjlssilvtT8Wk=; b=Oe0PdGkQcfv6ca2l2YGmD72E5GgUNHnhvNkxuPU5nKaxhlIbxxB8JjYwXC9ro8MR1i 2KIpdiexSSo63/d0jnefCWuEPRfKG3QhpusxO4ZN6cJFsyXiH3Tze/OX2Qe/Rv1YVPM2 3ge5jsizwU2COy6VFzyLooy0n3e0YfmeY5jNXx+zIzyLdv+UTbq+dLc3Mwewf+DwUiWG sUT47Tb6fKKqdEi0vCx8fb9cNnjZlFxNfiCjUxMTWJ/xHryFbDvhjed4qQrWMfYvw7an qmLiXJknaYwVBU4FXmZ5OKVahdwgf/xZNk+JmlJcLPeAgHmREcz+W6/V46K78uL4AWnn L3Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=1Y7JiewA7VkJhtRHwveP6+buQvtiiaFjlssilvtT8Wk=; b=rK2RHNKDSA8xhTZr0F79v9B5kSMXkdDOfuqQ3mcju63kvOT/EGQZnjdRvXtsBXdU7r iEK8LrFey4lp0QDuXVQJGgU/N/x3BdcCkqEoeOpm6ALYDzUbbPWaScFLi5QcNxJ2N9OW ooBjr1qYIAURdSSe6+pqsn/YRDwuqKRdRJA9ZctSrLNayr+f7vlZyDNP/EkJoVL5kOAF aQgSqiQo4JkYhhvmhNcnLrerE2aRnUrixX8dPYVxvxvqCnwM2qRwc+HPtvj3cksZmBIH vlg3i2XfIatleVRalfA0ESmge69JNI+tRml+8zXHQs60+NrCN8zbvA7R7MPngwVGWh22 gaiw== X-Gm-Message-State: AOAM533HernqPdPTP0T0XkrhbeEkhuHAD7f+cI7bTKEESeP5p+otIMuD bxZaePJINXWrj/0umuD5KGGaY+FHcbs= X-Google-Smtp-Source: ABdhPJwEr41t+EtEmQ8b5fV0o9C1Km77s1GMamEZ5g0M9hm/w+jmJyAz8GUvED+LPJluQDDLLE1mBw== X-Received: by 2002:a5d:5306:: with SMTP id e6mr3871377wrv.156.1601479592503; Wed, 30 Sep 2020 08:26:32 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id d9sm3264385wmb.30.2020.09.30.08.26.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 08:26:32 -0700 (PDT) Message-Id: <14ddfc17815d68f2f32aebbc4b0ecb3ce6f25dc1.1601479585.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Date: Wed, 30 Sep 2020 15:26:22 +0000 Subject: [PATCH v4 08/10] cmake (Windows): initialize vcpkg/build dependencies automatically Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Sibi Siddharthan , =?utf-8?b?xJBvw6Bu?= =?utf-8?b?IFRy4bqnbiBDw7RuZw==?= Danh , SZEDER =?utf-8?b?R8OhYm9y?= , Eric Sunshine , Johannes Schindelin , =?utf-8?q?=C3=98ystein?= Walle , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin The idea of having CMake support in Git's source tree is to enable contributors on Windows to start contributing with little effort. To that end, we just added some sensible defaults that will let users open the worktree in Visual Studio and start building. This expects the dependencies (such as zlib) to be available already, though. If they are not available, we expect the user to run `compat/vcbuild/vcpkg_install.bat`. Rather than requiring this step to be manual, detect the situation and run it as part of the CMake configuration step. Note that this obviously only applies to the scenario when we want to compile in Visual Studio (i.e. with MS Visual C), not with GCC. Therefore, we guard this new code block behind the `MSVC` conditional. This concludes our journey to make it as effortless as possible to start developing Git in Visual Studio: all the developer needs to do is to clone Git's repository, open the worktree via `File>Open>Folder...` and wait for CMake to finish configuring. Signed-off-by: Johannes Schindelin squash! cmake (Windows): initialize vcpkg/build dependencies automatically MSVC --- contrib/buildsystems/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 78b90abe5e..ebadae2271 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -42,6 +42,10 @@ cmake_minimum_required(VERSION 3.14) set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..) if(WIN32) set(VCPKG_DIR "${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg") + if(MSVC AND NOT EXISTS ${VCPKG_DIR}) + message("Initializing vcpkg and building the Git's dependencies (this will take a while...)") + execute_process(COMMAND ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg_install.bat) + endif() list(APPEND CMAKE_PREFIX_PATH "${VCPKG_DIR}/installed/x64-windows") # In the vcpkg edition, we need this to be able to link to libcurl From patchwork Wed Sep 30 15:26:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Passaro via GitGitGadget X-Patchwork-Id: 11809447 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F2F9413B2 for ; Wed, 30 Sep 2020 15:26:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CFB8320789 for ; Wed, 30 Sep 2020 15:26:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HxmcagBp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730901AbgI3P0h (ORCPT ); Wed, 30 Sep 2020 11:26:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730806AbgI3P0f (ORCPT ); Wed, 30 Sep 2020 11:26:35 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB8ACC061755 for ; Wed, 30 Sep 2020 08:26:34 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id o5so2269325wrn.13 for ; Wed, 30 Sep 2020 08:26:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=aA+G/vxeATnqubeQXxe1fG2bCSFpx19fAU1b++4OAwM=; b=HxmcagBpJTmnY27rDaa1ZEfAN6E7WulNdy2xjt0HKF5GB0jo2HUK+nNoI/nkivi4h/ Luo2aRNnl5SacxIdbm8H8daHDEsO371J66pNsgcbVgAwh0Ljbmw3zyYwT7hx3BYZ3UVN qPpGExwJFhqB+ljtGcBwSEkAKILkda+2eNooCc5tgQ0nSToFejg9hxMjFL3Lua7a9Faz CXHP/ZfmEV3IGY3WX1G3XUlSs1DFGPTUEhF3qSnMWfhDIfMjx5TleMTJ/duiZOGdDON/ SH1Px73U6VItFOu2oprZDyZc+W/pTsXHyo5WFTUpfPFQba9KXfnPyKnvryjn1RsQE5+i 4fAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=aA+G/vxeATnqubeQXxe1fG2bCSFpx19fAU1b++4OAwM=; b=P3AexIqSmtGRh5HNQ0is/+uM3C5DTOMDS2u5G3nwxKiBs+gr51rMxQFZONCazlgcpC DP8nqC+SwapebXhyu0yiva6UjwNepMJnslWxVZ8Xwj3wewme/7REKFeAJ9DKuoK02HW3 NOdGlme7vG/GKzwBvY0DwIByDuZNj7xvjILCUbFiZPfU5oKWc/tsJ3zV9mRSELGzXneV L+gQMANflPaC6PrtyPql9f80BJqqlIrdsaoYaASc0S8t6KCUZqO4jBa46PRIwVrZBGdg 6A2M/c7uyWEOUJpC71sM0V4NwsiJHKvxu+VjzR3Dow0wUUjirtgxZgGtRhYZmm8FQld0 kZqA== X-Gm-Message-State: AOAM533HQB3YvlMJpPWRGzhDjduYe9IqKNNh07++eb6nKlVFU+6MhvRb PRAKqUOiR/t8OkipnmXFUshxOKsbA24= X-Google-Smtp-Source: ABdhPJypl0VS+oxGuqwOLWLqayvOIYUI6L/Im2cg905LBXUAR+Qhi1boGKhf2OnlBoolCUcxZNiSxg== X-Received: by 2002:a5d:444b:: with SMTP id x11mr3740742wrr.402.1601479593232; Wed, 30 Sep 2020 08:26:33 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id d6sm3739230wrq.67.2020.09.30.08.26.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 08:26:32 -0700 (PDT) Message-Id: In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Date: Wed, 30 Sep 2020 15:26:23 +0000 Subject: [PATCH v4 09/10] cmake (Windows): recommend using Visual Studio's built-in CMake support Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Sibi Siddharthan , =?utf-8?b?xJBvw6Bu?= =?utf-8?b?IFRy4bqnbiBDw7RuZw==?= Danh , SZEDER =?utf-8?b?R8OhYm9y?= , Eric Sunshine , Johannes Schindelin , =?utf-8?q?=C3=98ystein?= Walle , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin It is a lot more convenient to use than having to specify the configuration in CMake manually (does not matter whether using the command-line or CMake's GUI). While at it, recommend using `contrib/buildsystems/out/` as build directory also in the part that talks about running CMake manually. Helped-by: Junio C Hamano Signed-off-by: Johannes Schindelin --- contrib/buildsystems/CMakeLists.txt | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index ebadae2271..df539a44fa 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -4,17 +4,25 @@ #[[ -Instructions to run CMake: +Instructions how to use this in Visual Studio: -cmake `relative-path-to-CMakeLists.txt` -DCMAKE_BUILD_TYPE=Release -Eg. -From the root of git source tree - `cmake contrib/buildsystems/ ` -This will build the git binaries at the root +Open the worktree as a folder. Visual Studio 2019 and later will detect +the CMake configuration automatically and set everything up for you, +ready to build. You can then run the tests in `t/` via a regular Git Bash. -For out of source builds, say build in 'git/git-build/' - `mkdir git-build;cd git-build; cmake ../contrib/buildsystems/` -This will build the git binaries in git-build directory +Note: Visual Studio also has the option of opening `CMakeLists.txt` +directly; Using this option, Visual Studio will not find the source code, +though, therefore the `File>Open>Folder...` option is preferred. + +Instructions to run CMake manually: + + mkdir -p contrib/buildsystems/out + cd contrib/buildsystems/out + cmake ../ -DCMAKE_BUILD_TYPE=Release + +This will build the git binaries in contrib/buildsystems/out +directory (our top-level .gitignore file knows to ignore contents of +this directory). Possible build configurations(-DCMAKE_BUILD_TYPE) with corresponding compiler flags From patchwork Wed Sep 30 15:26:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Passaro via GitGitGadget X-Patchwork-Id: 11809449 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3C5F5618 for ; Wed, 30 Sep 2020 15:26:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1832F20759 for ; Wed, 30 Sep 2020 15:26:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="abu6wBr4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730892AbgI3P0h (ORCPT ); Wed, 30 Sep 2020 11:26:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730835AbgI3P0f (ORCPT ); Wed, 30 Sep 2020 11:26:35 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9351BC061755 for ; Wed, 30 Sep 2020 08:26:35 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id x23so2148452wmi.3 for ; Wed, 30 Sep 2020 08:26:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=fLx/oqN4eboVCzSUB4omppsZm0evzi7MY+4v/FyZl7s=; b=abu6wBr4vCrp09W5xsENwfpvv8MiK6jIE3W/pkj90L/g+i5kNFKo0X7uz7ufMaeH/b euaAbV0eYr9e36sqCQ062Kza3jpfD/5TGlrofjVhR8uZSQIvRp4adxEsiDV0cCXGMI5l XtiCCJWxCKX0cUnn0d61igv+XRaWzfChxsQdoio3tdi3b0CSA/KNlzpqj4+neXzdOy05 0FWWRUDjzc8rJxz3eMmtFukV5CC1T8sMmY+HVGTsidfVCnEbyKUrdGcdLrUJCq+dYqOI zvYIzT0jGj71MGy/RWJBTj1jQ6x6yUZI4LvstJ+OmXw5vriJSAZdHsIZ2triz+FRrsfU nFCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=fLx/oqN4eboVCzSUB4omppsZm0evzi7MY+4v/FyZl7s=; b=RQesZodPrFIGOTM1Q4xDI6kF2hl/m/AT5R2SJI1kSMtI+N2GY/tZuQUjmXj0EaCncL qr5YTXhQYQmYkh0cHWELI/sXSV5aDZNQs8xr0xAVmIPxu0G03yxvZuGSFXrr6C+wrUyp rS4OpKim1QPNNlV5tnjHMykK+OMOHpFi0UeJ4OtoiaFu3btp7u+bK0vHouXnwSw9WhBQ 8m/pY8aMizrhv7YqrDMclDJvpUWGfOmEbkQxxzlwqynJ9N0MUtoP7oN285MUg9MXlydl Z95St32XUOqkS7xWEMI8QDWSp9UX62rTmluPBymXfpGSgue7vDwwQVRj2sX5lJi0HVJk OrFg== X-Gm-Message-State: AOAM532vO189USJTl94PPUj0WyPk5xH6j9/puQRqRjL7YBG04HEfScKe mgsAUMCRiz1b/a7TQWW65IFER/b2/NI= X-Google-Smtp-Source: ABdhPJyaXBRMWRDqhxqocDB/yDgtvtpQTUZixx1iwYzYgQ5ULGg37SN2Qoj66HtjEw2ntZ8M2/cCPA== X-Received: by 2002:a1c:4e02:: with SMTP id g2mr3475751wmh.3.1601479594070; Wed, 30 Sep 2020 08:26:34 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id i9sm3316416wma.47.2020.09.30.08.26.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 08:26:33 -0700 (PDT) Message-Id: <7643a766b7dedb32bbe46689b01a9009e16277f9.1601479585.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Junio C Hamano via GitGitGadget" Date: Wed, 30 Sep 2020 15:26:24 +0000 Subject: [PATCH v4 10/10] hashmap_for_each_entry(): workaround MSVC's runtime check failure #3 Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Sibi Siddharthan , =?utf-8?b?xJBvw6Bu?= =?utf-8?b?IFRy4bqnbiBDw7RuZw==?= Danh , SZEDER =?utf-8?b?R8OhYm9y?= , Eric Sunshine , Johannes Schindelin , =?utf-8?q?=C3=98ystein?= Walle , Johannes Schindelin , Junio C Hamano Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Junio C Hamano The OFFSETOF_VAR(var, member) macro is implemented in terms of offsetof(typeof(*var), member) with compilers that know typeof(), but its fallback implemenation compares &(var->member) and (var) and count the distance in bytes, i.e. ((uintptr_t)&(var)->member - (uintptr_t)(var)) MSVC's runtime check, when fed an uninitialized 'var', flags this as a use of an uninitialized variable (and that is legit---uninitialized contents of 'var' is subtracted) in a debug build. After auditing all 6 uses of OFFSETOF_VAR(), 1 of them does feed a potentially uninitialized 'var' to the macro in the beginning of the for() loop: #define hashmap_for_each_entry(map, iter, var, member) \ for (var = hashmap_iter_first_entry_offset(map, iter, \ OFFSETOF_VAR(var, member)); \ var; \ var = hashmap_iter_next_entry_offset(iter, \ OFFSETOF_VAR(var, member))) We can work around this by making sure that var has _some_ value when OFFSETOF_VAR() is called. Strictly speaking, it invites undefined behaviour to use NULL here if we end up with pointer comparison, but MSVC runtime seems to be happy with it, and most other systems have typeof() and don't even need pointer comparison fallback code. Signed-off-by: Junio C Hamano Signed-off-by: Johannes Schindelin --- hashmap.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hashmap.h b/hashmap.h index ef220de4c6..b011b394fe 100644 --- a/hashmap.h +++ b/hashmap.h @@ -449,7 +449,8 @@ static inline struct hashmap_entry *hashmap_iter_first(struct hashmap *map, * containing a @member which is a "struct hashmap_entry" */ #define hashmap_for_each_entry(map, iter, var, member) \ - for (var = hashmap_iter_first_entry_offset(map, iter, \ + for (var = NULL, /* for systems without typeof */ \ + var = hashmap_iter_first_entry_offset(map, iter, \ OFFSETOF_VAR(var, member)); \ var; \ var = hashmap_iter_next_entry_offset(iter, \