File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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_
You can’t perform that action at this time.
0 commit comments