code cleanup: defines with braces - end with '(void)0' so callers must end with ...
authorCampbell Barton <ideasman42@gmail.com>
Sun, 27 May 2012 12:21:13 +0000 (12:21 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 27 May 2012 12:21:13 +0000 (12:21 +0000)
... without this some editors dont parse the source so well.

23 files changed:
intern/ghost/intern/GHOST_Debug.h
intern/ghost/intern/GHOST_System.cpp
intern/ghost/intern/GHOST_SystemCarbon.cpp
intern/ghost/intern/GHOST_SystemWin32.cpp
intern/ghost/intern/GHOST_WindowCarbon.cpp
source/blender/blenkernel/intern/CCGSubSurf.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/mesh_validate.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenlib/BLI_math_base.h
source/blender/blenlib/BLI_utildefines.h
source/blender/blenlib/intern/BLI_kdtree.c
source/blender/blenpluginapi/util.h
source/blender/editors/armature/reeb.c
source/blender/editors/include/ED_keyframes_edit.h
source/blender/editors/interface/interface.c
source/blender/editors/object/object_shapekey.c
source/blender/nodes/composite/node_composite_util.h
source/blender/render/intern/include/rendercore.h
source/blender/render/intern/source/pixelblending.c
source/blender/render/intern/source/shadeoutput.c
source/blender/render/intern/source/zbuf.c

index a6392fce9bf6003bc9847832279cfb51d540a46c..c364f1d26a4bb5d5a3acf22955764f51f80ee3dd 100644 (file)
@@ -51,8 +51,8 @@
 
 
 #ifdef GHOST_DEBUG
-#  define GHOST_PRINT(x) { std::cout << x; }
-#  define GHOST_PRINTF(x, ...) { printf(x, __VA_ARGS__); }
+#  define GHOST_PRINT(x) { std::cout << x; } (void)0
+#  define GHOST_PRINTF(x, ...) { printf(x, __VA_ARGS__); } (void)0
 #else  // GHOST_DEBUG
 #  define GHOST_PRINT(x)
 #  define GHOST_PRINTF(x, ...)
@@ -67,7 +67,7 @@
                GHOST_PRINT(info);                                                \
                GHOST_PRINT("\n");                                                \
            }                                                                     \
-       }
+       } (void)0
 #else  // GHOST_DEBUG
 #  define GHOST_ASSERT(x, info)
 #endif // GHOST_DEBUG
