Index: pjproject/trunk/pjlib-util/src/pjlib-util-test/resolver_test.c
===================================================================
--- pjproject/trunk/pjlib-util/src/pjlib-util-test/resolver_test.c	(revision 2406)
+++ pjproject/trunk/pjlib-util/src/pjlib-util-test/resolver_test.c	(revision 2407)
@@ -703,11 +703,12 @@
     PJ_UNUSED_ARG(user_data);
 
-    pj_assert(status == PJ_SUCCESS);
-    pj_assert(resp);
-    pj_assert(resp->hdr.anscount == 1);
-    pj_assert(resp->ans[0].type == PJ_DNS_TYPE_A);
-    pj_assert(resp->ans[0].rdata.a.ip_addr.s_addr == IP_ADDR0);
-
     pj_sem_post(sem);
+
+    PJ_ASSERT_ON_FAIL(status == PJ_SUCCESS, return);
+    PJ_ASSERT_ON_FAIL(resp, return);
+    PJ_ASSERT_ON_FAIL(resp->hdr.anscount == 1, return);
+    PJ_ASSERT_ON_FAIL(resp->ans[0].type == PJ_DNS_TYPE_A, return);
+    PJ_ASSERT_ON_FAIL(resp->ans[0].rdata.a.ip_addr.s_addr == IP_ADDR0, return);
+
 }
 
@@ -779,7 +780,8 @@
     PJ_UNUSED_ARG(resp);
 
-    pj_assert(status == PJ_STATUS_FROM_DNS_RCODE(PJ_DNS_RCODE_NXDOMAIN));
-
     pj_sem_post(sem);
+
+    PJ_ASSERT_ON_FAIL(status==PJ_STATUS_FROM_DNS_RCODE(PJ_DNS_RCODE_NXDOMAIN),
+		      return);
 }
 
@@ -1015,14 +1017,18 @@
     PJ_UNUSED_ARG(user_data);
 
-    pj_assert(status == PJ_SUCCESS);
-    pj_assert(rec->count == 1);
-    pj_assert(rec->entry[0].priority == 1);
-    pj_assert(rec->entry[0].weight == 2);
-    pj_assert(pj_strcmp2(&rec->entry[0].server.name, "sip.somedomain.com")==0);
-    pj_assert(pj_strcmp2(&rec->entry[0].server.alias, "sipalias.somedomain.com")==0);
-    pj_assert(rec->entry[0].server.addr[0].s_addr == IP_ADDR1);
-    pj_assert(rec->entry[0].port == PORT1);
-
     pj_sem_post(sem);
+
+    PJ_ASSERT_ON_FAIL(status == PJ_SUCCESS, return);
+    PJ_ASSERT_ON_FAIL(rec->count == 1, return);
+    PJ_ASSERT_ON_FAIL(rec->entry[0].priority == 1, return);
+    PJ_ASSERT_ON_FAIL(rec->entry[0].weight == 2, return);
+    PJ_ASSERT_ON_FAIL(pj_strcmp2(&rec->entry[0].server.name, "sip.somedomain.com")==0,
+		      return);
+    PJ_ASSERT_ON_FAIL(pj_strcmp2(&rec->entry[0].server.alias, "sipalias.somedomain.com")==0,
+		      return);
+    PJ_ASSERT_ON_FAIL(rec->entry[0].server.addr[0].s_addr == IP_ADDR1, return);
+    PJ_ASSERT_ON_FAIL(rec->entry[0].port == PORT1, return);
+
+    
 }
 
@@ -1033,8 +1039,9 @@
     PJ_UNUSED_ARG(user_data);
 
-    pj_assert(status == PJ_STATUS_FROM_DNS_RCODE(PJ_DNS_RCODE_NXDOMAIN));
-    pj_assert(rec->count == 0);
-
     pj_sem_post(sem);
+
+    PJ_ASSERT_ON_FAIL(status==PJ_STATUS_FROM_DNS_RCODE(PJ_DNS_RCODE_NXDOMAIN),
+		      return);
+    PJ_ASSERT_ON_FAIL(rec->count == 0, return);
 }
 
@@ -1176,14 +1183,16 @@
     PJ_UNUSED_ARG(user_data);
 
