[Bf-blender-cvs] [5db8da8] master: Freestyle: Fix for VC++ warnings about 'hypot' macro redefinitions (Part 1).

Tamito Kajiyama noreply at git.blender.org
Thu Apr 17 07:37:35 CEST 2014


Commit: 5db8da81055be7fb89b4d824ce17e61ffeb46060
Author: Tamito Kajiyama
Date:   Thu Apr 17 12:01:10 2014 +0900
https://developer.blender.org/rB5db8da81055be7fb89b4d824ce17e61ffeb46060

Freestyle: Fix for VC++ warnings about 'hypot' macro redefinitions (Part 1).

The issue was caused by including both Python.h and BLI_math.h.  Since the macro
definition in Python.h was unconditional, it was necessary to include it first and then
BLI_math.h.

Addressing the issue turned out to affect many Freestyle source files.  There were several
other coding flaws that complicated the situation:

1. intern/system/FreestyleConfig.h was abused just to include BLI_math.h which was in
fact unnecessary in FreestyleConfig.h.  While addressing this, inclusion of both math.h
and BLI_math.h had to be duly dealt with to avoid a compiler error about round().

2. #include <Python.h> was not properly put in the extern "C" { ... } construct.

3. intern/view_map/Interface0D.h and intern/python/Director.h, both of which included
Python.h, were included from within Freestyle header files that were almost or completely
independent of Python.  These non-Python header files were used everywhere in the
Freestyle code base, causing many cases of the reported macro redefinitions.

4. The Director.h file was also declaring 'using namespace Freestyle', which was causing
another scope issue in several Freestyle header files.

This commit is intended to address the first problem above.  Subsequent commits will deal
with the other three.

===================================================================

M	source/blender/freestyle/intern/application/AppView.h
M	source/blender/freestyle/intern/geometry/matrix_util.cpp
M	source/blender/freestyle/intern/scene_graph/NodeTransform.cpp
M	source/blender/freestyle/intern/system/FreestyleConfig.h
M	source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
M	source/blender/freestyle/intern/view_map/FEdgeXDetector.h
M	source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
M	source/blender/freestyle/intern/winged_edge/Curvature.cpp
M	source/blender/freestyle/intern/winged_edge/WEdge.h

===================================================================

diff --git a/source/blender/freestyle/intern/application/AppView.h b/source/blender/freestyle/intern/application/AppView.h
index 3f6d0b8..1410190 100644
--- a/source/blender/freestyle/intern/application/AppView.h
+++ b/source/blender/freestyle/intern/application/AppView.h
@@ -31,6 +31,8 @@
 #include "../scene_graph/NodeDrawingStyle.h"
 #include "../system/Precision.h"
 
+#include "BLI_math.h"
+
 #ifdef WITH_CXX_GUARDEDALLOC
 #include "MEM_guardedalloc.h"
 #endif
diff --git a/source/blender/freestyle/intern/geometry/matrix_util.cpp b/source/blender/freestyle/intern/geometry/matrix_util.cpp
index 7905dda..5e58549 100644
--- a/source/blender/freestyle/intern/geometry/matrix_util.cpp
+++ b/source/blender/freestyle/intern/geometry/matrix_util.cpp
@@ -36,10 +36,10 @@
  *  \author Bruno Levy
  */
 
-#include <math.h>
-
 #include "matrix_util.h"
 
+#include "BLI_math.h"
+
 namespace Freestyle {
 
 namespace OGF {
diff --git a/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp b/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp
index 5d26e85..8a25fe1 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp
@@ -28,7 +28,7 @@
 
 #include "NodeTransform.h"
 
-#include "../system/FreestyleConfig.h"
+#include "BLI_math.h"
 
 namespace Freestyle {
 
diff --git a/source/blender/freestyle/intern/system/FreestyleConfig.h b/source/blender/freestyle/intern/system/FreestyleConfig.h
index 42f9833..5c53479 100644
--- a/source/blender/freestyle/intern/system/FreestyleConfig.h
+++ b/source/blender/freestyle/intern/system/FreestyleConfig.h
@@ -30,8 +30,6 @@
 
 #include <string>
 
-#include "BLI_math.h"
-
 using namespace std;
 
 namespace Freestyle {
diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
index 2da82f1..9c9cd88 100644
--- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
+++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
@@ -26,7 +26,6 @@
  */
 
 #include <float.h>
-#include <math.h>
 
 #include "FEdgeXDetector.h"
 
diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
index 2bc0cd1..a26f8d2 100644
--- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
+++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
@@ -39,6 +39,8 @@
 #include "../winged_edge/Curvature.h"
 #include "../winged_edge/WXEdge.h"
 
+#include "BLI_math.h"
+
 #ifdef WITH_CXX_GUARDEDALLOC
 #include "MEM_guardedalloc.h"
 #endif
diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
index c777db6..a4cb2a4 100644
--- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
+++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
@@ -25,7 +25,6 @@
  *  \date 01/07/2003
  */
 
-#include <math.h>
 //soc #include <qimage.h>
 //soc #include <qstring.h>
 #include <sstream>
@@ -39,6 +38,7 @@
 #include "../image/Image.h"
 
 #include "BKE_global.h"
+#include "BLI_math.h"
 
 extern "C" {
 #include "IMB_imbuf.h"
diff --git a/source/blender/freestyle/intern/winged_edge/Curvature.cpp b/source/blender/freestyle/intern/winged_edge/Curvature.cpp
index 4493080..4a91009 100644
--- a/source/blender/freestyle/intern/winged_edge/Curvature.cpp
+++ b/source/blender/freestyle/intern/winged_edge/Curvature.cpp
@@ -45,7 +45,6 @@
 
 #include <assert.h>
 #include <cstdlib> // for malloc and free
-#include <math.h>
 #include <set>
 #include <stack>
 
@@ -54,7 +53,7 @@
 
 #include "../geometry/normal_cycle.h"
 
-#include "../system/FreestyleConfig.h"
+#include "BLI_math.h"
 
 namespace Freestyle {
 
diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.h b/source/blender/freestyle/intern/winged_edge/WEdge.h
index f0692ae..50d1de5 100644
--- a/source/blender/freestyle/intern/winged_edge/WEdge.h
+++ b/source/blender/freestyle/intern/winged_edge/WEdge.h
@@ -29,7 +29,6 @@
  */
 
 #include <iterator>
-#include <math.h>
 #include <vector>
 
 #include "../geometry/Geom.h"
@@ -38,6 +37,8 @@
 
 #include "../system/FreestyleConfig.h"
 
+#include "BLI_math.h"
+
 #ifdef WITH_CXX_GUARDEDALLOC
 #include "MEM_guardedalloc.h"
 #endif




More information about the Bf-blender-cvs mailing list