Removing false Prefast alarms by:
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 22 Jul 2008 06:55:12 +0000 (06:55 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 22 Jul 2008 06:55:12 +0000 (06:55 +0000)
Adding __analysis_assume() to ASSERT when DBG and _PREFAST_ are used for use in all the WinOF tree.
Adding __pragma(warning(suppress:6326)) to suppress constants compare warning (performance decrease is acceptable since this is chked code/ heavy windows event logging.
Signed by:Doron Tsur

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1431 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/al/al_debug.h
hw/mthca/kernel/hca_debug.h
inc/complib/cl_debug.h
inc/kernel/complib/cl_types_osd.h
inc/user/complib/cl_types_osd.h
ulp/ipoib/kernel/ipoib_debug.h

index d3f1534..4572b70 100644 (file)
@@ -185,8 +185,15 @@ extern uint32_t                    g_al_dbg_flags;
 #if DBG\r
 \r
 // assignment of _level_ is need to to overcome warning C4127\r
+\r
+//\r
+// Code in DBG, has no impact on fre performance\r
+// Hence the 6326 warning suppression\r
+//\r
+\r
 #define AL_PRINT( _level_,_flag_,_msg_)  \\r
        { \\r
+        __pragma(warning(suppress:6326)) \\r
                if( g_al_dbg_level >= (_level_) ) \\r
                        CL_TRACE( _flag_, g_al_dbg_flags, _msg_ ); \\r
        }\r
@@ -194,6 +201,7 @@ extern uint32_t                     g_al_dbg_flags;
 \r
 #define AL_PRINT_EXIT( _level_,_flag_,_msg_) \\r
        { \\r
+        __pragma(warning(suppress:6326)) \\r
                if( g_al_dbg_level >= (_level_) ) \\r
                        CL_TRACE( _flag_, g_al_dbg_flags, _msg_ );\\r
                AL_EXIT( _flag_ );\\r
@@ -201,12 +209,14 @@ extern uint32_t                   g_al_dbg_flags;
 \r
 #define AL_ENTER( _flag_) \\r
        { \\r
+    __pragma(warning(suppress:6326)) \\r
                if( g_al_dbg_level >= TRACE_LEVEL_VERBOSE ) \\r
                        CL_ENTER( _flag_, g_al_dbg_flags ); \\r
        }\r
 \r
 #define AL_EXIT( _flag_)\\r
        { \\r
+    __pragma(warning(suppress:6326)) \\r
                if( g_al_dbg_level >= TRACE_LEVEL_VERBOSE ) \\r
                        CL_EXIT( _flag_, g_al_dbg_flags ); \\r
        }\r
index 18dba8f..9b6f1f6 100644 (file)
@@ -52,6 +52,7 @@ static void _build_str( const char *  format, ... )
 #define HCA_PRINT_TO_EVENT_LOG(_obj_,_level_,_flag_,_msg_)  \\r
        { \\r
                NTSTATUS event_id; \\r
+               __pragma(warning(suppress:6326)) \\r
                switch (_level_) { \\r
                        case TRACE_LEVEL_FATAL: case TRACE_LEVEL_ERROR: event_id = EVENT_MTHCA_ANY_ERROR; break; \\r
                        case TRACE_LEVEL_WARNING: event_id = EVENT_MTHCA_ANY_WARN; break; \\r
index 36f7265..17a8fe7 100644 (file)
@@ -463,6 +463,7 @@ cl_msg_out(
 *      Debug Output, Debug Levels, CL_PRINT, CL_ENTER, CL_EXIT, CL_TRACE_EXIT\r
 *********/\r
 #define CL_TRACE( DBG_LVL, CHK_LVL, STRING )                                                           \\r
+__pragma(warning(suppress:6326))                                                                                       \\r
 do{                                                                                                                                                    \\r
 switch( DBG_LVL & CL_DBG_ERROR )                                                                                       \\r
 {                                                                                                                                                      \\r
@@ -541,6 +542,7 @@ CL_PRINT( DBG_LVL, CHK_LVL, STRING );                                                                               \
 *      Debug Output, Debug Levels, CL_PRINT, CL_ENTER, CL_EXIT, CL_TRACE\r
 *********/\r
 #define CL_TRACE_EXIT( DBG_LVL, CHK_LVL, STRING )                                                      \\r
+       __pragma(warning(suppress:6326)) \\r
        do{                                                                                                                                             \\r
        CL_TRACE( DBG_LVL, CHK_LVL, STRING );                                                                   \\r
        CL_EXIT( DBG_LVL, CHK_LVL );                                                                                    \\r
index bef60aa..851d8ea 100644 (file)
@@ -93,10 +93,20 @@ typedef _W64 __int3264                      intn_t;
 typedef _W64 unsigned __int3264        uintn_t;\r
 typedef volatile __int32               atomic32_t;\r
 \r
+#ifdef _PREFAST_\r
+#define CONDITION_ASSUMED(X) __analysis_assume((X))\r
+#else\r
+#define CONDITION_ASSUMED(X) \r
+#endif // _PREFAST_\r
+\r
 \r
 #ifndef CL_ASSERT\r
+#ifdef _DEBUG_\r
+#define CL_ASSERT(X) ASSERT(X);CONDITION_ASSUMED(X)\r
+#else\r
 #define CL_ASSERT      ASSERT\r
 #endif\r
+#endif\r
 \r
 \r
 #define UNUSED_PARAM   UNREFERENCED_PARAMETER\r
index 7a6407b..e205de6 100644 (file)
@@ -98,10 +98,15 @@ typedef volatile __int32            atomic32_t;
 /* boolean_t must be intergral sized to avoid a bunch of warnings. */\r
 typedef int                                            boolean_t;\r
 \r
+#ifdef _PREFAST_\r
+#define CONDITION_ASSUMED(X) __analysis_assume((X))\r
+#else\r
+#define CONDITION_ASSUMED(X) \r
+#endif // _PREFAST_\r
 \r
 #ifndef CL_ASSERT\r
 #ifdef _DEBUG_\r
-#define CL_ASSERT( exp )       (void)(!(exp)?OutputDebugString("Assertion Failed:" #exp "\n"),DebugBreak(),FALSE:TRUE)\r
+#define CL_ASSERT( exp )       (void)(!(exp)?OutputDebugString("Assertion Failed:" #exp "\n"),DebugBreak(),FALSE:TRUE);CONDITION_ASSUMED(exp)\r
 #else\r
 #define CL_ASSERT( exp )\r
 #endif /* _DEBUG_ */\r
index 6a5e3c7..2e8217f 100644 (file)
@@ -124,12 +124,14 @@ extern uint32_t           g_ipoib_dbg_flags;
 // assignment of _level_ is need to to overcome warning C4127\r
 #define IPOIB_PRINT(_level_,_flag_,_msg_) \\r
        { \\r
+               __pragma(warning(suppress:6326)) \\r
                if( g_ipoib_dbg_level >= (_level_) ) \\r
                        CL_TRACE( _flag_, g_ipoib_dbg_flags, _msg_ ); \\r
        }\r
 \r
 #define IPOIB_PRINT_EXIT(_level_,_flag_,_msg_) \\r
        { \\r
+               __pragma(warning(suppress:6326)) \\r
                if( g_ipoib_dbg_level >= (_level_) ) \\r
                        CL_TRACE( _flag_, g_ipoib_dbg_flags, _msg_ );\\r
                IPOIB_EXIT(_flag_);\\r
@@ -137,18 +139,21 @@ extern uint32_t           g_ipoib_dbg_flags;
 \r
 #define IPOIB_ENTER(_flag_) \\r
        { \\r
+               __pragma(warning(suppress:6326)) \\r
                if( g_ipoib_dbg_level >= TRACE_LEVEL_VERBOSE ) \\r
                        CL_ENTER( _flag_, g_ipoib_dbg_flags ); \\r
        }\r
 \r
 #define IPOIB_EXIT(_flag_)\\r
        { \\r
+               __pragma(warning(suppress:6326)) \\r
                if( g_ipoib_dbg_level >= TRACE_LEVEL_VERBOSE ) \\r
                        CL_EXIT( _flag_, g_ipoib_dbg_flags ); \\r
        }\r
 \r
 #define IPOIB_TRACE_BYTES( lvl, ptr, len )                                                                     \\r
        {                                                                                                                                               \\r
+               __pragma(warning(suppress:6326))                                                                        \\r
                if( g_ipoib_dbg_level >= (_level_) &&                                                           \\r
                        (g_ipoib_dbg_flags & (_flag_)) )                                                                \\r
                {                                                                                                                                       \\r