index ee21128ecbb4bd02f11115c0764a015a11a22127..8c6491bcbfd95d971e028dfea459e03dba069b09 100644 (file)
@@ -142,7 +142,7 @@ GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting& setting
                                              const bool stereoVisual, const GHOST_TUns16 numOfAASamples)
 {
        GHOST_TSuccess success = GHOST_kFailure;
-       GHOST_ASSERT(m_windowManager, "GHOST_System::beginFullScreen(): invalid window manager")
+       GHOST_ASSERT(m_windowManager, "GHOST_System::beginFullScreen(): invalid window manager");
        if (m_displayManager) {
                if (!m_windowManager->getFullScreen()) {
                        m_displayManager->getCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay, m_preFullScreenSetting);
@@ -184,12 +184,12 @@ GHOST_TSuccess GHOST_System::updateFullScreen(const GHOST_DisplaySetting& settin
 GHOST_TSuccess GHOST_System::endFullScreen(void)
 {
        GHOST_TSuccess success = GHOST_kFailure;
-       GHOST_ASSERT(m_windowManager, "GHOST_System::endFullScreen(): invalid window manager")
+       GHOST_ASSERT(m_windowManager, "GHOST_System::endFullScreen(): invalid window manager");
        if (m_windowManager->getFullScreen()) {
                //GHOST_IWindow* window = m_windowManager->getFullScreenWindow();
                //GHOST_PRINT("GHOST_System::endFullScreen(): leaving window manager full-screen mode\n");
                success = m_windowManager->endFullScreen();
-               GHOST_ASSERT(m_displayManager, "GHOST_System::endFullScreen(): invalid display manager")
+               GHOST_ASSERT(m_displayManager, "GHOST_System::endFullScreen(): invalid display manager");
                //GHOST_PRINT("GHOST_System::endFullScreen(): leaving full-screen mode\n");
                success = m_displayManager->setCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay, m_preFullScreenSetting);
        }
@@ -350,7 +350,7 @@ GHOST_TSuccess GHOST_System::exit()
 GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window **window, const bool stereoVisual, const GHOST_TUns16 numOfAASamples)
 {
        GHOST_TSuccess success;
-       GHOST_ASSERT(m_displayManager, "GHOST_System::createFullScreenWindow(): invalid display manager")
+       GHOST_ASSERT(m_displayManager, "GHOST_System::createFullScreenWindow(): invalid display manager");
        GHOST_DisplaySetting settings;
 
        success = m_displayManager->getCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay, settings);
index fc4ca8f8f613736012aae853dc7ea022a56bd083..ac580895c5099dfa31a2479a63f66b43d9261d14 100644 (file)
@@ -57,8 +57,6 @@
 #include "GHOST_NDOFManager.h"
 #include "AssertMacros.h"
 
-#define GHOST_KEY_SWITCH(mac, ghost) { case (mac): ghostKey = (ghost); break; }
-
 /* blender class and types events */
 enum {
        kEventClassBlender              = 'blnd'
index 7a65c741532cffb9bba7944d128eedde53200b94..9e9bbc0e39507ce386ccb2617c670235bb376862 100644 (file)
@@ -389,11 +389,11 @@ GHOST_TSuccess GHOST_SystemWin32::init()
        // Determine whether this system has a high frequency performance counter. */
        m_hasPerformanceCounter = ::QueryPerformanceFrequency((LARGE_INTEGER *)&m_freq) == TRUE;
        if (m_hasPerformanceCounter) {
-               GHOST_PRINT("GHOST_SystemWin32::init: High Frequency Performance Timer available\n")
+               GHOST_PRINT("GHOST_SystemWin32::init: High Frequency Performance Timer available\n");
                ::QueryPerformanceCounter((LARGE_INTEGER *)&m_start);
        }
        else {
-               GHOST_PRINT("GHOST_SystemWin32::init: High Frequency Performance Timer not available\n")
+               GHOST_PRINT("GHOST_SystemWin32::init: High Frequency Performance Timer not available\n");
        }
 
        if (success) {
@@ -885,7 +885,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
 
        LRESULT lResult = 0;
        GHOST_SystemWin32 *system = ((GHOST_SystemWin32 *)getSystem());
-       GHOST_ASSERT(system, "GHOST_SystemWin32::s_wndProc(): system not initialized")
+       GHOST_ASSERT(system, "GHOST_SystemWin32::s_wndProc(): system not initialized");
 
        if (hwnd) {
                GHOST_WindowWin32 *window = (GHOST_WindowWin32 *)::GetWindowLong(hwnd, GWL_USERDATA);
@@ -917,9 +917,9 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
                                                case RIM_TYPEKEYBOARD:
                                                        event = processKeyEvent(window, raw);
                                                        if (!event) {
-                                                               GHOST_PRINT("GHOST_SystemWin32::wndProc: key event ")
-                                                               GHOST_PRINT(msg)
-                                                               GHOST_PRINT(" key ignored\n")
+                                                               GHOST_PRINT("GHOST_SystemWin32::wndProc: key event ");
+                                                               GHOST_PRINT(msg);
+                                                               GHOST_PRINT(" key ignored\n");
                                                        }
                                                        break;
 #ifdef WITH_INPUT_NDOF
@@ -1233,7 +1233,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
                }
                else {
                        // Event found for a window before the pointer to the class has been set.
-                       GHOST_PRINT("GHOST_SystemWin32::wndProc: GHOST window event before creation\n")
+                       GHOST_PRINT("GHOST_SystemWin32::wndProc: GHOST window event before creation\n");
                        /* These are events we typically miss at this point:
                           WM_GETMINMAXINFO     0x24
                           WM_NCCREATE                  0x81
@@ -1245,7 +1245,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
        }
        else {
                // Events without valid hwnd
-               GHOST_PRINT("GHOST_SystemWin32::wndProc: event without window\n")
+               GHOST_PRINT("GHOST_SystemWin32::wndProc: event without window\n");
        }
 
        if (event) {
index 16e3cb496522ed9c522753bbd32a99a74e6adb80..d67b02fce6babe57f731fa3983024667db4a7c2c 100644 (file)
@@ -221,7 +221,7 @@ bool GHOST_WindowCarbon::getValid() const
 
 void GHOST_WindowCarbon::setTitle(const STR_String& title)
 {
-       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setTitle(): window invalid")
+       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setTitle(): window invalid");
        Str255 title255;
        gen2mac(title, title255);
        ::SetWTitle(m_windowRef, title255);
@@ -230,7 +230,7 @@ void GHOST_WindowCarbon::setTitle(const STR_String& title)
 
 void GHOST_WindowCarbon::getTitle(STR_String& title) const
 {
-       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getTitle(): window invalid")
+       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getTitle(): window invalid");
        Str255 title255;
        ::GetWTitle(m_windowRef, title255);
        mac2gen(title255, title);
@@ -241,7 +241,7 @@ void GHOST_WindowCarbon::getWindowBounds(GHOST_Rect& bounds) const
 {
        OSStatus success;
        Rect rect;
-       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getWindowBounds(): window invalid")
+       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getWindowBounds(): window invalid");
        success = ::GetWindowBounds(m_windowRef, kWindowStructureRgn, &rect);
        bounds.m_b = rect.bottom;
        bounds.m_l = rect.left;
@@ -253,7 +253,7 @@ void GHOST_WindowCarbon::getWindowBounds(GHOST_Rect& bounds) const
 void GHOST_WindowCarbon::getClientBounds(GHOST_Rect& bounds) const
 {
        Rect rect;
-       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getClientBounds(): window invalid")
+       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getClientBounds(): window invalid");
        //::GetPortBounds(m_grafPtr, &rect);
        ::GetWindowBounds(m_windowRef, kWindowContentRgn, &rect);
 
@@ -277,7 +277,7 @@ void GHOST_WindowCarbon::getClientBounds(GHOST_Rect& bounds) const
 
 GHOST_TSuccess GHOST_WindowCarbon::setClientWidth(GHOST_TUns32 width)
 {
-       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setClientWidth(): window invalid")
+       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setClientWidth(): window invalid");
        GHOST_Rect cBnds, wBnds;
        getClientBounds(cBnds);
        if (((GHOST_TUns32)cBnds.getWidth()) != width) {
@@ -289,7 +289,7 @@ GHOST_TSuccess GHOST_WindowCarbon::setClientWidth(GHOST_TUns32 width)
 
 GHOST_TSuccess GHOST_WindowCarbon::setClientHeight(GHOST_TUns32 height)
 {
-       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setClientHeight(): window invalid")
+       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setClientHeight(): window invalid");
        GHOST_Rect cBnds, wBnds;
        getClientBounds(cBnds);
 #ifdef GHOST_DRAW_CARBON_GUTTER
@@ -307,7 +307,7 @@ GHOST_TSuccess GHOST_WindowCarbon::setClientHeight(GHOST_TUns32 height)
 
 GHOST_TSuccess GHOST_WindowCarbon::setClientSize(GHOST_TUns32 width, GHOST_TUns32 height)
 {
-       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setClientSize(): window invalid")
+       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setClientSize(): window invalid");
        GHOST_Rect cBnds, wBnds;
        getClientBounds(cBnds);
 #ifdef GHOST_DRAW_CARBON_GUTTER
@@ -328,7 +328,7 @@ GHOST_TSuccess GHOST_WindowCarbon::setClientSize(GHOST_TUns32 width, GHOST_TUns3
 
 GHOST_TWindowState GHOST_WindowCarbon::getState() const
 {
-       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getState(): window invalid")
+       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getState(): window invalid");
        GHOST_TWindowState state;
        if (::IsWindowVisible(m_windowRef) == false) {
                state = GHOST_kWindowStateMinimized;
@@ -345,7 +345,7 @@ GHOST_TWindowState GHOST_WindowCarbon::getState() const
 
 void GHOST_WindowCarbon::screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
 {
-       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::screenToClient(): window invalid")
+       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::screenToClient(): window invalid");
        Point point;
        point.h = inX;
        point.v = inY;
@@ -361,7 +361,7 @@ void GHOST_WindowCarbon::screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOS
 
 void GHOST_WindowCarbon::clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
 {
-       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::clientToScreen(): window invalid")
+       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::clientToScreen(): window invalid");
        Point point;
        point.h = inX;
        point.v = inY;
@@ -377,7 +377,7 @@ void GHOST_WindowCarbon::clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOS
 
 GHOST_TSuccess GHOST_WindowCarbon::setState(GHOST_TWindowState state)
 {
-       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setState(): window invalid")
+       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setState(): window invalid");
        switch (state) {
                case GHOST_kWindowStateMinimized:
                        ::HideWindow(m_windowRef);
@@ -400,7 +400,7 @@ GHOST_TSuccess GHOST_WindowCarbon::setState(GHOST_TWindowState state)
 
 GHOST_TSuccess GHOST_WindowCarbon::setOrder(GHOST_TWindowOrder order)
 {
-       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setOrder(): window invalid")
+       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setOrder(): window invalid");
        if (order == GHOST_kWindowOrderTop) {
                //::BringToFront(m_windowRef); is wrong, front window should be active for input too
                ::SelectWindow(m_windowRef);
@@ -555,7 +555,7 @@ GHOST_TSuccess GHOST_WindowCarbon::removeDrawingContext()
 
 GHOST_TSuccess GHOST_WindowCarbon::invalidate()
 {
-       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::invalidate(): window invalid")
+       GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::invalidate(): window invalid");
        if (!m_fullScreen) {
                Rect rect;
                ::GetPortBounds(m_grafPtr, &rect);
index e4309a64e56ec1280c123aa3db4a34409ecc0000..d26a722b628a138a2cf85636b42524714051b3b4 100644 (file)
@@ -275,9 +275,9 @@ static int ccg_edgebase(int level)
 
 /***/
 
-#define NormZero(av)     { float *_a = (float *) av; _a[0] = _a[1] = _a[2] = 0.0f; }
-#define NormCopy(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0]  = _b[0]; _a[1]  = _b[1]; _a[2]  = _b[2]; }
-#define NormAdd(av, bv)  { float *_a = (float *) av, *_b = (float *) bv; _a[0] += _b[0]; _a[1] += _b[1]; _a[2] += _b[2]; }
+#define NormZero(av)     { float *_a = (float *) av; _a[0] = _a[1] = _a[2] = 0.0f; } (void)0
+#define NormCopy(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0]  = _b[0]; _a[1]  = _b[1]; _a[2]  = _b[2]; } (void)0
+#define NormAdd(av, bv)  { float *_a = (float *) av, *_b = (float *) bv; _a[0] += _b[0]; _a[1] += _b[1]; _a[2] += _b[2]; } (void)0
 
 /***/
 
index 25e34bf1879bb939b9d31a44fe258feffca615d5..26516b62aa31dd6622aca436569789834a1a9037 100644 (file)
@@ -1310,7 +1310,7 @@ void clear_id_newpoins(void)
        }
 }
 
-#define LIBTAG(a)   if (a && a->id.lib) {a->id.flag &= ~LIB_INDIRECT; a->id.flag |= LIB_EXTERN; }
+#define LIBTAG(a)   if (a && a->id.lib) {a->id.flag &= ~LIB_INDIRECT; a->id.flag |= LIB_EXTERN; } (void)0
 
 static void lib_indirect_test_id(ID *id, Library *lib)
 {
index a60bb98ac182a2c2a35bb66ae5b1711e7b57d397..669ae4f198ae75b5d8a61d44d99d8f0a5cf28d7f 100644 (file)
@@ -103,11 +103,11 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
                              MDeformVert *dverts, /* assume totvert length */
                              const short do_verbose, const short do_fixes)
 {
-#   define REMOVE_EDGE_TAG(_me) { _me->v2 = _me->v1; do_edge_free = TRUE; }
+#   define REMOVE_EDGE_TAG(_me) { _me->v2 = _me->v1; do_edge_free = TRUE; } (void)0
 #   define IS_REMOVED_EDGE(_me) (_me->v2 == _me->v1)
 
-#   define REMOVE_LOOP_TAG(_ml) { _ml->e = INVALID_LOOP_EDGE_MARKER; do_polyloop_free = TRUE; }
-#   define REMOVE_POLY_TAG(_mp) { _mp->totloop *= -1; do_polyloop_free = TRUE; }
+#   define REMOVE_LOOP_TAG(_ml) { _ml->e = INVALID_LOOP_EDGE_MARKER; do_polyloop_free = TRUE; } (void)0
+#   define REMOVE_POLY_TAG(_mp) { _mp->totloop *= -1; do_polyloop_free = TRUE; } (void)0
 
        MVert *mv = mverts;
        MEdge *me;
index 66dd23e76b924b509099ac1a78891d092df519cf..cd5efb9951bbf1e0fb0da52605c0c022b57ca6ee 100644 (file)
@@ -3751,9 +3751,14 @@ static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, co
        return 1;
 }
 
-#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) if ((event & mtex->mapto) & type) {pvalue = texture_value_blend(def, pvalue, value, texfac, blend); }
-#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) if (event & type) { if (pvalue < 0.f) pvalue = 1.f + pvalue; CLAMP(pvalue, 0.0f, 1.0f); }
-#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) if (event & type) { CLAMP(pvalue, -1.0f, 1.0f); }
+#define SET_PARTICLE_TEXTURE(type, pvalue, texfac)  \
+       if ((event & mtex->mapto) & type) {pvalue = texture_value_blend(def, pvalue, value, texfac, blend); } (void)0
+
+#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue)  \
+       if (event & type) { if (pvalue < 0.0f) pvalue = 1.0f + pvalue; CLAMP(pvalue, 0.0f, 1.0f); } (void)0
+
+#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue)  \
+       if (event & type) { CLAMP(pvalue, -1.0f, 1.0f); } (void)0
 
 static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSettings *part, ParticleData *par, int child_index, int face_index, const float fw[4], float *orco, ParticleTexture *ptex, int event, float cfra)
 {
@@ -3884,26 +3889,26 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex
                                else
                                        ptex->time = texture_value_blend(def, ptex->time, value, mtex->timefac, blend);
                        }
-                       SET_PARTICLE_TEXTURE(PAMAP_LIFE, ptex->life, mtex->lifefac)
-                       SET_PARTICLE_TEXTURE(PAMAP_DENS, ptex->exist, mtex->padensfac)
-                       SET_PARTICLE_TEXTURE(PAMAP_SIZE, ptex->size, mtex->sizefac)
-                       SET_PARTICLE_TEXTURE(PAMAP_IVEL, ptex->ivel, mtex->ivelfac)
-                       SET_PARTICLE_TEXTURE(PAMAP_FIELD, ptex->field, mtex->fieldfac)
-                       SET_PARTICLE_TEXTURE(PAMAP_GRAVITY, ptex->gravity, mtex->gravityfac)
-                       SET_PARTICLE_TEXTURE(PAMAP_DAMP, ptex->damp, mtex->dampfac)
-                       SET_PARTICLE_TEXTURE(PAMAP_LENGTH, ptex->length, mtex->lengthfac)
+                       SET_PARTICLE_TEXTURE(PAMAP_LIFE, ptex->life, mtex->lifefac);
+                       SET_PARTICLE_TEXTURE(PAMAP_DENS, ptex->exist, mtex->padensfac);
+                       SET_PARTICLE_TEXTURE(PAMAP_SIZE, ptex->size, mtex->sizefac);
+                       SET_PARTICLE_TEXTURE(PAMAP_IVEL, ptex->ivel, mtex->ivelfac);
+                       SET_PARTICLE_TEXTURE(PAMAP_FIELD, ptex->field, mtex->fieldfac);
+                       SET_PARTICLE_TEXTURE(PAMAP_GRAVITY, ptex->gravity, mtex->gravityfac);
+                       SET_PARTICLE_TEXTURE(PAMAP_DAMP, ptex->damp, mtex->dampfac);
+                       SET_PARTICLE_TEXTURE(PAMAP_LENGTH, ptex->length, mtex->lengthfac);
                }
        }
 
