[PATCH] osutil: replace #import with #include, and add a check for it

Dan Villiom Podlaski Christiansen danchr at gmail.com
Wed Mar 23 17:06:53 CDT 2011


# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
# Date 1300917932 -3600
# Node ID 96d5fedbd089bd0fa2082316b905d0cce0eb06f5
# Parent  f28cf1760deec2a67791e85d701717481b74c227
osutil: replace #import with #include, and add a check for it

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -180,6 +180,7 @@ cpats = [
     (r'^[^#]\w[+/*]\w', "missing whitespace in expression"),
     (r'^#\s+\w', "use #foo, not # foo"),
     (r'[^\n]\Z', "no trailing newline"),
+    (r'^\s*#import\b', "use only #include in standard C code"),
 ]
 
 cfilters = [
diff --git a/mercurial/osutil.c b/mercurial/osutil.c
--- a/mercurial/osutil.c
+++ b/mercurial/osutil.c
@@ -515,7 +515,7 @@ bail:
 #endif
 
 #ifdef __APPLE__
-#import <ApplicationServices/ApplicationServices.h>
+#include <ApplicationServices/ApplicationServices.h>
 
 static PyObject *isgui(PyObject *self)
 {


More information about the Mercurial-devel mailing list