Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Feb 2009 20:25:31 +0200
From:      Andriy Gapon <avg@icyb.net.ua>
To:        freebsd-current@freebsd.org
Subject:   weeding out c++ keywords from sys/sys
Message-ID:  <4995BB1B.7060201@icyb.net.ua>

next in thread | raw e-mail | index | archive | help

Proposal:
Make header files in sys/sys C++-friendly.

Rationale:
There are people who write FreeBSD drivers in C++, the driver code needs
to include some headers from sys/sys and it causes some pain if the
headers contain reserved C++ keywords.

Scope:
Very limited. This is not about making the whole kernel compilable by a
C++ compiler. And not about making all sources "future"-proof, just
about making life a little bit easier for a few fellows.

Efforts:
Non-trivial effort would be needed only for conflicts in types/fields
definitions. Function params for prototypes and typedef are low hanging
fruits.

Start:
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index 9d8da2c..b7f9df6 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -145,7 +145,7 @@ typedef int d_spare2_t(struct cdev *dev);

 typedef int dumper_t(
 	void *priv,		/* Private to the driver. */
-	void *virtual,		/* Virtual (mapped) address. */
+	void *virt,		/* Virtual (mapped) address. */
 	vm_offset_t physical,	/* Physical address of virtual. */
 	off_t offset,		/* Byte-offset to write at. */
 	size_t length);		/* Number of bytes to dump. */
diff --git a/sys/sys/lock_profile.h b/sys/sys/lock_profile.h
index f2861ac..7e7f666 100644
--- a/sys/sys/lock_profile.h
+++ b/sys/sys/lock_profile.h
@@ -160,7 +160,7 @@ static inline void
lock_profile_obtain_lock_failed(struct lock_object *lo, int *
 static inline void lock_profile_obtain_lock_success(struct lock_object
*lo, int contested, uint64_t waittime,
 						    const char *file, int line) {;}
 static inline void lock_profile_object_destroy(struct lock_object *lo) {;}
-static inline void lock_profile_object_init(struct lock_object *lo,
struct lock_class *class, const char *name) {;}
+static inline void lock_profile_object_init(struct lock_object *lo,
struct lock_class *clazz, const char *name) {;}

 #endif /* _KERNEL */


-- 
Andriy Gapon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4995BB1B.7060201>