From patchwork Mon Oct 5 15:55:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 11817003 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 235B1139A for ; Mon, 5 Oct 2020 16:18:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9F83E206DD for ; Mon, 5 Oct 2020 16:18:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="riE+IYsp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9F83E206DD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPTCD-0008FA-Kx for patchwork-qemu-devel@patchwork.kernel.org; Mon, 05 Oct 2020 12:18:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPSq6-00044i-HG; Mon, 05 Oct 2020 11:55:50 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]:52141) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kPSq4-0001VY-Hm; Mon, 05 Oct 2020 11:55:50 -0400 Received: by mail-pj1-x1029.google.com with SMTP id a17so20285pju.1; Mon, 05 Oct 2020 08:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ws9urbd+LWYd/UwlLgt9Qd/2sSOE/uXLdAEJSjpCLJg=; b=riE+IYspqj/qwjvO+Z8j41EXHDd5RA993fJ/FRrGeFIXYpgOWSn6G9ibiYrBK4pn9r xSblf40fNZi3x+QAHap2QoN/KAGJvAGXjxW+gmwu9Z8APWIYV/rMotshQ3pnLKuPkw/+ No8AFX69mbYhTJUeatcIx4xSnBnU3jk18hEVpucR+GvhJejgbDC2SYk6zbhkoTxKEA9g T1bm8V5zZeqN7u506Oa3kR/4SbFAVv7DUbEedDB826Ffpf6SOqk/ZGgJUSPWwcxOnELN b8YG1j2kk2t6EpbKjlFcDUjWKtN5maDSsDWURT1gPzyLE1+KH64wWe2WVxCDZlyKmdu4 xSIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ws9urbd+LWYd/UwlLgt9Qd/2sSOE/uXLdAEJSjpCLJg=; b=oBE6rjXY5r26hGoENSIx0LKEBNcdqO2FmTI2jGc+C8Emd2qF8sHJpDemlXrhIdRTpj VxVC8QDuc8NJZR8wgY8ekjy4+L6NItWSGS4scVM0u1JYRJgUHw6FePo6M9nHs+tXFJJw DYKhJihTE7c14SZ20u3hlYfTmdqjB2mrmNLXbAU7zF+61+MNzMjo/9dWbLmE1aO+utEA d8P/JNi5eTWlh19LmCLad2uqciSbr+GsgzaMYJ19vw+bJ5g2mAtUGp3VeHP9Zdga66Om 3b7JuShsK0/X/aW4dSTFix0W1FNp7h64L3ch98oxjIQuEEKkBdExLQ72XrrtUkHFyGsN isZA== X-Gm-Message-State: AOAM531M2eKO2oOLqeZCaCdmRf2vF7676FPmsF4r+bYe/G1hsYa1BSrI bVM+mFPb/awRP25w742rxs0klvcYfNVKSQ== X-Google-Smtp-Source: ABdhPJwOfLMcz8k3PnWC4y/OFcI60tj8VzCny6xoBCvZXKhGfmV9+iKjP/+eHmziFzLzRocAUb7YKw== X-Received: by 2002:a17:90a:71c3:: with SMTP id m3mr81488pjs.68.1601913344586; Mon, 05 Oct 2020 08:55:44 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id u22sm34803pgi.85.2020.10.05.08.55.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 08:55:43 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= Subject: [PATCH v8 1/4] configure: fixes indent of $meson setup Date: Mon, 5 Oct 2020 23:55:21 +0800 Message-Id: <20201005155524.442-2-luoyonggang@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20201005155524.442-1-luoyonggang@gmail.com> References: <20201005155524.442-1-luoyonggang@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=luoyonggang@gmail.com; helo=mail-pj1-x1029.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: QEMU Trivial , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Laurent Vivier , Yonggang Luo , Gerd Hoffmann , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" convert these line from tab to space Signed-off-by: Yonggang Luo Reviewed-by: Daniel P. Berrangé --- configure | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/configure b/configure index 66641099fc..7d5ffee29a 100755 --- a/configure +++ b/configure @@ -7315,13 +7315,13 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \ -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \ -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \ -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \ - -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \ - -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf \ - -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \ - -Dcocoa=$cocoa -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \ - -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \ - -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \ - -Dcapstone=$capstone \ + -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \ + -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf \ + -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \ + -Dcocoa=$cocoa -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \ + -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \ + -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \ + -Dcapstone=$capstone \ $cross_arg \ "$PWD" "$source_path" From patchwork Mon Oct 5 15:55:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 11816919 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 42D6192C for ; Mon, 5 Oct 2020 15:57:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CCD4220663 for ; Mon, 5 Oct 2020 15:57:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VtHluAbm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CCD4220663 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:42736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPSrr-0006DN-07 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 05 Oct 2020 11:57:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPSq8-00045T-Ao; Mon, 05 Oct 2020 11:55:52 -0400 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]:53643) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kPSq5-0001Vu-UE; Mon, 05 Oct 2020 11:55:52 -0400 Received: by mail-pj1-x1042.google.com with SMTP id t7so13125pjd.3; Mon, 05 Oct 2020 08:55:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2WqjhroH5SRwZnm2hg+MQdn9o9Rvim5vvZIGkwtpMCA=; b=VtHluAbmnyEkFe4ffbt+2z5d89mFnZRTcVrz7BvsYoaluZBIfhwfBz2MB63ZTivZhM 4oMRx1wPoVQJ88FlNZbPoz28yknSa73RJbBgUVO8qO4iPCt1owRvlCNgA00SxVJFd/lM 7y9bfueWhj4Poda5VYSQu2myaF5ZyxTLsAqGp1QASyvuewJw4vw4089YZjrYdjlPv+8A 7gtGHaG060zkRYbfHxLGWFyIkSpgb1QlTuo+KpnKpAF/7U5Uq6pQfw3quGEFGvmwqac7 AQzT/ls6E0ZwdLIlch8bAEq13aku6eLM+v3BGk2SSkeDbtTCAaS2KIgP0zpb8RWtLHF5 ziSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2WqjhroH5SRwZnm2hg+MQdn9o9Rvim5vvZIGkwtpMCA=; b=HPnN/xRBDKBvR0nXshh9xr2VC3xU+nBKbSFpBHC9at2VzQTWYuGO6CaE5B55a/NHWz pIYvv6jRBBCV4LSu3tdLsmXkTyY3fDbsNq/CtIWbHjgabRWdgC1NHDvysJA3Ez6ULBjX TvhVvpV7XBJ2+7yCi3v3QxTZsvAlnju6Gn/CDDXV1DvNtCrHX0u/XBaE/5JTzLpWKZVA zPvZpXuUZqz4TeEyX6hR3d/1TG6clNOJnN/hijMTlwUiToznc69B+JUAX6Aa3KTLOikf hznlbne10zBkzu0nNqKdjAzQ738uaq7xu+1F0YrUy+yIOWUmK82cimrrCWiXUdNRyAid Purw== X-Gm-Message-State: AOAM531/OMCIcyehxGHOS7aABXe73p/l1vJaasapCyEl3ZKf+Z482HTP 4WNFmXu60vQTvjSmE9vG1zyVzHZ0kxkrfg== X-Google-Smtp-Source: ABdhPJxKxJ31YBgCHp1kyAkGHIbBtZ+ckjbH09U8GbTQcRpMRyEdQG8yeXRh8UYtwqPIAquq6LtTeA== X-Received: by 2002:a17:90b:3109:: with SMTP id gc9mr79842pjb.74.1601913347839; Mon, 05 Oct 2020 08:55:47 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id u22sm34803pgi.85.2020.10.05.08.55.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 08:55:47 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= Subject: [PATCH v8 2/4] curses: Fixes compiler error that complain don't have langinfo.h on msys2/mingw Date: Mon, 5 Oct 2020 23:55:22 +0800 Message-Id: <20201005155524.442-3-luoyonggang@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20201005155524.442-1-luoyonggang@gmail.com> References: <20201005155524.442-1-luoyonggang@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1042; envelope-from=luoyonggang@gmail.com; helo=mail-pj1-x1042.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: QEMU Trivial , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Laurent Vivier , Yonggang Luo , Gerd Hoffmann , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" msys2/mingw lacks the POSIX-required langinfo.h. gcc test.c -DNCURSES_WIDECHAR -I/mingw64/include/ncursesw -pipe -lncursesw -lgnurx -ltre -lintl -liconv test.c:4:10: fatal error: langinfo.h: No such file or directory 4 | #include | ^~~~~~~~~~~~ compilation terminated. So we using g_get_codeset instead of nl_langinfo(CODESET) Signed-off-by: Yonggang Luo Reviewed-by: Gerd Hoffmann Reviewed-by: Daniel P. Berrangé --- configure | 5 +---- ui/curses.c | 10 +++++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/configure b/configure index 7d5ffee29a..6acdd6fa88 100755 --- a/configure +++ b/configure @@ -3522,17 +3522,14 @@ if test "$curses" != "no" ; then #include #include #include -#include int main(void) { - const char *codeset; wchar_t wch = L'w'; setlocale(LC_ALL, ""); resize_term(0, 0); addwstr(L"wide chars\n"); addnwstr(&wch, 1); add_wch(WACS_DEGREE); - codeset = nl_langinfo(CODESET); - return codeset != 0; + return 0; } EOF IFS=: diff --git a/ui/curses.c b/ui/curses.c index a59b23a9cf..12bc682cf9 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -30,7 +30,6 @@ #endif #include #include -#include #include #include "qapi/error.h" @@ -526,6 +525,7 @@ static void font_setup(void) iconv_t nativecharset_to_ucs2; iconv_t font_conv; int i; + g_autofree gchar *local_codeset = g_get_codeset(); /* * Control characters are normally non-printable, but VGA does have @@ -566,14 +566,14 @@ static void font_setup(void) 0x25bc }; - ucs2_to_nativecharset = iconv_open(nl_langinfo(CODESET), "UCS-2"); + ucs2_to_nativecharset = iconv_open(local_codeset, "UCS-2"); if (ucs2_to_nativecharset == (iconv_t) -1) { fprintf(stderr, "Could not convert font glyphs from UCS-2: '%s'\n", strerror(errno)); exit(1); } - nativecharset_to_ucs2 = iconv_open("UCS-2", nl_langinfo(CODESET)); + nativecharset_to_ucs2 = iconv_open("UCS-2", local_codeset); if (nativecharset_to_ucs2 == (iconv_t) -1) { iconv_close(ucs2_to_nativecharset); fprintf(stderr, "Could not convert font glyphs to UCS-2: '%s'\n", @@ -581,7 +581,7 @@ static void font_setup(void) exit(1); } - font_conv = iconv_open(nl_langinfo(CODESET), font_charset); + font_conv = iconv_open(local_codeset, font_charset); if (font_conv == (iconv_t) -1) { iconv_close(ucs2_to_nativecharset); iconv_close(nativecharset_to_ucs2); @@ -602,7 +602,7 @@ static void font_setup(void) /* DEL */ convert_ucs(0x7F, 0x2302, ucs2_to_nativecharset); - if (strcmp(nl_langinfo(CODESET), "UTF-8")) { + if (strcmp(local_codeset, "UTF-8")) { /* Non-Unicode capable, use termcap equivalents for those available */ for (i = 0; i <= 0xFF; i++) { wchar_t wch[CCHARW_MAX]; From patchwork Mon Oct 5 15:55:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 11816933 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 4927E92C for ; Mon, 5 Oct 2020 16:01:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DF8A12068E for ; Mon, 5 Oct 2020 16:01:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uypJZ1tr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF8A12068E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:52148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPSvV-0002Ug-PX for patchwork-qemu-devel@patchwork.kernel.org; Mon, 05 Oct 2020 12:01:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPSqB-00046g-NF; Mon, 05 Oct 2020 11:55:56 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:39738) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kPSqA-0001WN-5C; Mon, 05 Oct 2020 11:55:55 -0400 Received: by mail-pg1-x542.google.com with SMTP id 22so2311888pgv.6; Mon, 05 Oct 2020 08:55:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fONA64XSdMINk4Pb3HJvl02BkTmqUfaoSQk6W/tx2aE=; b=uypJZ1trGOSLsslGxqmD6P8w1q7GbCpafx/NUHxKpmX5uzLV0ysM2NDXXfFjFXneeY 9DJwWImcSyiGPSFdhJZjkEoCyPFyWsUhcgmovGgE/DniX2hLQ9sHr4MRfoqVWG69Qjls tQqP4NNWa9kZKMZ0uq4hYQ5ldIUX5O1miiaaxP5lx1kskE/gjcfsNnGZeIPo8V6lGbSJ TT9eIi9yW5TzgZ5Oltgp4M1x11DkTnCTBgUXzZCeIkkEeaWarj+sXSDW4KnpI+Epu37Q xmaLu83l41AefoZtRJXqw4XskdHOpqQ1FWPtYwomb+ij91+CDGhoABVTtO1TtpbmJbmR l3zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fONA64XSdMINk4Pb3HJvl02BkTmqUfaoSQk6W/tx2aE=; b=j8io3S2C4JrBsvT/fhWVA9dIPtTEa8mCfPQMDAMoTBhoMZefyMeB1Zyr7yJZyWIdAN dSnsYrA53qK8J+LvXYVfN6iH9NL6rfBm4q2oSxKCDMR0xAFNUTgSXzRknWNvzWKil4K7 RvjKurFXUnwUSExMdrbKCC8zVie/vK2eRs+E3YofBdtmtAvZamLCf4VfXMbQFLWz0LJu KN/KPZQftiekKx7K80mSP+AshRuyjJdJ/eWRYTidx50hzs9KLtCKxkLdfJs7gDK/cJW4 E68LX/yuoToQ97tiRohL7FCmOu8RJvjkQwtLFtPe+eiMkSMAx95HrpoNwZ2cBzPwOjFo GgEg== X-Gm-Message-State: AOAM530hrTQ3wzHbYDsH4PQ8Ez9bXe/FxQKPaE+AEG6mObjYjJC/kLSf ymvGe5rbLmXVYUT1culhLBb20g+myvPLHQ== X-Google-Smtp-Source: ABdhPJyIn0sYszzDjP87Ki3otLpJRbPhrTrjcdW6/CLfYEPKc03WVlt9iZwtq9qYMp7xNMmbRv2V1w== X-Received: by 2002:aa7:870c:0:b029:142:2501:34d1 with SMTP id b12-20020aa7870c0000b0290142250134d1mr409803pfo.42.1601913351047; Mon, 05 Oct 2020 08:55:51 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id u22sm34803pgi.85.2020.10.05.08.55.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 08:55:50 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= Subject: [PATCH v8 3/4] curses: Fixes curses compiling errors. Date: Mon, 5 Oct 2020 23:55:23 +0800 Message-Id: <20201005155524.442-4-luoyonggang@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20201005155524.442-1-luoyonggang@gmail.com> References: <20201005155524.442-1-luoyonggang@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::542; envelope-from=luoyonggang@gmail.com; helo=mail-pg1-x542.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: QEMU Trivial , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Laurent Vivier , Yonggang Luo , Gerd Hoffmann , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" This is the compiling error: ../ui/curses.c: In function 'curses_refresh': ../ui/curses.c:256:5: error: 'next_maybe_keycode' may be used uninitialized in this function [-Werror=maybe-uninitialized] 256 | curses2foo(_curses2keycode, _curseskey2keycode, chr, maybe_keycode) | ^~~~~~~~~~ ../ui/curses.c:302:32: note: 'next_maybe_keycode' was declared here 302 | enum maybe_keycode next_maybe_keycode; | ^~~~~~~~~~~~~~~~~~ ../ui/curses.c:256:5: error: 'maybe_keycode' may be used uninitialized in this function [-Werror=maybe-uninitialized] 256 | curses2foo(_curses2keycode, _curseskey2keycode, chr, maybe_keycode) | ^~~~~~~~~~ ../ui/curses.c:265:24: note: 'maybe_keycode' was declared here 265 | enum maybe_keycode maybe_keycode; | ^~~~~~~~~~~~~ cc1.exe: all warnings being treated as errors gcc version 10.2.0 (Rev1, Built by MSYS2 project) Signed-off-by: Yonggang Luo Reviewed-by: Gerd Hoffmann Reviewed-by: Daniel P. Berrangé --- ui/curses.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/curses.c b/ui/curses.c index 12bc682cf9..e4f9588c3e 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -262,7 +262,7 @@ static int curses2foo(const int _curses2foo[], const int _curseskey2foo[], static void curses_refresh(DisplayChangeListener *dcl) { int chr, keysym, keycode, keycode_alt; - enum maybe_keycode maybe_keycode; + enum maybe_keycode maybe_keycode = CURSES_KEYCODE; curses_winch_check(); @@ -299,7 +299,7 @@ static void curses_refresh(DisplayChangeListener *dcl) /* alt or esc key */ if (keycode == 1) { - enum maybe_keycode next_maybe_keycode; + enum maybe_keycode next_maybe_keycode = CURSES_KEYCODE; int nextchr = console_getch(&next_maybe_keycode); if (nextchr != -1) { From patchwork Mon Oct 5 15:55:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yonggang Luo X-Patchwork-Id: 11817005 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 1E93C139A for ; Mon, 5 Oct 2020 16:21:17 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 92FA5206DD for ; Mon, 5 Oct 2020 16:21:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X/D7KW/f" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 92FA5206DD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:50238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPTEh-0001Cm-IH for patchwork-qemu-devel@patchwork.kernel.org; Mon, 05 Oct 2020 12:21:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60046) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPSqF-0004Ao-TB; Mon, 05 Oct 2020 11:56:00 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:40729) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kPSqC-0001YE-QB; Mon, 05 Oct 2020 11:55:59 -0400 Received: by mail-pf1-x443.google.com with SMTP id w21so7193576pfc.7; Mon, 05 Oct 2020 08:55:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SrkVSypShhYA6dpxFUnwCp8qnWAZDmqFXRpgTELiGHU=; b=X/D7KW/fx9ziudkt+fjyondUMfrOwwCHJGW7d5mK9eFLxudVgDXO6FvIusjNQqBII+ Zggwzy91ynhVaTKrffjQBFNDyos3RqSDWSrMoAjl0BigI0fnI+cIYHayzlz+K/gNZuBb cj6/BtYu+luSVzyoEw3ubYT3OrhPP9CTzxWSCa8I0nn4qf9oPOWw+0yjOZMxGpezG/tt rlrve6svPHzTVQ5YJt30q5qj4PBgCM6KY2d3uSDTs2akmW5bbSPbikQG0pqy/oKxj0ql NVokl8tloXJZCBAfvioOdNERC4g2/YZ9IPGVb7yGYCdOeUZBMLB/Cx09DZ1ddigb/Shm StTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SrkVSypShhYA6dpxFUnwCp8qnWAZDmqFXRpgTELiGHU=; b=WmEcUCj2g/CCdByMtEsZXp2Ocxiz4IQCQYP3lTIrICP+JEQZ9xZzWhwbrGW5lTmYCV xsyyKV6HFP0AS66Gg5AHUF8BiKEM//h/ZXKUb6rxodLrUOET77TZsxG1XXkpl6je+19A SktesSSESC6Dtn17ZBHbSJLbqU7PtqKsTzizQOPaodRBMjhxxYr54/ibz0SeCMM8/wlQ DtUkUZnydoqxgUf2xKdFMmsxWh5E+MZMfVuKzhSi8fqWlReIjgI3PVmuHELG7qAZu2pU zylz8UiDMYQpZ4Dr0SJymVIN3rKn1Ro6d8nC4uIYrsK3EL0PHriI8PrxKyUJicLDBqKd IAOw== X-Gm-Message-State: AOAM533A86ZWOlucS8dBITOQ6O6RvbgG6foeMy6gn5O6Lo+ZpgbMNbcR xhPyBvgIX8SqnFbyIQUipphpB3sr9Om6mA== X-Google-Smtp-Source: ABdhPJw3QTCnBM8mvRSSTiDYjcLUk5jjNSrKrfbqCtuIfK5GTtVHJslbAU/vwfINBGyy7vQhWBxwKQ== X-Received: by 2002:a63:f04c:: with SMTP id s12mr80653pgj.425.1601913354325; Mon, 05 Oct 2020 08:55:54 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id u22sm34803pgi.85.2020.10.05.08.55.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 08:55:53 -0700 (PDT) From: Yonggang Luo To: qemu-devel@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= Subject: [PATCH v8 4/4] win32: Simplify gmtime_r detection not depends on if _POSIX_C_SOURCE are defined on msys2/mingw Date: Mon, 5 Oct 2020 23:55:24 +0800 Message-Id: <20201005155524.442-5-luoyonggang@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20201005155524.442-1-luoyonggang@gmail.com> References: <20201005155524.442-1-luoyonggang@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::443; envelope-from=luoyonggang@gmail.com; helo=mail-pf1-x443.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: QEMU Trivial , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Laurent Vivier , Yonggang Luo , Gerd Hoffmann , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" We remove the CONFIG_LOCALTIME_R detection option in configure, and move the check existence of gmtime_r from configure into C header and source directly by using macro `_POSIX_THREAD_SAFE_FUNCTIONS`. Before this patch, the configure script are always assume the compiler doesn't define _POSIX_C_SOURCE macro at all, but that's not true, because thirdparty library such as ncursesw may define -D_POSIX_C_SOURCE in it's pkg-config file. And that C Flags will added -D_POSIX_C_SOURCE into each QEMU_CFLAGS. And that's causing the following compiling error: n file included from C:/work/xemu/qemu/include/qemu/osdep.h:119, from ../softmmu/main.c:25: C:/work/xemu/qemu/include/sysemu/os-win32.h:53:12: error: redundant redeclaration of 'gmtime_r' [-Werror=redundant-decls] 53 | struct tm *gmtime_r(const time_t *timep, struct tm *result); | ^~~~~~~~ In file included from C:/work/xemu/qemu/include/qemu/osdep.h:94, from ../softmmu/main.c:25: C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/time.h:284:36: note: previous definition of 'gmtime_r' was here 284 | __forceinline struct tm *__CRTDECL gmtime_r(const time_t *_Time, struct tm *_Tm) { | ^~~~~~~~ In file included from C:/work/xemu/qemu/include/qemu/osdep.h:119, from ../softmmu/main.c:25: C:/work/xemu/qemu/include/sysemu/os-win32.h:55:12: error: redundant redeclaration of 'localtime_r' [-Werror=redundant-decls] 55 | struct tm *localtime_r(const time_t *timep, struct tm *result); | ^~~~~~~~~~~ In file included from C:/work/xemu/qemu/include/qemu/osdep.h:94, from ../softmmu/main.c:25: C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/time.h:281:36: note: previous definition of 'localtime_r' was here 281 | __forceinline struct tm *__CRTDECL localtime_r(const time_t *_Time, struct tm *_Tm) { | ^~~~~~~~~~~ Compiling C object libcommon.fa.p/hw_gpio_zaurus.c.obj In file included from C:/work/xemu/qemu/include/qemu/osdep.h:119, from ../hw/i2c/smbus_slave.c:16: C:/work/xemu/qemu/include/sysemu/os-win32.h:53:12: error: redundant redeclaration of 'gmtime_r' [-Werror=redundant-decls] 53 | struct tm *gmtime_r(const time_t *timep, struct tm *result); | ^~~~~~~~ In file included from C:/work/xemu/qemu/include/qemu/osdep.h:94, from ../hw/i2c/smbus_slave.c:16: C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/time.h:284:36: note: previous definition of 'gmtime_r' was here 284 | __forceinline struct tm *__CRTDECL gmtime_r(const time_t *_Time, struct tm *_Tm) { | ^~~~~~~~ In file included from C:/work/xemu/qemu/include/qemu/osdep.h:119, from ../hw/i2c/smbus_slave.c:16: C:/work/xemu/qemu/include/sysemu/os-win32.h:55:12: error: redundant redeclaration of 'localtime_r' [-Werror=redundant-decls] 55 | struct tm *localtime_r(const time_t *timep, struct tm *result); | ^~~~~~~~~~~ In file included from C:/work/xemu/qemu/include/qemu/osdep.h:94, from ../hw/i2c/smbus_slave.c:16: C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/time.h:281:36: note: previous definition of 'localtime_r' was here 281 | __forceinline struct tm *__CRTDECL localtime_r(const time_t *_Time, struct tm *_Tm) { | ^~~~~~~~~~~ Compiling C object libcommon.fa.p/hw_dma_xilinx_axidma.c.obj After this patch, whenever ncursesw or other thirdparty libraries tried to define or not define _POSIX_C_SOURCE, the source will building properly. Because now, we don't make any assumption if _POSIX_C_SOURCE are defined. We solely relied on if the macro `_POSIX_THREAD_SAFE_FUNCTIONS` are defined in msys2/mingw header. The _POSIX_THREAD_SAFE_FUNCTIONS are defined in mingw header like this: ``` #if defined(_POSIX_C_SOURCE) && !defined(_POSIX_THREAD_SAFE_FUNCTIONS) #define _POSIX_THREAD_SAFE_FUNCTIONS 200112L #endif #ifdef _POSIX_THREAD_SAFE_FUNCTIONS __forceinline struct tm *__CRTDECL localtime_r(const time_t *_Time, struct tm *_Tm) { return localtime_s(_Tm, _Time) ? NULL : _Tm; } __forceinline struct tm *__CRTDECL gmtime_r(const time_t *_Time, struct tm *_Tm) { return gmtime_s(_Tm, _Time) ? NULL : _Tm; } __forceinline char *__CRTDECL ctime_r(const time_t *_Time, char *_Str) { return ctime_s(_Str, 0x7fffffff, _Time) ? NULL : _Str; } __forceinline char *__CRTDECL asctime_r(const struct tm *_Tm, char * _Str) { return asctime_s(_Str, 0x7fffffff, _Tm) ? NULL : _Str; } #endif ``` Signed-off-by: Yonggang Luo Reviewed-by: Daniel P. Berrangé --- configure | 34 ---------------------------------- include/sysemu/os-win32.h | 4 ++-- util/oslib-win32.c | 4 ++-- 3 files changed, 4 insertions(+), 38 deletions(-) diff --git a/configure b/configure index 6acdd6fa88..19813935b3 100755 --- a/configure +++ b/configure @@ -2378,37 +2378,6 @@ if test "$vhost_net" = ""; then test "$vhost_kernel" = "yes" && vhost_net=yes fi -########################################## -# MinGW / Mingw-w64 localtime_r/gmtime_r check - -if test "$mingw32" = "yes"; then - # Some versions of MinGW / Mingw-w64 lack localtime_r - # and gmtime_r entirely. - # - # Some versions of Mingw-w64 define a macro for - # localtime_r/gmtime_r. - # - # Some versions of Mingw-w64 will define functions - # for localtime_r/gmtime_r, but only if you have - # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun - # though, unistd.h and pthread.h both define - # that for you. - # - # So this #undef localtime_r and #include - # are not in fact redundant. -cat > $TMPC << EOF -#include -#include -#undef localtime_r -int main(void) { localtime_r(NULL, NULL); return 0; } -EOF - if compile_prog "" "" ; then - localtime_r="yes" - else - localtime_r="no" - fi -fi - ########################################## # pkg-config probe @@ -6715,9 +6684,6 @@ if [ "$bsd" = "yes" ] ; then echo "CONFIG_BSD=y" >> $config_host_mak fi -if test "$localtime_r" = "yes" ; then - echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak -fi if test "$qom_cast_debug" = "yes" ; then echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak fi diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h index d8978e28c0..5346d51e89 100644 --- a/include/sysemu/os-win32.h +++ b/include/sysemu/os-win32.h @@ -48,12 +48,12 @@ #define siglongjmp(env, val) longjmp(env, val) /* Missing POSIX functions. Don't use MinGW-w64 macros. */ -#ifndef CONFIG_LOCALTIME_R +#ifndef _POSIX_THREAD_SAFE_FUNCTIONS #undef gmtime_r struct tm *gmtime_r(const time_t *timep, struct tm *result); #undef localtime_r struct tm *localtime_r(const time_t *timep, struct tm *result); -#endif /* CONFIG_LOCALTIME_R */ +#endif /* _POSIX_THREAD_SAFE_FUNCTIONS */ static inline void os_setup_signal_handling(void) {} static inline void os_daemonize(void) {} diff --git a/util/oslib-win32.c b/util/oslib-win32.c index 051afb217b..e99debfb8d 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -106,7 +106,7 @@ void qemu_anon_ram_free(void *ptr, size_t size) } } -#ifndef CONFIG_LOCALTIME_R +#ifndef _POSIX_THREAD_SAFE_FUNCTIONS /* FIXME: add proper locking */ struct tm *gmtime_r(const time_t *timep, struct tm *result) { @@ -130,7 +130,7 @@ struct tm *localtime_r(const time_t *timep, struct tm *result) } return p; } -#endif /* CONFIG_LOCALTIME_R */ +#endif /* _POSIX_THREAD_SAFE_FUNCTIONS */ static int socket_error(void) {