[INCLUDES]

- Add _PRAGMA_WARNING_SUPPRESS() macro
- Fix definition of __analysis_noreturn for PREFAST runs
- Annotate RtlAssert with __analysis_noreturn everywhere
- Add proper annotations to all DbgPrint and DbgPrintEx definitions
- Suppress warnings for use of ProbeForRead outside of SEH

svn path=/trunk/; revision=56983
This commit is contained in:
Timo Kreuzer 2012-07-29 17:25:05 +00:00
parent f59a68d66e
commit d2d680b3ae
6 changed files with 20 additions and 15 deletions

View file

@ -30,6 +30,7 @@
#ifndef RC_INVOKED
#define _PRAGMA_WARNING_SUPPRESS(x) /* Only for MSVC */
#define __INTRIN_INLINE extern __inline__ __attribute__((__always_inline__,__gnu_inline__))
#ifndef _SIZE_T_DEFINED

View file

@ -5,6 +5,9 @@
extern "C" {
#endif
/** Pragma support **/
#define _PRAGMA_WARNING_SUPPRESS(x) __pragma(warning(suppress: x))
/*** Stack frame juggling ***/
void * _ReturnAddress(void);
#pragma intrinsic(_ReturnAddress)

View file

@ -593,6 +593,7 @@ RtlAddVectoredExceptionHandler(
IN PVECTORED_EXCEPTION_HANDLER VectoredHandler
);
__analysis_noreturn
NTSYSAPI
VOID
NTAPI

View file

@ -46,16 +46,17 @@
#define __in_awcount(expr,size)
#define __nullnullterminated
#define __in_data_source(src_sym)
#define __analysis_noreturn
#define __kernel_entry
#if (_MSC_VER >= 1000) && !defined(__midl) && defined(_PREFAST_)
#define __inner_data_source(src_raw) _SA_annotes1(SAL_untrusted_data_source,src_raw)
#define __out_data_source(src_sym) _Post_ __inner_data_source(#src_sym)
#define __analysis_noreturn __declspec(noreturn)
#else
#define __out_data_source(src_sym)
#define __analysis_noreturn
#endif

View file

@ -27,20 +27,21 @@
ULONG
__cdecl
DbgPrint(
IN PCCH Format,
IN ...
_In_z_ _Printf_format_string_ PCSTR Format,
...
);
NTSYSAPI
ULONG
__cdecl
DbgPrintEx(
IN ULONG ComponentId,
IN ULONG Level,
IN PCCH Format,
IN ...
_In_ ULONG ComponentId,
_In_ ULONG Level,
_In_z_ _Printf_format_string_ PCCH Format,
...
);
__analysis_noreturn
NTSYSAPI
VOID
NTAPI
@ -107,7 +108,7 @@ RtlAssert(
#define WARN_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_WARNING_LEVEL, "(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
#define TRACE_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_TRACE_LEVEL, "(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
#define INFO_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL, "(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
#define ERR__(ch, fmt, ...) DbgPrintEx(ch, DPFLTR_ERROR_LEVEL, "(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
#define WARN__(ch, fmt, ...) DbgPrintEx(ch, DPFLTR_WARNING_LEVEL, "(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
#define TRACE__(ch, fmt, ...) DbgPrintEx(ch, DPFLTR_TRACE_LEVEL, "(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
@ -124,7 +125,7 @@ RtlAssert(
#define WARN_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
#define TRACE_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
#define INFO_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
#define ERR__(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
#define WARN__(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
#define TRACE__(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)

View file

@ -109,9 +109,8 @@ ProbeArrayForRead(IN const VOID *ArrayPtr,
}
/* Probe the array */
ProbeForRead(ArrayPtr,
ArraySize,
Alignment);
_PRAGMA_WARNING_SUPPRESS(28125) /* Must be inside __try / __except block */
ProbeForRead(ArrayPtr, ArraySize, Alignment);
}
static __inline
@ -131,9 +130,8 @@ ProbeArrayForWrite(IN OUT PVOID ArrayPtr,
}
/* Probe the array */
ProbeForWrite(ArrayPtr,
ArraySize,
Alignment);
_PRAGMA_WARNING_SUPPRESS(28125) /* Must be inside __try / __except block */
ProbeForWrite(ArrayPtr, ArraySize, Alignment);
}
#endif /* _WIN32K_ */