From patchwork Thu Jun 13 11:49:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phillip Wood via GitGitGadget X-Patchwork-Id: 10992275 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7826113AF for ; Thu, 13 Jun 2019 15:26:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6542C212BE for ; Thu, 13 Jun 2019 15:26:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5633F21C9A; Thu, 13 Jun 2019 15:26:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BFD821FAC for ; Thu, 13 Jun 2019 15:26:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729435AbfFMP0L (ORCPT ); Thu, 13 Jun 2019 11:26:11 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:34390 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729406AbfFMLtr (ORCPT ); Thu, 13 Jun 2019 07:49:47 -0400 Received: by mail-ed1-f65.google.com with SMTP id s49so1005244edb.1 for ; Thu, 13 Jun 2019 04:49:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=wu3jazoDAlbauAyAM1ClYlJXGYiSgY5Y02gxCmNI9SI=; b=Zb6lMa3PJ+hUuWHJgdBwrMuVMZEoiXP0asmE4lFKq/uKBmZCp4f+on7fxz3pFObwjv gm6RMykq8jjbWzpwvNsU1bub8fztcyKqHkTuLmki3F7lF9rRfoYtMhz9FIFBDA4nYLxg 21I7B91fp0CPLh+VHSCb5w/73Mv/CyDzaLQqveLrNu5YMaAvJwNUA4hZ/ipB92iHi26V EqHo2j043BBvuTX40iw9gTDR79yma5bIKhirDIw/UKbm/6AN74CCEAHxFEmi0fmDIfBr m2IGalpFqzplFHGKX6s33pFlDKLmH9A10I5A6EcNvsme8xUALbg8RQUZo2Ij5n4r+9BV cVhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=wu3jazoDAlbauAyAM1ClYlJXGYiSgY5Y02gxCmNI9SI=; b=C7JrilGaGHG9jA4GohiTg0YrqL6WMgLbyoevTB9KwYJNbR2ssYDJwjQ7rHzM0lFut4 N2+u0f38soFMNIaPcoHvjGvBHXQ0Jz9PlvCLINhTJOD8Y4BSy9I1HtvzYwysPuZeIhby 1oBrdZi6wvQBCUiNlDHR4jasZEZfnv6jqODkHEV3nPqK/XdWNQqsLT2x4b3HDraBIczn K1/J4hmU3Qyw495yYefAL/rzMw4BSIGzyCXzR9BqqXoX8HFihMZwGp0VMkzHuKVIc5W7 LjL5ipiHDVIBCG0XzrIkDhpJMnPOQLwdkiK6CYMiR62sPVTAfZqR0c4pQHxgYxJQn7/C wWfg== X-Gm-Message-State: APjAAAVnmXWVfBefCLwvplT4SuX5DH9Q84hMxNdKXhk1gShyBvpzCCpw XtdcrWSl7IWbT6a32Im/EKaAC6lw X-Google-Smtp-Source: APXvYqzs5rKNaUtzJCRFfTACgyrjXW5hD54inRd3L2H4YCMVJpcPVvQp9oSJXtk1QAgjfNh4oR8QdQ== X-Received: by 2002:a50:8b9c:: with SMTP id m28mr49662101edm.53.1560426585250; Thu, 13 Jun 2019 04:49:45 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id c21sm509070ejk.79.2019.06.13.04.49.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jun 2019 04:49:44 -0700 (PDT) Date: Thu, 13 Jun 2019 04:49:44 -0700 (PDT) X-Google-Original-Date: Thu, 13 Jun 2019 11:49:38 GMT Message-Id: In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 1/4] poll (mingw): allow compiling with GCC 8 and DEVELOPER=1 Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Schindelin The return type of the `GetProcAddress()` function is `FARPROC` which evaluates to `long long int (*)()`, i.e. it cannot be cast to the correct function signature by GCC 8. To work around that, we first cast to `void *` and go on with our merry lives. Signed-off-by: Johannes Schindelin --- compat/poll/poll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/poll/poll.c b/compat/poll/poll.c index 4459408c7d..8b07edb0fe 100644 --- a/compat/poll/poll.c +++ b/compat/poll/poll.c @@ -149,7 +149,7 @@ win32_compute_revents (HANDLE h, int *p_sought) case FILE_TYPE_PIPE: if (!once_only) { - NtQueryInformationFile = (PNtQueryInformationFile) + NtQueryInformationFile = (PNtQueryInformationFile)(void (*)(void)) GetProcAddress (GetModuleHandle ("ntdll.dll"), "NtQueryInformationFile"); once_only = TRUE; From patchwork Thu Jun 13 11:49:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phillip Wood via GitGitGadget X-Patchwork-Id: 10992277 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4985713AD for ; Thu, 13 Jun 2019 15:26:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36BDD21327 for ; Thu, 13 Jun 2019 15:26:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2AD69212BE; Thu, 13 Jun 2019 15:26:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4FE6212BE for ; Thu, 13 Jun 2019 15:26:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729433AbfFMP0K (ORCPT ); Thu, 13 Jun 2019 11:26:10 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:34393 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729418AbfFMLtr (ORCPT ); Thu, 13 Jun 2019 07:49:47 -0400 Received: by mail-ed1-f65.google.com with SMTP id s49so1005299edb.1 for ; Thu, 13 Jun 2019 04:49:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=RMbR/sr9uFSB2sNfUSbwNcmXQ4wJeTPdpKIku5E/Tsk=; b=vTWGW71jlBSQFgV/McoYpFdMuHnVtrfRr/6PvTSgXas2ibc1GtnmqQBrKYislKLidJ WxUBiMPbCfry2L5piL3edhh5yg2nXSKb7yL94OIn4AGJkGPf+/kSFisIhowsEBbNl3Pa ThIFexXPcL9A6KA+U9Q2UNjPDJ/KAXLUe3Esq8W4qpheXjLLaJKhFnLzWj71m6K32HaA zaoKo1kwGiaHA7W0olBhwffTnbFuobK1X48p93104Z5c0cmPLtmTo6TWjAYQ6qi2KQtk KNTdqzYvIsvLEkgOabQ2aW0DIeXkP84GJLvbU24NweiYJYNQnfzI/IAvnKP5pMA2llli +qbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=RMbR/sr9uFSB2sNfUSbwNcmXQ4wJeTPdpKIku5E/Tsk=; b=d6Ko8hTL7Si/xlJUcn6NOKFgeoVxVFc/GiQAOHtd5RzjlIhEK+Dnmsh0xCX0sjASqu bxBsaRUY0eDwER8TjI4DXtnzZvA+Si9fvyIkbZjme1Mgbxw2I0vKYqBGoPDfvrYCuGlE 8VCMtraI+EPxGB0/0wU4ezn0RUilaBXAQLhAYPDU4GI5TDsGvBcZhfFuzq38+4U8Kn+M SfYTeZht8F4Rdryz+14HK5JRdhPB80mtKIeC6nWlJzeqLnrl1IPENED/ms3qR75w1B6t kcb+uTbOPZDYY/oygMGBLncDMvAXuadKzDAZgH4MAzE+bELppwJRCsa8aoTbgjF29d+h L+SQ== X-Gm-Message-State: APjAAAXbFC/wQv70NssXRVWVvyCq1qRGjobLEqMYGHMYNJzNS6MENq97 UXBk4QTsbCyXcH8jp+U/t2GE+5Pi X-Google-Smtp-Source: APXvYqx1Ks8hQbDE6LSOVvkU+yiC+09xgOtmJ/XU0jNLaCpJkDm7mizEjIB72ZwGahq8P48yXJ7b6g== X-Received: by 2002:a50:ad45:: with SMTP id z5mr71444639edc.21.1560426586010; Thu, 13 Jun 2019 04:49:46 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id f36sm574333ede.47.2019.06.13.04.49.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jun 2019 04:49:45 -0700 (PDT) Date: Thu, 13 Jun 2019 04:49:45 -0700 (PDT) X-Google-Original-Date: Thu, 13 Jun 2019 11:49:39 GMT Message-Id: In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 2/4] kwset: allow building with GCC 8 Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Schindelin The kwset functionality makes use of the obstack code, which expects to be handed a function that can allocate large chunks of data. It expects that function to accept a `size` parameter of type `long`. This upsets GCC 8 on Windows, because `long` does not have the same bit size as `size_t` there. Now, the proper thing to do would be to switch to `size_t`. But this would make us deviate from the "upstream" code even further, making it hard to synchronize with newer versions, and also it would be quite involved because that `long` type is so invasive in that code. Let's punt, and instead provide a super small wrapper around `xmalloc()`. Signed-off-by: Johannes Schindelin --- kwset.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kwset.c b/kwset.c index 4fb6455aca..efc2ff41bc 100644 --- a/kwset.c +++ b/kwset.c @@ -38,7 +38,13 @@ #include "compat/obstack.h" #define NCHAR (UCHAR_MAX + 1) -#define obstack_chunk_alloc xmalloc +/* adapter for `xmalloc()`, which takes `size_t`, not `long` */ +static void *obstack_chunk_alloc(long size) +{ + if (size < 0) + BUG("Cannot allocate a negative amount: %ld", size); + return xmalloc(size); +} #define obstack_chunk_free free #define U(c) ((unsigned char) (c)) From patchwork Thu Jun 13 11:49:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phillip Wood via GitGitGadget X-Patchwork-Id: 10992271 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7A8B613AD for ; Thu, 13 Jun 2019 15:26:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 686DB212BE for ; Thu, 13 Jun 2019 15:26:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BF3F219AC; Thu, 13 Jun 2019 15:26:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04D14212BE for ; Thu, 13 Jun 2019 15:26:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726789AbfFMP0K (ORCPT ); Thu, 13 Jun 2019 11:26:10 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:44679 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729422AbfFMLts (ORCPT ); Thu, 13 Jun 2019 07:49:48 -0400 Received: by mail-ed1-f66.google.com with SMTP id k8so30744668edr.11 for ; Thu, 13 Jun 2019 04:49:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=VNRv0hgUnC+qtQN/vThezjmRB9rOmTqItv2ejLWr2Dg=; b=ZQxIf0bf7U5PWJrLj0knLuRgl5plQlFkP/MD5OnaHzJZOyCin8wEC5T6ogG67Omcj1 MsM4wV1IBeQl8hyQz5nPGjsfWkrFqcz+DqGc9yjeWaCMIlntxqv/UBX6yFOVuvgkqMLn ThtHaBp4RhqGpN7nlA5b4dcye1yTH9YJ9VgXNnZ17f1QFQ3SL4Qurm4tHQvWojdU1Q7b /nVok1Ghv2E9TIOkRwdIf4LD8Fm5x4oZI1eFKQMB2wMVXE3LF1CtLrVtPSmENKdnDAsJ ouJLmzeKKSkk/svsNIeN0nlsz7Wzb4em+JWB8+Lgy4vOpA6sAyKOI+ut646MuCG9hYBR gNHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=VNRv0hgUnC+qtQN/vThezjmRB9rOmTqItv2ejLWr2Dg=; b=e70vQAXWrKuyX/7eIP8Gl14PDZOwOUP5Y35X4r/hWNj3kwY1mlXKd7bQstEFUyiyWV vdR8hGukBtivbe0Yng+hDRDI17v0Gq3MyliUjoQvtjWPLTstkwi/kkHsg12zGre2JAho iRIiJynswajb8lywcI5xQoNVV1CxJZjMqqKiHTO7/sqDvWS2qj2rq09oW6zBnbrho42U 2VyUEbSvbuN7deWyP6KgSpuTA+gG8VOlVW6d9kouj6pQhNW8DDmfwXF3K9J+w/E0D9EG 7GZBa7SGcaWLOAmtbzdxA2kFnRL3iR+jyhE4lMz9//HnY6n6K4wJgUCaJdwn95jUHhEb 6mKw== X-Gm-Message-State: APjAAAWj/OhubdJ2wZ4mMLHUxdipc7L1zyNf+TPpk5Rw75YocSBzPsD3 LJO2B2gYMvy7JAvh31Z+AJdz3DEj X-Google-Smtp-Source: APXvYqwkJ5CRM+nIOavk7egF/vLNV+L7dqsO9gU6nnQllEFNxcPiCn3gZnaXuRopn1auxkzaYV4JAA== X-Received: by 2002:a17:906:30c4:: with SMTP id b4mr12817142ejb.276.1560426586975; Thu, 13 Jun 2019 04:49:46 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m6sm814987ede.2.2019.06.13.04.49.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jun 2019 04:49:46 -0700 (PDT) Date: Thu, 13 Jun 2019 04:49:46 -0700 (PDT) X-Google-Original-Date: Thu, 13 Jun 2019 11:49:40 GMT Message-Id: In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 3/4] winansi: simplify loading the GetCurrentConsoleFontEx() function Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Schindelin We introduced helper macros to simplify loading functions dynamically. Might just as well use them. This also side-steps a compiler warning when building with GCC v8.x: it would complain about casting between incompatible function pointers. Signed-off-by: Johannes Schindelin --- compat/winansi.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/compat/winansi.c b/compat/winansi.c index f4f08237f9..a29d34ef44 100644 --- a/compat/winansi.c +++ b/compat/winansi.c @@ -7,6 +7,7 @@ #include #include #include "win32.h" +#include "win32/lazyload.h" static int fd_is_interactive[3] = { 0, 0, 0 }; #define FD_CONSOLE 0x1 @@ -41,26 +42,21 @@ typedef struct _CONSOLE_FONT_INFOEX { #endif #endif -typedef BOOL (WINAPI *PGETCURRENTCONSOLEFONTEX)(HANDLE, BOOL, - PCONSOLE_FONT_INFOEX); - static void warn_if_raster_font(void) { DWORD fontFamily = 0; - PGETCURRENTCONSOLEFONTEX pGetCurrentConsoleFontEx; + DECLARE_PROC_ADDR(kernel32.dll, BOOL, GetCurrentConsoleFontEx, + HANDLE, BOOL, PCONSOLE_FONT_INFOEX); /* don't bother if output was ascii only */ if (!non_ascii_used) return; /* GetCurrentConsoleFontEx is available since Vista */ - pGetCurrentConsoleFontEx = (PGETCURRENTCONSOLEFONTEX) GetProcAddress( - GetModuleHandle("kernel32.dll"), - "GetCurrentConsoleFontEx"); - if (pGetCurrentConsoleFontEx) { + if (INIT_PROC_ADDR(GetCurrentConsoleFontEx)) { CONSOLE_FONT_INFOEX cfi; cfi.cbSize = sizeof(cfi); - if (pGetCurrentConsoleFontEx(console, 0, &cfi)) + if (GetCurrentConsoleFontEx(console, 0, &cfi)) fontFamily = cfi.FontFamily; } else { /* pre-Vista: check default console font in registry */ From patchwork Thu Jun 13 11:49:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phillip Wood via GitGitGadget X-Patchwork-Id: 10992269 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA76613AF for ; Thu, 13 Jun 2019 15:26:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7D83212BE for ; Thu, 13 Jun 2019 15:26:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CAA93212DB; Thu, 13 Jun 2019 15:26:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D566205F7 for ; Thu, 13 Jun 2019 15:26:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730038AbfFMP0E (ORCPT ); Thu, 13 Jun 2019 11:26:04 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:34396 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729423AbfFMLtt (ORCPT ); Thu, 13 Jun 2019 07:49:49 -0400 Received: by mail-ed1-f65.google.com with SMTP id s49so1005378edb.1 for ; Thu, 13 Jun 2019 04:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=RjK5HPR90OQikUiyb0/LDBsGyBsszNskYXuUhuUaqTw=; b=fP1gjaheIJnQRfx8FRMUh4MwuBj66LPuAERMCCKMOslii0WFIEn8BGX9EU/Ec0GC0T 9wpR2TYkYiJBDT75y+1Wld+NEirZ/NXVZ1+/+p5yfD9JlYfgKS/6kJdFmYomXR0s9aUR YWrxD4GuhfJZcjfvOVdW9O5X/WMPhc+EAn94fhyNG8YLhvHRtbNwUNApR2yWxJ9BwIY+ mWr/f2NFs3MjNgvX/E+cL85vsYRw71E2ijDzzD23+B3/S/l8HX/2I8k2+BvY8pv8LIlV 65vavlSoc4bWUenGUPdJv4RVRVtgb7IlldMhz7Bft0on2VZG7XxdowgHSiaFfpZpn8Ao NXIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=RjK5HPR90OQikUiyb0/LDBsGyBsszNskYXuUhuUaqTw=; b=UKYSNbpyJ9Q0pJf4qYclXRAm24WCBDs2onKmm4MYZQEtFsm8BIuroVKtGS+0ys14Y/ xy3GjLkTbj41Uehd90w2lLj45rJy/2N2z0ZQPb4JXmkUDk9uJgw4EMSzniDvk26yL1Lf YbOE9XOkEInYbDx+nOItGkjOPkmKVQEa+nYPLLdfCt7+z533HBCnQYVYMDJtVTthbL38 vWKJb73HlmchDA21Iz2ExIb7qu0gFUqK4lGL12Wk/stwdInpXkOgmyxzcJugrrFiaa9V K/+/nhPIFSMoV8LymUFTHq+s9yNBxzr1+Ywmzgq0A+bhggBTA9Oz99gGgX6SuuT/M67e fPgw== X-Gm-Message-State: APjAAAVxs79DCSwfvRl0k21/THMtHfv+Ncp1Vynk3Z/BOBRj+YAWUhg4 avAuWqU81qhQTWnVBp9MZvEPkNnN X-Google-Smtp-Source: APXvYqzIeNGmrZkTGXj5YiXE6CmbStIi+nEUhtuwpqnu9qpA5W+hk7ipcVp0VzKGLB0i30YJL4n+rA== X-Received: by 2002:a17:906:1e8a:: with SMTP id e10mr36957150ejj.261.1560426587685; Thu, 13 Jun 2019 04:49:47 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id c49sm260560eda.74.2019.06.13.04.49.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jun 2019 04:49:47 -0700 (PDT) Date: Thu, 13 Jun 2019 04:49:47 -0700 (PDT) X-Google-Original-Date: Thu, 13 Jun 2019 11:49:41 GMT Message-Id: <9613c88849e53e00e1f7ade49c6c9056309ef0b9.1560426581.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 4/4] config: avoid calling `labs()` on too-large data type Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Schindelin The `labs()` function operates, as the initial `l` suggests, on `long` parameters. However, in `config.c` we tried to use it on values of type `intmax_t`. This problem was found by GCC v9.x. To fix it, let's just "unroll" the function (i.e. negate the value if it is negative). Signed-off-by: Johannes Schindelin Signed-off-by: Rene Scharfe --- config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.c b/config.c index 296a6d9cc4..01c6e9df23 100644 --- a/config.c +++ b/config.c @@ -869,9 +869,9 @@ static int git_parse_signed(const char *value, intmax_t *ret, intmax_t max) errno = EINVAL; return 0; } - uval = labs(val); + uval = val < 0 ? -val : val; uval *= factor; - if (uval > max || labs(val) > uval) { + if (uval > max || (val < 0 ? -val : val) > uval) { errno = ERANGE; return 0; }