weeding out c++ keywords from sys/sys

From: Andriy Gapon <avg_at_icyb.net.ua>
Date: Fri, 13 Feb 2009 20:25:31 +0200
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
_at__at_ -145,7 +145,7 _at__at_ 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
_at__at_ -160,7 +160,7 _at__at_ 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
Received on Fri Feb 13 2009 - 17:25:35 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:42 UTC