-       CLAMP_PARTICLE_TEXTURE_POS(PAMAP_TIME, ptex->time)
-       CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LIFE, ptex->life)
-       CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DENS, ptex->exist)
-       CLAMP_PARTICLE_TEXTURE_POS(PAMAP_SIZE, ptex->size)
-       CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_IVEL, ptex->ivel)
-       CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_FIELD, ptex->field)
-       CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_GRAVITY, ptex->gravity)
-       CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DAMP, ptex->damp)
-       CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LENGTH, ptex->length)
+       CLAMP_PARTICLE_TEXTURE_POS(PAMAP_TIME, ptex->time);
+       CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LIFE, ptex->life);
+       CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DENS, ptex->exist);
+       CLAMP_PARTICLE_TEXTURE_POS(PAMAP_SIZE, ptex->size);
+       CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_IVEL, ptex->ivel);
+       CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_FIELD, ptex->field);
+       CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_GRAVITY, ptex->gravity);
+       CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DAMP, ptex->damp);
+       CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LENGTH, ptex->length);
 }
 /************************************************/
 /*                     Particle State                                          */
index 90d17e533492c6d08a7cd1372c638eb034b97c51..91023513d4db4ebe61147d13e43148272abdccf5 100644 (file)
 #  include "BLI_winstuff.h"
 #endif
 
