Module Name: src
Committed By: joerg
Date: Mon May 23 21:59:23 UTC 2011
Modified Files:
src/sys/sys: dirent.h
Log Message:
Use __builtin_offsetof if present for _DIRENT_NAMEOFF to avoid false
positives for uninitialized variable checks.
To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/sys/dirent.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/sys/dirent.h
diff -u src/sys/sys/dirent.h:1.24 src/sys/sys/dirent.h:1.25
--- src/sys/sys/dirent.h:1.24 Sat Mar 15 19:02:49 2008
+++ src/sys/sys/dirent.h Mon May 23 21:59:23 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: dirent.h,v 1.24 2008/03/15 19:02:49 christos Exp $ */
+/* $NetBSD: dirent.h,v 1.25 2011/05/23 21:59:23 joerg Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -83,8 +83,12 @@
* The _DIRENT_NAMEOFF macro returns the offset of the d_name field in
* struct dirent
*/
+#if __GNUC_PREREQ__(4, 0)
+#define _DIRENT_NAMEOFF(dp) __builtin_offsetof(struct dirent, d_name)
+#else
#define _DIRENT_NAMEOFF(dp) \
((char *)(void *)&(dp)->d_name - (char *)(void *)dp)
+#endif
/*
* The _DIRENT_RECLEN macro gives the minimum record length which will hold
* a name of size "namlen". This requires the amount of space in struct dirent