From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K2rV7-0000f2-8F for qemu-devel@nongnu.org; Sun, 01 Jun 2008 13:37:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K2rV4-0000bY-W1 for qemu-devel@nongnu.org; Sun, 01 Jun 2008 13:37:48 -0400 Received: from [199.232.76.173] (port=35344 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K2rV4-0000bK-Qq for qemu-devel@nongnu.org; Sun, 01 Jun 2008 13:37:46 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:54129) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K2rV4-00036P-BJ for qemu-devel@nongnu.org; Sun, 01 Jun 2008 13:37:46 -0400 Message-ID: <4842DE67.9090207@mail.berlios.de> Date: Sun, 01 Jun 2008 19:37:43 +0200 From: Stefan Weil MIME-Version: 1.0 Subject: [Qemu-devel] [PATCH] Use standard header for offsetof Content-Type: multipart/mixed; boundary="------------080808070106090302060706" Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: QEMU Developers This is a multi-part message in MIME format. --------------080808070106090302060706 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit 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 --------------080808070106090302060706 Content-Type: text/x-diff; name="offsetof.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="offsetof.patch" 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 +#include #include #include #include Index: target-cris/translate.c =================================================================== --- target-cris/translate.c (revision 4638) +++ target-cris/translate.c (working copy) @@ -25,6 +25,7 @@ */ #include +#include #include #include #include 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 #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 +#include #include #include #include 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 #include #include 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 +#include #include #include #include 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 #include #include #include @@ -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 +#include #include #include #include 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 + 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 + 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 + 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 + 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 + 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 + 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 #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 #include "qemu-common.h" #include "block_int.h" #include @@ -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 #include #include +#include #include #include #include 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 #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 +#include #include #include #include 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 #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 +#include #include #include #include Index: target-arm/helper.c =================================================================== --- target-arm/helper.c (revision 4638) +++ target-arm/helper.c (working copy) @@ -1,4 +1,5 @@ #include +#include #include #include 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 +#include #include #include #include --------------080808070106090302060706--