tstRTAssertCompile.cpp revision b529ce62f7f41042866f179ea4c103e913f499e0
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync * IPRT Testcase - AssertCompile* - A Compile Time Testcase.
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync * Copyright (C) 2010 Oracle Corporation
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync * available from http://www.virtualbox.org. This file is free software;
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync * you can redistribute it and/or modify it under the terms of the GNU
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync * General Public License (GPL) as published by the Free Software
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync * The contents of this file may alternatively be used under the terms
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync * of the Common Development and Distribution License Version 1.0
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync * VirtualBox OSE distribution, in which case the provisions of the
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync * CDDL are applicable instead of those of the GPL.
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync * You may elect to license modified versions of this file under the
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync * terms and conditions of either the GPL or the CDDL or both.
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync/*******************************************************************************
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync* Header Files *
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync*******************************************************************************/
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync /* Only positive tests here. */
b529ce62f7f41042866f179ea4c103e913f499e0vboxsync typedef struct STRUCT12S
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync const char *psz;
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompileMemberSizeAlignment(STRUCT1, psz, sizeof(void *));
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompileMemberAlignment(STRUCT1, psz, sizeof(void *));
b3b92d92835cf5987674d949b8bc55a4765d05b9vboxsync#ifndef _MSC_VER /** @todo figure out why MSC has trouble with these expressions */
b529ce62f7f41042866f179ea4c103e913f499e0vboxsync typedef union UNION1U
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompile2MemberOffsets(UNION1, s1.u16, s2.u16);
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompile2MemberOffsets(UNION1, s1.u32, s2.u32);
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompile2MemberOffsets(UNION1, s1.u64, s2.u64);
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompile2MemberOffsets(UNION1, s1.psz, s2.psz);
b3b92d92835cf5987674d949b8bc55a4765d05b9vboxsync#ifndef _MSC_VER /** @todo figure out why MSC has trouble with these expressions */
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompileAdjacentMembers(STRUCT1, au8[0], au8[1]);
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompileMembersAtSameOffset(STRUCT1, u8, STRUCT2, u8);
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompileMembersAtSameOffset(STRUCT1, au8, STRUCT2, au8);
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompileMembersAtSameOffset(STRUCT1, u16, STRUCT2, u16);
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompileMembersAtSameOffset(STRUCT1, u32, STRUCT2, u32);
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompileMembersAtSameOffset(STRUCT1, u64, STRUCT2, u64);
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompileMembersSameSize(STRUCT1, u8, STRUCT2, u8);
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompileMembersSameSize(STRUCT1, au8, STRUCT2, au8);
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompileMembersSameSize(STRUCT1, u16, STRUCT2, u16);
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompileMembersSameSize(STRUCT1, u32, STRUCT2, u32);
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompileMembersSameSize(STRUCT1, u64, STRUCT2, u64);
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompileMembersSameSizeAndOffset(STRUCT1, u8, STRUCT2, u8);
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompileMembersSameSizeAndOffset(STRUCT1, au8, STRUCT2, au8);
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompileMembersSameSizeAndOffset(STRUCT1, u16, STRUCT2, u16);
b0d52aeac86d6a7d2564559be4be560f9e362c37vboxsync AssertCompileMembersSameSizeAndOffset(STRUCT1, u32, STRUCT2, u32);