Skip to content

Commit

Permalink
Fix more SAL errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
tpn committed Dec 2, 2022
1 parent a53db74 commit 38a9a34
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
29 changes: 25 additions & 4 deletions include/PerfectHash.h
Original file line number Diff line number Diff line change
Expand Up @@ -4073,17 +4073,38 @@ IsValidPerfectHashEnumId(

#define PH_BREAK() __debugbreak()

//
// Helper inline that decorates RaiseException() with _Analysis_noreturn_,
// which we need for SAL to grok our PH_RAISE() calls correctly.
//

_Analysis_noreturn_
FORCEINLINE
VOID
PhRaiseException(
_In_ DWORD dwExceptionCode,
_In_ DWORD dwExceptionFlags,
_In_ DWORD nNumberOfArguments,
_In_reads_opt_(nNumberOfArguments) CONST ULONG_PTR* lpArguments
)
{
RaiseException(dwExceptionCode,
dwExceptionFlags,
nNumberOfArguments,
lpArguments);
}

//
// Helper macro for raising non-continuable exceptions.
//

#ifdef _DEBUG
#define PH_RAISE(Result) \
__debugbreak(); \
RaiseException((DWORD)Result, EXCEPTION_NONCONTINUABLE, 0, NULL)
#define PH_RAISE(Result) \
__debugbreak(); \
PhRaiseException((DWORD)Result, EXCEPTION_NONCONTINUABLE, 0, NULL)
#else
#define PH_RAISE(Result) \
RaiseException((DWORD)Result, EXCEPTION_NONCONTINUABLE, 0, NULL)
PhRaiseException((DWORD)Result, EXCEPTION_NONCONTINUABLE, 0, NULL)
#endif

//
Expand Down
2 changes: 0 additions & 2 deletions src/PerfectHash/PerfectHashConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ GetFileWorkItemStreamName(
}

FORCEINLINE
_Must_inspect_result_
_Success_(return != 0)
PCUNICODE_STRING
GetFileWorkItemBaseName(
Expand All @@ -481,7 +480,6 @@ GetFileWorkItemBaseName(
}

FORCEINLINE
_Must_inspect_result_
_Success_(return != 0)
PCUNICODE_STRING
GetFileWorkItemExtension(
Expand Down

0 comments on commit 38a9a34

Please sign in to comment.