-#define PTCACHE_DATA_FROM(data, type, from)            if (data[type]) { memcpy(data[type], from, ptcache_data_size[type]); }
-#define PTCACHE_DATA_TO(data, type, index, to) if (data[type]) { memcpy(to, (char*)data[type] + (index ? index * ptcache_data_size[type] : 0), ptcache_data_size[type]); }
+#define PTCACHE_DATA_FROM(data, type, from)  \
+       if (data[type]) { \
+               memcpy(data[type], from, ptcache_data_size[type]); \
+       } (void)0
+
+#define PTCACHE_DATA_TO(data, type, index, to)  \
+       if (data[type]) { \
+               memcpy(to, (char *)(data)[type] + ((index) ? (index) * ptcache_data_size[type] : 0), ptcache_data_size[type]); \
+       } (void)0
 
 /* could be made into a pointcache option */
 #define DURIAN_POINTCACHE_LIB_OK 1
index 02065c4b86f8b8a17ed6aa6e37a565013f517f63..22672db9edb18f9f05e4309d5b58672e979d6aef 100644 (file)
 #endif
 
 #ifndef SWAP
-#  define SWAP(type, a, b)  { type sw_ap; sw_ap = (a); (a) = (b); (b) = sw_ap; }
+#  define SWAP(type, a, b)  { type sw_ap; sw_ap = (a); (a) = (b); (b) = sw_ap; } (void)0
 #endif
 
 #ifndef CLAMP
