The Sun compiler defines _T which conflicts with wxWidgets use of the
authordpage <dpage@a7884b65-44f6-0310-8a51-81a127f17b15>
Thu, 10 Sep 2009 08:56:00 +0000 (08:56 +0000)
committerdpage <dpage@a7884b65-44f6-0310-8a51-81a127f17b15>
Thu, 10 Sep 2009 08:56:00 +0000 (08:56 +0000)
macro, as discussed at http://trac.wxwidgets.org/ticket/10660. This
patch removes any issues from pgAdmin [Zdenek Kotala]

git-svn-id: svn://svn.pgadmin.org/trunk/pgadmin3@8033 a7884b65-44f6-0310-8a51-81a127f17b15

pgadmin/include/pgscript/stack.hh

index c1f22140af3a5c82cbbaf15d4c452a63c86a1050..5b623182fff1500198cfab3d9b6a35155c93dfe4 100644 (file)
 #ifndef BISON_STACK_HH
 # define BISON_STACK_HH
 
+/* The Sun compiler defines _T, which conflicts with wxWidgets, so
+   we must un-define it if needed. */
+#if defined(__SUNPRO_CC)
+#ifdef _T
+#undef _T
+#define _T_is_defined
+#endif
+#endif /*__SUNPRO_CC */
+
 #include <deque>
 
 namespace pgscript
@@ -126,4 +135,18 @@ namespace pgscript
   };
 }
 
+/* Redefine _T if we un-defined it for the Sun compiler. */
+#if defined(__SUNPRO_CC)
+#ifdef _T_is_defined
+#undef _T_is_defined
+/* we need to define it back only if _T already was defined. */
+#if !wxUSE_UNICODE
+#define _T(x) x
+#else /* Unicode */
+/* use wxCONCAT_HELPER so that x could be expanded if it's a macro */
+#define _T(x) wxCONCAT_HELPER(L, x)
+#endif /* ASCII/Unicode */
+#endif /* T_is_defined */
+#endif /*__SUNPRO_CC */
+
 #endif // not BISON_STACK_HH