]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
changed ASSERT_MESSAGE and ERROR_MESSAGE macros to use proper
authorForest Hale <lordhavoc>
Mon, 5 Mar 2007 23:45:55 +0000 (23:45 +0000)
committerForest Hale <lordhavoc>
Mon, 5 Mar 2007 23:45:55 +0000 (23:45 +0000)
do{}while(0) encapsulation to protect them when used in an if block
without {}
previously they used else to consume the trailing ; but this
could just as easily consume any other following statement
(very dangerous in concept, but no damage done in this case)
this causes no change whatsoever in release builds

git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@152 8a3a26a2-13c4-0310-b231-cf6edde360e5

libs/debugging/debugging.h
radiant/brush.h
radiant/dialog.cpp
radiant/mainframe.cpp

index 642283fd712ac2ebab842de4b576529ca1b6248a..4c03e9d7b5d1fa665cdad7b6e3d4267b12f8ca4c 100644 (file)
@@ -112,17 +112,17 @@ inline DebugMessageHandler& globalDebugMessageHandler()
 #if defined(DEBUG_ASSERTS)
 
 /// \brief Sends a \p message to the current debug-message-handler text-output-stream if \p condition evaluates to false.
 #if defined(DEBUG_ASSERTS)
 
 /// \brief Sends a \p message to the current debug-message-handler text-output-stream if \p condition evaluates to false.
-#define ASSERT_MESSAGE(condition, message)\
+#define ASSERT_MESSAGE(condition, message) do{\
 if(!(condition))\
 {\
   globalDebugMessageHandler().getOutputStream() << FILE_LINE "\nassertion failure: " << message << "\n";\
   if(!globalDebugMessageHandler().handleMessage()) { DEBUGGER_BREAKPOINT(); }\
 if(!(condition))\
 {\
   globalDebugMessageHandler().getOutputStream() << FILE_LINE "\nassertion failure: " << message << "\n";\
   if(!globalDebugMessageHandler().handleMessage()) { DEBUGGER_BREAKPOINT(); }\
-} else\
+}} while(0)
 
 /// \brief Sends a \p message to the current debug-message-handler text-output-stream.
 
 /// \brief Sends a \p message to the current debug-message-handler text-output-stream.
-#define ERROR_MESSAGE(message)\
+#define ERROR_MESSAGE(message) do{\
 globalDebugMessageHandler().getOutputStream() << FILE_LINE "\nruntime error: " << message << "\n";\
 globalDebugMessageHandler().getOutputStream() << FILE_LINE "\nruntime error: " << message << "\n";\
-if(!globalDebugMessageHandler().handleMessage()) { DEBUGGER_BREAKPOINT(); } else\
+if(!globalDebugMessageHandler().handleMessage()) { DEBUGGER_BREAKPOINT(); }} while(0)
 
 #define ASSERT_NOTNULL(ptr) ASSERT_MESSAGE(ptr != 0, "pointer \"" #ptr "\" is null")
 
 
 #define ASSERT_NOTNULL(ptr) ASSERT_MESSAGE(ptr != 0, "pointer \"" #ptr "\" is null")
 
index 4542faf22e95ac0c03f7c1cd3fb4457dfb3e6b15..04d3d1ff4d4ac5193995c1be38820f70e8fbfbc7 100644 (file)
@@ -3099,7 +3099,7 @@ public:
         m_face->getWinding()[2].vertex
       ),
       "update_move_planepts_vertex2: error"
         m_face->getWinding()[2].vertex
       ),
       "update_move_planepts_vertex2: error"
-    )
+    );
 
     m_face->m_move_planepts[0] = m_face->getWinding()[opposite].vertex;
     m_face->m_move_planepts[1] = m_face->getWinding()[index].vertex;
 
     m_face->m_move_planepts[0] = m_face->getWinding()[opposite].vertex;
     m_face->m_move_planepts[1] = m_face->getWinding()[index].vertex;
index c3ef12bf38288c0e1be0047e111f004b4ef75707..cb5c7069cd391dd6a48cb323d6fde06cb68c089d 100644 (file)
@@ -378,14 +378,14 @@ Dialog::~Dialog()
 
 void Dialog::ShowDlg()
 {
 
 void Dialog::ShowDlg()
 {
-  ASSERT_MESSAGE(m_window != 0, "dialog was not constructed")
+  ASSERT_MESSAGE(m_window != 0, "dialog was not constructed");
   importData();
   gtk_widget_show(GTK_WIDGET(m_window));
 }
 
 void Dialog::HideDlg()
 {
   importData();
   gtk_widget_show(GTK_WIDGET(m_window));
 }
 
 void Dialog::HideDlg()
 {
-  ASSERT_MESSAGE(m_window != 0, "dialog was not constructed")
+  ASSERT_MESSAGE(m_window != 0, "dialog was not constructed");
   exportData();
   gtk_widget_hide(GTK_WIDGET(m_window));
 }
   exportData();
   gtk_widget_hide(GTK_WIDGET(m_window));
 }
@@ -399,7 +399,7 @@ static gint delete_event_callback(GtkWidget *widget, GdkEvent* event, gpointer d
 
 void Dialog::Create()
 {
 
 void Dialog::Create()
 {
-  ASSERT_MESSAGE(m_window == 0, "dialog cannot be constructed")
+  ASSERT_MESSAGE(m_window == 0, "dialog cannot be constructed");
 
   m_window = BuildDialog();
   g_signal_connect(G_OBJECT(m_window), "delete_event", G_CALLBACK(delete_event_callback), this);
 
   m_window = BuildDialog();
   g_signal_connect(G_OBJECT(m_window), "delete_event", G_CALLBACK(delete_event_callback), this);
index 6af2cf8f69854028ae087b79b817054ae9840cde..785d86ac0acd381ad4d4a697d58f3e235dd7cc23 100644 (file)
@@ -3310,7 +3310,11 @@ void GlobalGL_sharedContextCreated()
   GlobalShaderCache().realise();
   Textures_Realise();
 
   GlobalShaderCache().realise();
   Textures_Realise();
 
+#ifdef __linux__
+  g_font = glfont_create("fixed 8");
+#else
   g_font = glfont_create("courier 8");
   g_font = glfont_create("courier 8");
+#endif
   GlobalOpenGL().m_font = g_font.getDisplayList();
   GlobalOpenGL().m_fontHeight = g_font.getPixelHeight();
 }
   GlobalOpenGL().m_font = g_font.getDisplayList();
   GlobalOpenGL().m_fontHeight = g_font.getPixelHeight();
 }