index d027a3da2ef7bbe7478a182bd6ae25af20ffd4ee..f027fb57842fa11820ef86916ddfabfcd43a98d2 100644 (file)
 /* some math and copy defines */
 
 #ifndef SWAP
-#  define SWAP(type, a, b)       { type sw_ap; sw_ap = (a); (a) = (b); (b) = sw_ap; }
+#  define SWAP(type, a, b)       { type sw_ap; sw_ap = (a); (a) = (b); (b) = sw_ap; } (void)0
 #endif
 
 #define ABS(a)          ( (a) < 0 ? (-(a)) : (a) )
index a828ab5b3f480576b526d30dcd3c7c410eb2df4e..a265505cc8f4d6c240d08fd9a944f75f534bd75b 100644 (file)
@@ -38,7 +38,7 @@
 #include "BLI_kdtree.h"
 
 #ifndef SWAP
-#  define SWAP(type, a, b) { type sw_ap; sw_ap = (a); (a) = (b); (b) = sw_ap; }
+#  define SWAP(type, a, b) { type sw_ap; sw_ap = (a); (a) = (b); (b) = sw_ap; } (void)0
 #endif
 
 typedef struct KDTreeNode {
index 8a049350bc67867909c961c46bd988bd0a91d92a..68f9626ac24c65e7a699c59c3f028dbbc0904d63 100644 (file)
@@ -75,7 +75,7 @@
 #define MAX3(x,y,z)            MAX2( MAX2((x),(y)) , (z) )
 #define MAX4(x,y,z,a)          MAX2( MAX2((x),(y)) , MAX2((z),(a)) )
 
-#define SWAP(type, a, b)       { type sw_ap; sw_ap=(a); (a)=(b); (b)=sw_ap; }
+#define SWAP(type, a, b)       { type sw_ap; sw_ap=(a); (a)=(b); (b)=sw_ap; } (void)0
 
 #define ABS(x) ((x) < 0 ? -(x) : (x))
 #define FLOOR(x) ((int)(x) - ((x) < 0 && (x) != (int)(x)))
index a629312e7323294cad938d19d7f1c46f0898c956..20b95ea55d6a7aa5f9e5a59a5ddfdcfc74f6d791 100644 (file)
@@ -475,8 +475,8 @@ static void NodeDegreeIncrement(ReebGraph *UNUSED(rg), ReebNode *node)
 }
 
 #else
-#define NodeDegreeDecrement(rg, node) {node->degree--; }
-#define NodeDegreeIncrement(rg, node) {node->degree++; }
+#  define NodeDegreeDecrement(rg, node) {node->degree--; } (void)0
+#  define NodeDegreeIncrement(rg, node) {node->degree++; } (void)0
 #endif
 
 void repositionNodes(ReebGraph *rg)
index bdb70696742d52b8d92606226598515ce58330d5..3020fe6985aea7f25e2a8baced15467d1c4ad365 100644 (file)
@@ -43,9 +43,9 @@ struct Scene;
 
 /* --------- BezTriple Selection ------------- */
 
