qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] Use standard header for offsetof


From: Stefan Weil
Subject: [Qemu-devel] [PATCH] Use standard header for offsetof
Date: Sun, 01 Jun 2008 19:37:43 +0200
User-agent: Mozilla-Thunderbird 2.0.0.14 (X11/20080509)

This patch adds the standard header stddef.h to all files which call offsetof. It also removes several local definitions of offsetof which are no longer needed.

If you prefer standard headers for standard macros instead of local definitions
(like I do), you can add this patch to Qemu trunk.

Thanks,
Stefan

Index: translate-all.c
===================================================================
--- translate-all.c     (revision 4638)
+++ translate-all.c     (working copy)
@@ -18,6 +18,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 #include <stdarg.h>
+#include <stddef.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
Index: target-cris/translate.c
===================================================================
--- target-cris/translate.c     (revision 4638)
+++ target-cris/translate.c     (working copy)
@@ -25,6 +25,7 @@
  */
 
 #include <stdarg.h>
+#include <stddef.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
Index: softmmu_header.h
===================================================================
--- softmmu_header.h    (revision 4638)
+++ softmmu_header.h    (working copy)
@@ -17,6 +17,8 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+
+#include <stddef.h>
 #if DATA_SIZE == 8
 #define SUFFIX q
 #define USUFFIX q
Index: target-sparc/translate.c
===================================================================
--- target-sparc/translate.c    (revision 4638)
+++ target-sparc/translate.c    (working copy)
@@ -20,6 +20,7 @@
  */
 
 #include <stdarg.h>
+#include <stddef.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
Index: target-m68k/helper.c
===================================================================
--- target-m68k/helper.c        (revision 4638)
+++ target-m68k/helper.c        (working copy)
@@ -19,6 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <stddef.h>
 #include <stdio.h>
 #include <string.h>
 
Index: target-m68k/translate.c
===================================================================
--- target-m68k/translate.c     (revision 4638)
+++ target-m68k/translate.c     (working copy)
@@ -19,6 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 #include <stdarg.h>
+#include <stddef.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
Index: linux-user/signal.c
===================================================================
--- linux-user/signal.c (revision 4638)
+++ linux-user/signal.c (working copy)
@@ -17,6 +17,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
+#include <stddef.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -548,10 +549,6 @@
     return ret;
 }
 
