Skip to content

Commit 0a77580

Browse files
committed
Silence VS2019 warnings
1 parent 98f5b4a commit 0a77580

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

gfx/include/dxsdk/dxsdk_sal_compat.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,24 @@
374374
#endif
375375

376376
/* --- SAL 2 misc ------------------------------------------------------ */
377+
/* _Inexpressible_(s) marks an annotation size expression that the
378+
* static analyser cannot easily evaluate; on a real SAL implementation
379+
* the SDK consumes `s` inside its annotation metadata. When the SDK's
380+
* <sal.h> is present and active (modern MSVC), _Inexpressible_ is
381+
* defined elsewhere only under _PREFAST_ -- so for normal compilation
382+
* the SDK leaves it undefined and falls back to whatever the
383+
* environment provides. If we stub it to empty, the argument is
384+
* discarded, and any enclosing function-like macro receives an empty
385+
* argument list -- triggering C4003 on MSVC for sites like
386+
* _In_reads_opt_(_Inexpressible_(p->q != 0))
387+
* because the SDK's _In_reads_opt_(size) ultimately invokes
388+
* _Pre_opt_count_(size), which does not accept zero arguments.
389+
*
390+
* Defining the stub as `(s)` (the parenthesised expression) keeps the
391+
* token stream non-empty for any enclosing macro and parses as a valid
392+
* size expression. */
377393
#ifndef _Inexpressible_
378-
#define _Inexpressible_(s)
394+
#define _Inexpressible_(s) (s)
379395
#endif
380396
#ifndef _Use_decl_annotations_
381397
#define _Use_decl_annotations_

0 commit comments

Comments
 (0)