-#define BEZ_SEL(bezt)       { (bezt)->f1 |=  SELECT; (bezt)->f2 |=  SELECT; (bezt)->f3 |=  SELECT; }
-#define BEZ_DESEL(bezt)     { (bezt)->f1 &= ~SELECT; (bezt)->f2 &= ~SELECT; (bezt)->f3 &= ~SELECT; }
-#define BEZ_INVSEL(bezt)    { (bezt)->f1 ^=  SELECT; (bezt)->f2 ^=  SELECT; (bezt)->f3 ^=  SELECT; }
+#define BEZ_SEL(bezt)    { (bezt)->f1 |=  SELECT; (bezt)->f2 |=  SELECT; (bezt)->f3 |=  SELECT; } (void)0
+#define BEZ_DESEL(bezt)  { (bezt)->f1 &= ~SELECT; (bezt)->f2 &= ~SELECT; (bezt)->f3 &= ~SELECT; } (void)0
+#define BEZ_INVSEL(bezt) { (bezt)->f1 ^=  SELECT; (bezt)->f2 ^=  SELECT; (bezt)->f3 ^=  SELECT; } (void)0
 
 /* --------- Tool Flags ------------ */
 
index 5394cb46049d3f7277cdac7f2e4acf8b123625db..d26c8cefdf07b11fffa9a0c508fd99590ae4e44d 100644 (file)
@@ -81,7 +81,7 @@
 
 /* avoid unneeded calls to ui_get_but_val */
 #define UI_BUT_VALUE_UNSET DBL_MAX
-#define UI_GET_BUT_VALUE_INIT(_but, _value) if (_value == DBL_MAX) {  (_value) = ui_get_but_val(_but); }
+#define UI_GET_BUT_VALUE_INIT(_but, _value) if (_value == DBL_MAX) {  (_value) = ui_get_but_val(_but); } (void)0
 
 /* 
  * a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt
@@ -660,8 +660,8 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut
                                /* typically the same pointers, but not on undo/redo */
                                /* XXX some menu buttons store button itself in but->poin. Ugly */
                                if (oldbut->poin != (char *)oldbut) {
-                                       SWAP(char *, oldbut->poin, but->poin)
-                                       SWAP(void *, oldbut->func_argN, but->func_argN)
+                                       SWAP(char *, oldbut->poin, but->poin);
+                                       SWAP(void *, oldbut->func_argN, but->func_argN);
                                }
                                
                                /* copy hardmin for list rows to prevent 'sticking' highlight to mouse position
@@ -1090,7 +1090,7 @@ static void ui_is_but_sel(uiBut *but, double *value)
 
        if (but->bit) {
                int lvalue;
-               UI_GET_BUT_VALUE_INIT(but, *value)
+               UI_GET_BUT_VALUE_INIT(but, *value);
                lvalue = (int)*value;
                if (BTST(lvalue, (but->bitnr)) ) is_push = is_true;
                else is_push = !is_true;
@@ -1111,18 +1111,18 @@ static void ui_is_but_sel(uiBut *but, double *value)
                        case BUT_TOGDUAL:
                        case ICONTOG:
                        case OPTION:
-                               UI_GET_BUT_VALUE_INIT(but, *value)
+                               UI_GET_BUT_VALUE_INIT(but, *value);
                                if (*value != (double)but->hardmin) is_push = 1;
                                break;
                        case ICONTOGN:
                        case TOGN:
                        case OPTIONN:
-                               UI_GET_BUT_VALUE_INIT(but, *value)
+                               UI_GET_BUT_VALUE_INIT(but, *value);
                                if (*value == 0.0) is_push = 1;
                                break;
                        case ROW:
                        case LISTROW:
-                               UI_GET_BUT_VALUE_INIT(but, *value)
+                               UI_GET_BUT_VALUE_INIT(but, *value);
                                /* support for rna enum buts */
                                if (but->rnaprop && (RNA_property_flag(but->rnaprop) & PROP_ENUM_FLAG)) {
                                        if ((int)*value & (int)but->hardmax) is_push = 1;
@@ -2171,7 +2171,7 @@ void ui_check_but(uiBut *but)
        
        /* only update soft range while not editing */
        if (but->rnaprop && !(but->editval || but->editstr || but->editvec)) {
-               UI_GET_BUT_VALUE_INIT(but, value)
+               UI_GET_BUT_VALUE_INIT(but, value);
                ui_set_but_soft_range(but, value);
        }
 
@@ -2182,7 +2182,7 @@ void ui_check_but(uiBut *but)
                case SCROLL:
                case NUMSLI:
                case HSVSLI:
-                       UI_GET_BUT_VALUE_INIT(but, value)
+                       UI_GET_BUT_VALUE_INIT(but, value);
                        if (value < (double)but->hardmin) ui_set_but_val(but, but->hardmin);
                        else if (value > (double)but->hardmax) ui_set_but_val(but, but->hardmax);
                        break;
@@ -2190,7 +2190,7 @@ void ui_check_but(uiBut *but)
                case NUMABS:
                {
                        double value_abs;
-                       UI_GET_BUT_VALUE_INIT(but, value)
+                       UI_GET_BUT_VALUE_INIT(but, value);
                        value_abs = fabs(value);
                        if (value_abs < (double)but->hardmin) ui_set_but_val(but, but->hardmin);
                        else if (value_abs > (double)but->hardmax) ui_set_but_val(but, but->hardmax);
@@ -2206,14 +2206,14 @@ void ui_check_but(uiBut *but)
                        
                case ICONROW:
                        if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
-                               UI_GET_BUT_VALUE_INIT(but, value)
+                               UI_GET_BUT_VALUE_INIT(but, value);
                                but->iconadd = (int)value - (int)(but->hardmin);
                        }
                        break;
                        
                case ICONTEXTROW:
                        if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
-                               UI_GET_BUT_VALUE_INIT(but, value)
+                               UI_GET_BUT_VALUE_INIT(but, value);
                                but->iconadd = (int)value - (int)(but->hardmin);
                        }
                        break;