-#ifndef offsetof
-#define offsetof(type, field) ((size_t) &((type *)0)->field)
-#endif
-
 static inline int copy_siginfo_to_user(target_siginfo_t *tinfo,
                                        const target_siginfo_t *info)
 {
Index: target-mips/translate.c
===================================================================
--- target-mips/translate.c     (revision 4638)
+++ target-mips/translate.c     (working copy)
@@ -21,6 +21,7 @@
  */
 
 #include <stdarg.h>
+#include <stddef.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
Index: tcg/arm/tcg-target.c
===================================================================
--- tcg/arm/tcg-target.c        (revision 4638)
+++ tcg/arm/tcg-target.c        (working copy)
@@ -21,6 +21,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
+#include <stddef.h>
+
 const char *tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
     "%r0",
     "%r1",
Index: tcg/ppc/tcg-target.c
===================================================================
--- tcg/ppc/tcg-target.c        (revision 4638)
+++ tcg/ppc/tcg-target.c        (working copy)
@@ -22,6 +22,8 @@
  * THE SOFTWARE.
  */
 
+#include <stddef.h>
+
 static uint8_t *tb_ret_addr;
 
 #define FAST_PATH
Index: tcg/hppa/tcg-target.c
===================================================================
--- tcg/hppa/tcg-target.c       (revision 4638)
+++ tcg/hppa/tcg-target.c       (working copy)
@@ -22,6 +22,8 @@
  * THE SOFTWARE.
  */
 
+#include <stddef.h>
+
 static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
     "%r0",
     "%r1",
Index: tcg/i386/tcg-target.c
===================================================================
--- tcg/i386/tcg-target.c       (revision 4638)
+++ tcg/i386/tcg-target.c       (working copy)
@@ -21,6 +21,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
+#include <stddef.h>
+
 const char *tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
     "%eax",
     "%ecx",
Index: tcg/x86_64/tcg-target.c
===================================================================
--- tcg/x86_64/tcg-target.c     (revision 4638)
+++ tcg/x86_64/tcg-target.c     (working copy)
@@ -21,6 +21,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
+#include <stddef.h>
+
 const char *tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
     "%rax",
     "%rcx",
Index: tcg/sparc/tcg-target.c
===================================================================
--- tcg/sparc/tcg-target.c      (revision 4638)
+++ tcg/sparc/tcg-target.c      (working copy)
@@ -22,6 +22,8 @@
  * THE SOFTWARE.
  */
 
+#include <stddef.h>
+
 static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
     "%g0",
     "%g1",
Index: cpu-exec.c
===================================================================
--- cpu-exec.c  (revision 4638)
+++ cpu-exec.c  (working copy)
@@ -17,6 +17,7 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+#include <stddef.h>
 #include "config.h"
 #define CPU_NO_GLOBAL_REGS
 #include "exec.h"
Index: block-qcow2.c
===================================================================
--- block-qcow2.c       (revision 4638)
+++ block-qcow2.c       (working copy)
@@ -21,6 +21,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
+#include <stddef.h>
 #include "qemu-common.h"
 #include "block_int.h"
 #include <zlib.h>
@@ -59,10 +61,6 @@
 
 #define REFCOUNT_SHIFT 1 /* refcount size is 2 bytes */
 
-#ifndef offsetof
-#define offsetof(type, field) ((size_t) &((type *)0)->field)
-#endif
-
 typedef struct QCowHeader {
     uint32_t magic;
     uint32_t version;
Index: exec.c
===================================================================
--- exec.c      (revision 4638)
+++ exec.c      (working copy)
@@ -28,6 +28,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdarg.h>
+#include <stddef.h>
 #include <string.h>
 #include <errno.h>
 #include <unistd.h>
Index: monitor.c
===================================================================
--- monitor.c   (revision 4638)
+++ monitor.c   (working copy)
@@ -21,6 +21,7 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#include <stddef.h>
 #include "hw/hw.h"
 #include "hw/usb.h"
 #include "hw/pcmcia.h"
@@ -43,10 +44,6 @@
 //#define DEBUG
 //#define DEBUG_COMPLETION
 
-#ifndef offsetof
-#define offsetof(type, field) ((size_t) &((type *)0)->field)
-#endif
-
 /*
  * Supported types:
  *
Index: exec-all.h
===================================================================
--- exec-all.h  (revision 4638)
+++ exec-all.h  (working copy)
@@ -275,10 +275,6 @@
 
 TranslationBlock *tb_find_pc(unsigned long pc_ptr);
 
-#ifndef offsetof
-#define offsetof(type, field) ((size_t) &((type *)0)->field)
-#endif
-
 #if defined(_WIN32)
 #define ASM_DATA_SECTION ".section \".data\"\n"
 #define ASM_PREVIOUS_SECTION ".section .text\n"
Index: target-i386/helper.c
===================================================================
--- target-i386/helper.c        (revision 4638)
+++ target-i386/helper.c        (working copy)
@@ -18,6 +18,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 #include <stdarg.h>
+#include <stddef.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
Index: target-i386/op_helper.c
===================================================================
--- target-i386/op_helper.c     (revision 4638)
+++ target-i386/op_helper.c     (working copy)
@@ -18,6 +18,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 #define CPU_NO_GLOBAL_REGS
+#include <stddef.h>
 #include "exec.h"
 #include "host-utils.h"
 
Index: target-i386/translate.c
===================================================================
--- target-i386/translate.c     (revision 4638)
+++ target-i386/translate.c     (working copy)
@@ -18,6 +18,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 #include <stdarg.h>
+#include <stddef.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
Index: target-arm/helper.c
===================================================================
--- target-arm/helper.c (revision 4638)
+++ target-arm/helper.c (working copy)
@@ -1,4 +1,5 @@
 #include <stdio.h>
+#include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
 
Index: target-arm/translate.c
===================================================================
--- target-arm/translate.c      (revision 4638)
+++ target-arm/translate.c      (working copy)
@@ -20,6 +20,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 #include <stdarg.h>
+#include <stddef.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]