-    pj_assert(status == PJ_SUCCESS);
-    pj_assert(rec->count == 1);
-    pj_assert(rec->entry[0].priority == 0);
-    pj_assert(rec->entry[0].weight == 0);
-    pj_assert(pj_strcmp2(&rec->entry[0].server.name, TARGET)==0);
-    pj_assert(pj_strcmp2(&rec->entry[0].server.alias, "sipalias01." TARGET)==0);
-    pj_assert(rec->entry[0].server.addr[0].s_addr == IP_ADDR2);
-    pj_assert(rec->entry[0].port == PORT2);
-
     pj_sem_post(sem);
+
+    PJ_ASSERT_ON_FAIL(status == PJ_SUCCESS, return);
+    PJ_ASSERT_ON_FAIL(rec->count == 1, return);
+    PJ_ASSERT_ON_FAIL(rec->entry[0].priority == 0, return);
+    PJ_ASSERT_ON_FAIL(rec->entry[0].weight == 0, return);
+    PJ_ASSERT_ON_FAIL(pj_strcmp2(&rec->entry[0].server.name, TARGET)==0,
+		      return);
+    PJ_ASSERT_ON_FAIL(pj_strcmp2(&rec->entry[0].server.alias, "sipalias01." TARGET)==0,
+		      return);
+    PJ_ASSERT_ON_FAIL(rec->entry[0].server.addr[0].s_addr == IP_ADDR2, return);
+    PJ_ASSERT_ON_FAIL(rec->entry[0].port == PORT2, return);
 }
 
@@ -1307,7 +1316,10 @@
 
     PJ_UNUSED_ARG(user_data);
+    PJ_UNUSED_ARG(status);
+    PJ_UNUSED_ARG(rec);
 
     pj_assert(status == PJ_SUCCESS);
     pj_assert(rec->count == PJ_DNS_SRV_MAX_ADDR);
+
     for (i=0; i<PJ_DNS_SRV_MAX_ADDR; ++i) {
 	unsigned j;
Index: pjproject/trunk/pjlib/include/pj/compat/cc_armcc.h
===================================================================
--- pjproject/trunk/pjlib/include/pj/compat/cc_armcc.h	(revision 2406)
+++ pjproject/trunk/pjlib/include/pj/compat/cc_armcc.h	(revision 2407)
@@ -52,4 +52,6 @@
 #define PJ_INT64_FMT		"L"
 
+#define PJ_UNREACHED(x)	    	
+
 #endif	/* __PJ_COMPAT_CC_ARMCC_H__ */
 
Index: pjproject/trunk/pjlib/include/pj/compat/cc_codew.h
===================================================================
--- pjproject/trunk/pjlib/include/pj/compat/cc_codew.h	(revision 2406)
+++ pjproject/trunk/pjlib/include/pj/compat/cc_codew.h	(revision 2407)
@@ -50,4 +50,5 @@
 #define PJ_INT64_FMT		"L"
 
+#define PJ_UNREACHED(x)	    	
 
 #endif	/* __PJ_COMPAT_CC_CODEW_H__ */
Index: pjproject/trunk/pjlib/include/pj/compat/cc_gcc.h
===================================================================
--- pjproject/trunk/pjlib/include/pj/compat/cc_gcc.h	(revision 2406)
+++ pjproject/trunk/pjlib/include/pj/compat/cc_gcc.h	(revision 2407)
@@ -70,4 +70,5 @@
 #endif
 
+#define PJ_UNREACHED(x)	    	
 
 #endif	/* __PJ_COMPAT_CC_GCC_H__ */
Index: pjproject/trunk/pjlib/include/pj/compat/cc_msvc.h
===================================================================
--- pjproject/trunk/pjlib/include/pj/compat/cc_msvc.h	(revision 2406)
+++ pjproject/trunk/pjlib/include/pj/compat/cc_msvc.h	(revision 2407)
@@ -39,4 +39,11 @@
 #   define _CRT_SECURE_NO_DEPRECATE
 #endif
+#if PJ_CC_VER_1 >= 8 && !defined(_CRT_SECURE_NO_WARNINGS)
+#   define _CRT_SECURE_NO_WARNINGS
+    /* The above doesn't seem to work, at least on VS2005, so lets use
+     * this construct as well.
+     */
+#   pragma warning(disable: 4996)
+#endif
 
 #pragma warning(disable: 4127) // conditional expression is constant
@@ -72,4 +79,6 @@
 #define PJ_INT64_FMT		"I64"
 
+#define PJ_UNREACHED(x)	    	
 
 #endif	/* __PJ_COMPAT_CC_MSVC_H__ */
+
Index: pjproject/trunk/pjlib/include/pj/compat/cc_mwcc.h
===================================================================
--- pjproject/trunk/pjlib/include/pj/compat/cc_mwcc.h	(revision 2406)
+++ pjproject/trunk/pjlib/include/pj/compat/cc_mwcc.h	(revision 2407)
@@ -50,4 +50,5 @@
 #define PJ_INT64_FMT		"L"
 
+#define PJ_UNREACHED(x)	    	
 
 #endif	/* __PJ_COMPAT_CC_MWCC_H__ */
Index: pjproject/trunk/pjlib/src/pjlib-test/exception.c
===================================================================
--- pjproject/trunk/pjlib/src/pjlib-test/exception.c	(revision 2406)
+++ pjproject/trunk/pjlib/src/pjlib-test/exception.c	(revision 2407)
@@ -55,5 +55,5 @@
 {
     PJ_THROW( ID_1 );
-    return -1;
+    PJ_UNREACHED(return -1;)
 }
 
@@ -61,5 +61,5 @@
 {
     PJ_THROW( ID_2 );
-    return -1;
+    PJ_UNREACHED(return -1;)
 }
 
Index: pjproject/trunk/pjlib/src/pjlib-test/udp_echo_srv_ioqueue.c
===================================================================
--- pjproject/trunk/pjlib/src/pjlib-test/udp_echo_srv_ioqueue.c	(revision 2406)
+++ pjproject/trunk/pjlib/src/pjlib-test/udp_echo_srv_ioqueue.c	(revision 2407)
@@ -151,5 +151,5 @@
         rc = pj_ioqueue_poll(ioqueue, &timeout);
     }