@@ -2230,7 +2230,7 @@ void ui_check_but(uiBut *but)
                case ICONTEXTROW:
                
                        if (but->x2 - but->x1 > 24) {
-                               UI_GET_BUT_VALUE_INIT(but, value)
+                               UI_GET_BUT_VALUE_INIT(but, value);
                                ui_set_name_menu(but, (int)value);
                        }
                        break;
@@ -2240,7 +2240,7 @@ void ui_check_but(uiBut *but)
                case HSVSLI:
                case NUMABS:
 
-                       UI_GET_BUT_VALUE_INIT(but, value)
+                       UI_GET_BUT_VALUE_INIT(but, value);
 
                        if (ui_is_but_float(but)) {
                                if (value == (double) FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%sinf", but->str);
@@ -2271,7 +2271,7 @@ void ui_check_but(uiBut *but)
                case LABEL:
                        if (ui_is_but_float(but)) {
                                int prec;
-                               UI_GET_BUT_VALUE_INIT(but, value)
+                               UI_GET_BUT_VALUE_INIT(but, value);
                                prec = ui_but_float_precision(but, value);
                                BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%.*f", but->str, prec, value);
                        }
@@ -2299,7 +2299,7 @@ void ui_check_but(uiBut *but)
                                strcat(but->drawstr, "Press a key");
                        }
                        else {
-                               UI_GET_BUT_VALUE_INIT(but, value)
+                               UI_GET_BUT_VALUE_INIT(but, value);
                                strcat(but->drawstr, WM_key_event_string((short)value));
                        }
                        break;
index 19864ed58cfca07ec74fe22774426e120fa230ce..40b653a62fdde30a687a259a7bd46843457e3b55 100644 (file)
@@ -455,7 +455,7 @@ static int shape_key_move_exec(bContext *C, wmOperator *op)
                        ob->shapenr++;
                }
 
-               SWAP(float, kb_other->pos, kb->pos) /* for absolute shape keys */
+               SWAP(float, kb_other->pos, kb->pos); /* for absolute shape keys */
        }
 
        DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
index 3efdf76f233d7c0623fefdeb0b4e0f94aa0d5cdb..51f047b94ff5133898723363cc74b8718a4a5b31 100644 (file)
@@ -180,28 +180,29 @@ extern void node_ID_title_cb(void *node_v, void *unused_v);
 /* soms macros for color handling */
 typedef float fRGB[4];
 /* clear color */
-#define fRGB_clear(c) { c[0]=c[1]=c[2]=0.f; }
+#define fRGB_clear(c) { c[0]=c[1]=c[2]=0.f; } (void)0
 /* copy c2 to c1 */
-#define fRGB_copy(c1, c2) { c1[0]=c2[0];  c1[1]=c2[1];  c1[2]=c2[2]; c1[3]=c2[3]; }
+#define fRGB_copy(c1, c2) { c1[0]=c2[0];  c1[1]=c2[1];  c1[2]=c2[2]; c1[3]=c2[3]; } (void)0
 /* add c2 to c1 */
-#define fRGB_add(c1, c2) { c1[0]+=c2[0];  c1[1]+=c2[1];  c1[2]+=c2[2]; }
+#define fRGB_add(c1, c2) { c1[0]+=c2[0];  c1[1]+=c2[1];  c1[2]+=c2[2]; } (void)0
 /* subtract c2 from c1 */
-#define fRGB_sub(c1, c2) { c1[0]-=c2[0];  c1[1]-=c2[1];  c1[2]-=c2[2]; }
+#define fRGB_sub(c1, c2) { c1[0]-=c2[0];  c1[1]-=c2[1];  c1[2]-=c2[2]; } (void)0
 /* multiply c by float value s */
-#define fRGB_mult(c, s) { c[0]*=s;  c[1]*=s;  c[2]*=s; }
+#define fRGB_mult(c, s) { c[0]*=s;  c[1]*=s;  c[2]*=s; } (void)0
 /* multiply c2 by s and add to c1 */
-#define fRGB_madd(c1, c2, s) { c1[0]+=c2[0]*s;  c1[1]+=c2[1]*s;  c1[2]+=c2[2]*s; }
+#define fRGB_madd(c1, c2, s) { c1[0]+=c2[0]*s;  c1[1]+=c2[1]*s;  c1[2]+=c2[2]*s; } (void)0
 /* multiply c2 by color c1 */
-#define fRGB_colormult(c, cs) { c[0]*=cs[0];  c[1]*=cs[1];  c[2]*=cs[2]; }
+#define fRGB_colormult(c, cs) { c[0]*=cs[0];  c[1]*=cs[1];  c[2]*=cs[2]; } (void)0
 /* multiply c2 by color c3 and add to c1 */
-#define fRGB_colormadd(c1, c2, c3) { c1[0]+=c2[0]*c3[0];  c1[1]+=c2[1]*c3[1];  c1[2]+=c2[2]*c3[2]; }
+#define fRGB_colormadd(c1, c2, c3) { c1[0]+=c2[0]*c3[0];  c1[1]+=c2[1]*c3[1];  c1[2]+=c2[2]*c3[2]; } (void)0
 /* multiply c2 by color rgb, rgb as separate arguments */
