From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47063 invoked by alias); 3 Jul 2017 10:04:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 43361 invoked by uid 89); 3 Jul 2017 10:04:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=sk:environ, environ, our X-HELO: smtprelay.synopsys.com Received: from us01smtprelay-2.synopsys.com (HELO smtprelay.synopsys.com) (198.182.47.9) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 03 Jul 2017 10:04:29 +0000 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 9173B24E1407; Mon, 3 Jul 2017 03:04:28 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 3F86B98D; Mon, 3 Jul 2017 03:04:28 -0700 (PDT) Received: from akolesov-lab.internal.synopsys.com (akolesov-lab.internal.synopsys.com [10.121.14.106]) by mailhost.synopsys.com (Postfix) with ESMTP id E8B6396A; Mon, 3 Jul 2017 03:04:26 -0700 (PDT) From: Anton Kolesov To: gdb-patches@sourceware.org Cc: Anton Kolesov , Francois Bedard , Sergio Durigan Junior Subject: [PATCH] Fix build breakage on MinGW due to missing setenv Date: Mon, 03 Jul 2017 10:04:00 -0000 Message-Id: <20170703100258.15837-1-Anton.Kolesov@synopsys.com> X-SW-Source: 2017-07/txt/msg00009.txt.bz2 Patch [1] broke a build on MinGW hosts, because MinGW doesn't provide POSIX functions setenv () and unsetenv (), instead there is a putenv () wrapper around WinAPI function, although with a different signature. [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=9a6c7d9c0 gdb/ChangeLog yyyy-mm-dd Anton Kolesov * unittests/environ-selftests.c (run_tests): Use putenv on MinGW. --- gdb/unittests/environ-selftests.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gdb/unittests/environ-selftests.c b/gdb/unittests/environ-selftests.c index 28b16f8..8872bfa 100644 --- a/gdb/unittests/environ-selftests.c +++ b/gdb/unittests/environ-selftests.c @@ -30,7 +30,11 @@ run_tests () { /* Set a test environment variable. This will be unset at the end of this function. */ +#ifndef USE_WIN32API if (setenv ("GDB_SELFTEST_ENVIRON", "1", 1) != 0) +#else + if (putenv ("GDB_SELFTEST_ENVIRON=1") != 0) +#endif error (_("Could not set environment variable for testing.")); gdb_environ env; @@ -90,7 +94,13 @@ run_tests () SELF_CHECK (num_found == 1); /* Get rid of our test variable. */ +#ifndef USE_WIN32API unsetenv ("GDB_SELFTEST_ENVIRON"); +#else + /* putenv ("var=") has the same meaning as unsetenv ("var"), unlike the + setenv ("var="), which would assign an empty value. */ + putenv ("GDB_SELFTEST_ENVIRON="); +#endif /* Test the case when we set a variable A, then set a variable B, then unset A, and make sure that we cannot find A in the environ -- 2.8.3