[PATCH 1 of 2] setup: enable pedantic warning of gcc to catch MSVC compatibility issue

Yuya Nishihara yuya at tcha.org
Thu Apr 18 11:39:10 CDT 2013


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1366302847 -32400
#      Fri Apr 19 01:34:07 2013 +0900
# Node ID d81cbdba4275b4bbba564993c2918378ea9d7388
# Parent  7d31f2e42a8afb54c8fae87e8e3e29a63578aea4
setup: enable pedantic warning of gcc to catch MSVC compatibility issue

MSVC is strict for the mixed declaration and code, which is invalid in C89.

CFLAGS has no effect except for Unix-like environment. But I'm a bit afraid
this change might have a platform-specific issue. I've tested with gcc and
clang (Linux amd64) and MSVC.

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -520,6 +520,10 @@ if sys.platform == 'darwin' and os.path.
     if xcode4:
         os.environ['ARCHFLAGS'] = ''
 
+if 'CFLAGS' not in os.environ:
+    # warn mixed declaration and code which is invalid and unsupported by MSVC
+    os.environ['CFLAGS'] = '-pedantic -Wno-long-long'
+
 setup(name='mercurial',
       version=setupversion,
       author='Matt Mackall and many others',


More information about the Mercurial-devel mailing list