-#define fRGB_rgbmult(c, r, g, b) { c[0]*=(r);  c[1]*=(g);  c[2]*=(b); }
+#define fRGB_rgbmult(c, r, g, b) { c[0]*=(r);  c[1]*=(g);  c[2]*=(b); } (void)0
 /* swap colors c1 & c2 */
 #define fRGB_swap(c1, c2) { float _t=c1[0];  c1[0]=c2[0];  c2[0]=_t;\
-                                                                 _t=c1[1];  c1[1]=c2[1];  c2[1]=_t;\
-                                                                 _t=c1[2];  c1[2]=c2[2];  c2[2]=_t;\
-                                                                 _t=c1[3];  c1[3]=c2[3];  c3[3]=_t;}
+                                  _t=c1[1];  c1[1]=c2[1];  c2[1]=_t;\
+                                  _t=c1[2];  c1[2]=c2[2];  c2[2]=_t;\
+                                  _t=c1[3];  c1[3]=c2[3];  c3[3]=_t;\
+                          } (void)0
 
 void qd_getPixel(CompBuf* src, int x, int y, float* col);
 void qd_setPixel(CompBuf* src, int x, int y, float* col);
index a66165d468004538f02f8f6a4c40bf457c694c90..284b386ca3388b748faba1f3da9dbe505cab07f2 100644 (file)
 
 #include "render_types.h"
 
-
-/* vector defines */
-
-#define CROSS(dest, a, b)              { dest[0]= a[1] * b[2] - a[2] * b[1]; dest[1]= a[2] * b[0] - a[0] * b[2]; dest[2]= a[0] * b[1] - a[1] * b[0]; }
-
 struct HaloRen;
 struct ShadeInput;
 struct ShadeResult;
index 151464064cb404a1541d2baae348e1e563e91b99..b282cc8459f63099a5a525ed84547faa898ed461 100644 (file)
@@ -306,17 +306,27 @@ void add_filt_fmask_coord(float filt[][3], const float col[4], float *rowbuf, in
        
        
        /* loop unroll */
-#define MASKFILT(i, j)         val= lfilt[i][j]; if (val!=0.0f) {float *fp= fpoin[i][j]; fp[0]+= val*r; fp[1]+= val*g; fp[2]+= val*b; fp[3]+= val*al; }
+#define MASKFILT(i, j)                                                        \
+       val = lfilt[i][j];                                                        \
+       if (val != 0.0f) {                                                        \
+               float *fp = fpoin[i][j];                                              \
+               fp[0] += val * r;                                                     \
+               fp[1] += val * g;                                                     \
+               fp[2] += val * b;                                                     \
+               fp[3] += val * al;                                                    \
+       } (void)0
        
-       MASKFILT(0, 0)
-       MASKFILT(0, 1)
-       MASKFILT(0, 2)
-       MASKFILT(1, 0)
-       MASKFILT(1, 1)
-       MASKFILT(1, 2)
-       MASKFILT(2, 0)
-       MASKFILT(2, 1)
-       MASKFILT(2, 2)
+       MASKFILT(0, 0);
+       MASKFILT(0, 1);
+       MASKFILT(0, 2);
+       MASKFILT(1, 0);
+       MASKFILT(1, 1);
+       MASKFILT(1, 2);
+       MASKFILT(2, 0);
+       MASKFILT(2, 1);
+       MASKFILT(2, 2);
+
+#undef MASKFILT
 }
 
 void add_filt_fmask_pixsize(unsigned int mask, float *in, float *rowbuf, int row_w, int pixsize)
index f842dc0ff1b2139212e81ccc04e5185972774fbb..82f2add7c3d3aac21a11d12d41cdb5a3380bf8cc 100644 (file)
@@ -451,11 +451,19 @@ static float area_lamp_energy(float (*area)[3], const float co[3], const float v
        Normalize_d(vec[3]);
 
        /* cross product */
+#define CROSS(dest, a, b) \
+       { dest[0]= a[1] * b[2] - a[2] * b[1]; \
+         dest[1]= a[2] * b[0] - a[0] * b[2]; \
+         dest[2]= a[0] * b[1] - a[1] * b[0]; \
+       } (void)0
+
        CROSS(cross[0], vec[0], vec[1]);
        CROSS(cross[1], vec[1], vec[2]);
        CROSS(cross[2], vec[2], vec[3]);
        CROSS(cross[3], vec[3], vec[0]);
 
+#undef CROSS
+
        Normalize_d(cross[0]);
        Normalize_d(cross[1]);
        Normalize_d(cross[2]);
index 8484e82c66c9b4837f2356d47620161f2023b689..ecde9bb2de8f888b693587e59337ca3a931bd4a1 100644 (file)
@@ -1982,7 +1982,7 @@ void zbufclip4(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3
 
 /* ************** ZMASK ******************************** */
 
-#define EXTEND_PIXEL(a)        if (temprectp[a]) {z+= rectz[a]; tot++;}
+#define EXTEND_PIXEL(a)        if (temprectp[a]) { z += rectz[a]; tot++; } (void)0
 
 /* changes the zbuffer to be ready for z-masking: applies an extend-filter, and then clears */
 static void zmask_rect(int *rectz, int *rectp, int xs, int ys, int neg)