Patchwork [stable] util.h: also sniff for C99 before trying to use stdbool.h (issue4605)

login
register
mail settings
Submitter Augie Fackler
Date April 20, 2015, 6:49 p.m.
Message ID <4dd560f7db48d32c3c5c.1429555761@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/8752/
State Accepted
Commit 3550ccbafca2c1ef213f4f052cb44aafc4524339
Headers show

Comments

Augie Fackler - April 20, 2015, 6:49 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1429555671 14400
#      Mon Apr 20 14:47:51 2015 -0400
# Branch stable
# Node ID 4dd560f7db48d32c3c5ccae932967bbcb32cea1d
# Parent  8678b1eafbcfbd328a48bd24b9e1b5761d06520d
util.h: also sniff for C99 before trying to use stdbool.h (issue4605)

stdbool.h isn't required until C99. Sigh.
Matt Mackall - April 20, 2015, 9:07 p.m.
On Mon, 2015-04-20 at 14:49 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1429555671 14400
> #      Mon Apr 20 14:47:51 2015 -0400
> # Branch stable
> # Node ID 4dd560f7db48d32c3c5ccae932967bbcb32cea1d
> # Parent  8678b1eafbcfbd328a48bd24b9e1b5761d06520d
> util.h: also sniff for C99 before trying to use stdbool.h (issue4605)

Queued for stable, thanks.

Patch

diff --git a/mercurial/util.h b/mercurial/util.h
--- a/mercurial/util.h
+++ b/mercurial/util.h
@@ -218,7 +218,7 @@  enum normcase_spec {
 
 #define MIN(a, b) (((a)<(b))?(a):(b))
 /* VC9 doesn't include bool and lacks stdbool.h based on my searching */
-#ifdef _MSC_VER
+#ifdef _MSC_VER || __STDC_VERSION__ < 199901L
 #define true 1
 #define false 0
 typedef unsigned char bool;