VirtualBox

Changeset 71732 in vbox


Ignore:
Timestamp:
Apr 7, 2018 2:32:14 PM (6 years ago)
Author:
vboxsync
Message:

Devices/testcase: Detect undef/define of DEBUG, LOG_ENABLED, RT_STRICT and VBOX_STRICT in the future.

Location:
trunk/src/VBox/Devices/testcase
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/testcase/tstDeviceStructSize.cpp

    r71731 r71732  
    2525#include <iprt/x86.h>
    2626
    27 
    2827#define VBOX_WITH_HGCM                  /* grumble */
    2928#define VBOX_DEVICE_STRUCT_TESTCASE
     29
     30/* Check that important preprocessor macros does not get redefined: */
     31#include <VBox/cdefs.h>
     32#include <VBox/log.h>
     33#ifdef DEBUG
     34# define VBOX_DEVICE_STRUCT_TESTCASE_CHECK_DEBUG
     35#else
     36# undef  VBOX_DEVICE_STRUCT_TESTCASE_CHECK_DEBUG
     37#endif
     38#ifdef LOG_ENABLED
     39# define VBOX_DEVICE_STRUCT_TESTCASE_CHECK_LOG_ENABLED
     40#else
     41# undef  VBOX_DEVICE_STRUCT_TESTCASE_CHECK_LOG_ENABLED
     42#endif
     43#ifdef VBOX_STRICT
     44# define VBOX_DEVICE_STRUCT_TESTCASE_CHECK_VBOX_STRICT
     45#else
     46# undef  VBOX_DEVICE_STRUCT_TESTCASE_CHECK_VBOX_STRICT
     47#endif
     48#ifdef RT_STRICT
     49# define VBOX_DEVICE_STRUCT_TESTCASE_CHECK_RT_STRICT
     50#else
     51# undef  VBOX_DEVICE_STRUCT_TESTCASE_CHECK_RT_STRICT
     52#endif
     53
     54/* The structures we're checking: */
    3055#undef LOG_GROUP
    3156#include "../Bus/DevPciInternal.h"
     
    116141#undef LOG_GROUP
    117142#include "../Audio/DevHDA.cpp"
     143
     144
     145/* Check that important preprocessor macros didn't get redefined: */
     146#if defined(DEBUG)       != defined(VBOX_DEVICE_STRUCT_TESTCASE_CHECK_DEBUG)
     147# error "DEBUG was modified!  This may throw off structure tests."
     148#endif
     149#if defined(LOG_ENABLED) != defined(VBOX_DEVICE_STRUCT_TESTCASE_CHECK_LOG_ENABLED)
     150# error "LOG_ENABLED was modified!  This may throw off structure tests."
     151#endif
     152#if defined(RT_STRICT)   != defined(VBOX_DEVICE_STRUCT_TESTCASE_CHECK_RT_STRICT)
     153# error "RT_STRICT was modified!  This may throw off structure tests."
     154#endif
     155#if defined(VBOX_STRICT) != defined(VBOX_DEVICE_STRUCT_TESTCASE_CHECK_VBOX_STRICT)
     156# error "VBOX_STRICT was modified!  This may throw off structure tests."
     157#endif
     158
    118159
    119160#include <stdio.h>
  • trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp

    r71721 r71732  
    3636#define VBOX_DEVICE_STRUCT_TESTCASE
    3737#define VBOX_WITH_HGCM                  /* grumble */
     38
     39/* Check that important preprocessor macros does not get redefined: */
     40#include <VBox/cdefs.h>
     41#include <VBox/log.h>
     42#ifdef DEBUG
     43# define VBOX_DEVICE_STRUCT_TESTCASE_CHECK_DEBUG
     44#else
     45# undef  VBOX_DEVICE_STRUCT_TESTCASE_CHECK_DEBUG
     46#endif
     47#ifdef LOG_ENABLED
     48# define VBOX_DEVICE_STRUCT_TESTCASE_CHECK_LOG_ENABLED
     49#else
     50# undef  VBOX_DEVICE_STRUCT_TESTCASE_CHECK_LOG_ENABLED
     51#endif
     52#ifdef VBOX_STRICT
     53# define VBOX_DEVICE_STRUCT_TESTCASE_CHECK_VBOX_STRICT
     54#else
     55# undef  VBOX_DEVICE_STRUCT_TESTCASE_CHECK_VBOX_STRICT
     56#endif
     57#ifdef RT_STRICT
     58# define VBOX_DEVICE_STRUCT_TESTCASE_CHECK_RT_STRICT
     59#else
     60# undef  VBOX_DEVICE_STRUCT_TESTCASE_CHECK_RT_STRICT
     61#endif
     62
     63/* The structures we're checking: */
    3864#undef LOG_GROUP
    3965#include "../Bus/DevPciInternal.h"
     
    114140# include "../Storage/DevNVMe.cpp"
    115141#endif
     142
     143/* Check that important preprocessor macros didn't get redefined: */
     144#if defined(DEBUG)       != defined(VBOX_DEVICE_STRUCT_TESTCASE_CHECK_DEBUG)
     145# error "DEBUG was modified!  This may throw off structure tests."
     146#endif
     147#if defined(LOG_ENABLED) != defined(VBOX_DEVICE_STRUCT_TESTCASE_CHECK_LOG_ENABLED)
     148# error "LOG_ENABLED was modified!  This may throw off structure tests."
     149#endif
     150#if defined(RT_STRICT)   != defined(VBOX_DEVICE_STRUCT_TESTCASE_CHECK_RT_STRICT)
     151# error "RT_STRICT was modified!  This may throw off structure tests."
     152#endif
     153#if defined(VBOX_STRICT) != defined(VBOX_DEVICE_STRUCT_TESTCASE_CHECK_VBOX_STRICT)
     154# error "VBOX_STRICT was modified!  This may throw off structure tests."
     155#endif
     156
    116157
    117158/* we don't use iprt here because we're pretending to be in GC! */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette