Date: Thu, 25 Sep 2003 10:40:25 +0200 From: Adriaan de Groot <adridg@cs.kun.nl> To: freebsd-stable@freebsd.org Cc: kde@freebsd.org Subject: [PATCH?] vm/vm_map.h C++ incompatible Message-ID: <200309251040.25568.adridg@cs.kun.nl>
next in thread | raw e-mail | index | archive | help
--Boundary-00=_5nqc/9ky8CyU1R6 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline On 4.9-pre, vm/vm_map.h is not C++ compatible, due to this kind of call: lockmgr(&(map)->lock, LK_RELEASE, (void *)0, curproc); C++ (or rather, gcc 2.95.4) refuses to cast (void *) to the desired (struct simplelock *), so C++ compilations that accidentally include vm/vm_map.h fail. So do C++ compiles that intentionally pick it up, like kfontinst, which is why I'm cc-ing kde@. The attached patch replaces all the (void *) casts with casts to the correct type; this fixes kfontinst, at the very least. It doesn't seem to hurt C compilation, either. -- pub 1024D/FEA2A3FE 2002-06-18 Adriaan de Groot <groot@kde.org> Key fingerprint = 934E 31AA 80A7 723F 54F9 50ED 76AC EE01 FEA2 A3FE --Boundary-00=_5nqc/9ky8CyU1R6 Content-Type: text/x-diff; charset="us-ascii"; name="vm_map.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="vm_map.diff" --- /tmp/vm_map.h Thu Sep 25 10:13:53 2003 +++ /usr/include/vm/vm_map.h Thu Sep 25 10:19:50 2003 @@ -225,7 +225,7 @@ #define vm_map_lock(map) \ do { \ printf ("locking map LK_EXCLUSIVE: 0x%x\n", map); \ - if (lockmgr(&(map)->lock, LK_EXCLUSIVE, (void *)0, curproc) != 0) { \ + if (lockmgr(&(map)->lock, LK_EXCLUSIVE, (struct simplelock *)0, curproc) != 0) { \ panic("vm_map_lock: failed to get lock"); \ } \ (map)->timestamp++; \ @@ -233,7 +233,7 @@ #else #define vm_map_lock(map) \ do { \ - if (lockmgr(&(map)->lock, LK_EXCLUSIVE, (void *)0, curproc) != 0) { \ + if (lockmgr(&(map)->lock, LK_EXCLUSIVE, (struct simplelock *)0, curproc) != 0) { \ panic("vm_map_lock: failed to get lock"); \ } \ (map)->timestamp++; \ @@ -242,7 +242,7 @@ #else #define vm_map_lock(map) \ do { \ - lockmgr(&(map)->lock, LK_EXCLUSIVE, (void *)0, curproc); \ + lockmgr(&(map)->lock, LK_EXCLUSIVE, (struct simplelock *)0, curproc); \ (map)->timestamp++; \ } while(0) #endif /* DIAGNOSTIC */ @@ -251,25 +251,25 @@ #define vm_map_unlock(map) \ do { \ printf ("locking map LK_RELEASE: 0x%x\n", map); \ - lockmgr(&(map)->lock, LK_RELEASE, (void *)0, curproc); \ + lockmgr(&(map)->lock, LK_RELEASE, (struct simplelock *)0, curproc); \ } while (0) #define vm_map_lock_read(map) \ do { \ printf ("locking map LK_SHARED: 0x%x\n", map); \ - lockmgr(&(map)->lock, LK_SHARED, (void *)0, curproc); \ + lockmgr(&(map)->lock, LK_SHARED, (struct simplelock *)0, curproc); \ } while (0) #define vm_map_unlock_read(map) \ do { \ printf ("locking map LK_RELEASE: 0x%x\n", map); \ - lockmgr(&(map)->lock, LK_RELEASE, (void *)0, curproc); \ + lockmgr(&(map)->lock, LK_RELEASE, (struct simplelock *)0, curproc); \ } while (0) #else #define vm_map_unlock(map) \ - lockmgr(&(map)->lock, LK_RELEASE, (void *)0, curproc) + lockmgr(&(map)->lock, LK_RELEASE, (struct simplelock *)0, curproc) #define vm_map_lock_read(map) \ - lockmgr(&(map)->lock, LK_SHARED, (void *)0, curproc) + lockmgr(&(map)->lock, LK_SHARED, (struct simplelock *)0, curproc) #define vm_map_unlock_read(map) \ - lockmgr(&(map)->lock, LK_RELEASE, (void *)0, curproc) + lockmgr(&(map)->lock, LK_RELEASE, (struct simplelock *)0, curproc) #endif static __inline__ int @@ -278,7 +278,7 @@ #if defined(MAP_LOCK_DIAGNOSTIC) printf("locking map LK_EXCLUPGRADE: 0x%x\n", map); #endif - error = lockmgr(&map->lock, LK_EXCLUPGRADE, (void *)0, p); + error = lockmgr(&map->lock, LK_EXCLUPGRADE, (struct simplelock *)0, p); if (error == 0) map->timestamp++; return error; @@ -290,11 +290,11 @@ #define vm_map_lock_downgrade(map) \ do { \ printf ("locking map LK_DOWNGRADE: 0x%x\n", map); \ - lockmgr(&(map)->lock, LK_DOWNGRADE, (void *)0, curproc); \ + lockmgr(&(map)->lock, LK_DOWNGRADE, (struct simplelock *)0, curproc); \ } while (0) #else #define vm_map_lock_downgrade(map) \ - lockmgr(&(map)->lock, LK_DOWNGRADE, (void *)0, curproc) + lockmgr(&(map)->lock, LK_DOWNGRADE, (struct simplelock *)0, curproc) #endif #define vm_map_set_recursive(map) \ --Boundary-00=_5nqc/9ky8CyU1R6--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200309251040.25568.adridg>