Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fNJeW-0003a7-TX for pgsql-hackers@arkaria.postgresql.org; Mon, 28 May 2018 15:01:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fNJeV-0003Ut-Jh for pgsql-hackers@arkaria.postgresql.org; Mon, 28 May 2018 15:01:39 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fNJeV-0003Uk-6G for pgsql-hackers@lists.postgresql.org; Mon, 28 May 2018 15:01:39 +0000 Received: from mail-qt0-x244.google.com ([2607:f8b0:400d:c0d::244]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fNJeK-0008Tm-JC for pgsql-hackers@lists.postgresql.org; Mon, 28 May 2018 15:01:37 +0000 Received: by mail-qt0-x244.google.com with SMTP id m5-v6so15201307qti.1 for ; Mon, 28 May 2018 08:01:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=nwyoUjSAhDNo86mqENhmiup2SnErVuUXs/Kc1UufiWA=; b=CfeOkCx54HQ5zorW2RrIzlt/XYgi27U50x5kcyvwE1Uedq7eTF3x+kdQESFNiizZgV ir2Pyl3p0SziS59ITpHUjJhCGDXX6c2hyy7Y8EY2XMQ+r0Bikr5m91GCt/FCk6gXO7Mu yznlOcgIJN7oupOaaXlzFrWx6aapjGaBEloX+gCzaNumMOTmmmwaoy59XcLXEwmnB5Lm 4DOs3EjtLzIReQVSE9uRUs7d0j/36lTgib5A5bWICcdkywgaUH6u4xlXrb9q0EiFq4Xk 1sbZeuJvcPs011b6ciMYm1/NwxZPXdHOowQPzL0Sq6CidscU9aJ+E+KtMehY5rR/Iyxv WjSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=nwyoUjSAhDNo86mqENhmiup2SnErVuUXs/Kc1UufiWA=; b=Y+PbMqexCxNZ/0RIkolzhrkXIr4v8b8JJRuPONft+J9L4vOxkLdJe1/xRgX83XStME AVGVOJEtKPTjc2ii1uN/mkMHtB7fyBpq0wq4PeEd2ihsA1lq6Ccch11+NtCiqSixX607 1CdGf5rXvld4fEFHqWKxoQbsEOD01NjsB6mplNiY2e84N5COIm2tgJ7ohjfgwUjKDrF8 8oGfaoAINSg0eUcrflJvCMeqfG+7n+zhGNfWF+JUrQVICzWA+s6SY1q0w70Rj2R3fjiV asn/j77ejkuAnVhrowPuxnvfnZkZWpZK9GZVtyK5cLnzIMaDZzskpXcnlZZiMlC691Bz gRvA== X-Gm-Message-State: ALKqPwffxrO7zVCsKp7q+L7eiyFRu55yK2SKReZVBvOika4CKzSo0I6G Ti9Cs+GrgmocjP0scVkt8aPCsw== X-Google-Smtp-Source: ADUXVKKo/4FoJbS9egXTm1CHYcnlcu5gmIEpH6ptHq92AdrMbrDXF+kOUDuvs78UISFAdlZY/MWNtA== X-Received: by 2002:aed:3162:: with SMTP id 89-v6mr13131090qtg.280.1527519687635; Mon, 28 May 2018 08:01:27 -0700 (PDT) Received: from alvin.alvh.no-ip.org ([179.57.112.31]) by smtp.gmail.com with ESMTPSA id k2-v6sm9964756qkl.95.2018.05.28.08.01.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 May 2018 08:01:27 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 698105CC; Mon, 28 May 2018 11:01:25 -0400 (-04) Date: Mon, 28 May 2018 11:01:25 -0400 From: Alvaro Herrera To: Thomas Munro Cc: Tom Lane , PostgreSQL Hackers Subject: Re: Allowing printf("%m") only where it actually works Message-ID: <20180528150125.j2x3mp62ssbeg3h5@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2018-May-27, Thomas Munro wrote: > Out of curiosity I tried adding a GetLastError variable for Windows > (to hide the function of that name and break callers) to the earlier > experimental patch (attached). I had to give it an initial value to > get rid of a warning about an unused variable (by my reading of the > documentation, __pragma(warning(suppress:4101)) can be used in macros > (unlike #pragma) and should shut that warning up, but it doesn't work > for me, not sure why). Of course that produces many errors since we > do that all over the place: > > https://ci.appveyor.com/project/macdice/postgres/build/1.0.184 Ouch. This seems to say that we oughta assign GetLastError() to saved_errno during errstart, then use %m in the errmsg() instead. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services