-    return 0;
+    PJ_UNREACHED(return 0;)
 }
 
Index: pjproject/trunk/pjlib/src/pjlib-test/udp_echo_srv_sync.c
===================================================================
--- pjproject/trunk/pjlib/src/pjlib-test/udp_echo_srv_sync.c	(revision 2406)
+++ pjproject/trunk/pjlib/src/pjlib-test/udp_echo_srv_sync.c	(revision 2407)
@@ -57,5 +57,5 @@
         }
     }
-    return 0;
+    PJ_UNREACHED(return 0;)
 }
 
@@ -161,5 +161,5 @@
         }
     }
-    return 0;
+    PJ_UNREACHED(return 0;)
 }
 
Index: pjproject/trunk/pjmedia/src/pjmedia/rtcp_xr.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/rtcp_xr.c	(revision 2406)
+++ pjproject/trunk/pjmedia/src/pjmedia/rtcp_xr.c	(revision 2407)
@@ -405,5 +405,6 @@
     pkt_len = pj_ntohs((pj_uint16_t)rtcp_xr->common.length);
 
-    pj_assert((pkt_len + 1) <= (size / 4));
+    if ((pkt_len + 1) > (size / 4))
+	return;
 
     /* Parse report rpt_types */
Index: pjproject/trunk/pjnath/src/pjnath/turn_session.c
===================================================================
--- pjproject/trunk/pjnath/src/pjnath/turn_session.c	(revision 2406)
+++ pjproject/trunk/pjnath/src/pjnath/turn_session.c	(revision 2407)
@@ -1077,7 +1077,6 @@
 	PJ_LOG(4,(sess->obj_name, "Trying next server"));
 	set_state(sess, PJ_TURN_STATE_RESOLVED);
-	break;
-
-    } while (status != PJ_SUCCESS);
+
+    } while (0);
 }
 
Index: pjproject/trunk/pjsip-apps/src/pjsua/main.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/pjsua/main.c	(revision 2406)
+++ pjproject/trunk/pjsip-apps/src/pjsua/main.c	(revision 2407)
@@ -53,5 +53,5 @@
             app_destroy();
 	    ExitProcess(1);
-            return TRUE; 
+            PJ_UNREACHED(return TRUE;)
  
         default: 
