Open llvmbot opened 8 years ago
I think Clang should just parse SAL and ignore so user could use Clang as drop-in replacement for MSVC.
Is this a feature request to leverage SAL for better static analysis, or to parse and ignore SAL so that normal compilation can occur?
Extended Description
This report is about MSVC feature Source-code annotation language which provides a set of annotations to describe how a function uses its parameters, for example, the assumptions it makes about them and the guarantees it makes on finishing. So clang does not support this feature
====================ENVIRONMENT================== OS: Windows Version: trunk
=================SMALL REPRODUCER====================== typedef unsigned short wchar_t; [source_annotation_attribute( SA_All )] struct AnnotesAttribute { wchar_t Name; wchar_t p1; }; typedef struct AnnotesAttribute SAL_annotes; typedef struct _XSTATE_CONTEXT {
ength)")] int A;
}; =================ERROR==============================
test.c:12:5: error: type name requires a specifier or qualifier [SAL_annotes(Name="SAL_null", p1="maybe")] [SALannotes(Name="SAL... ^ test.c:12:6: error: unexpected type name 'SAL_annotes': expected expression [SAL_annotes(Name="SAL_null", p1="maybe")] [SALannotes(Name="SAL... ^ test.c:12:18: error: use of undeclared identifier 'Name' [SAL_annotes(Name="SAL_null", p1="maybe")] [SALannotes(Name="SAL... ^ test.c:12:35: error: use of undeclared identifier 'p1' [SAL_annotes(Name="SAL_null", p1="__maybe")] [SALannotes(Name="SAL... ^ test.c:12:51: error: unexpected type name 'SAL_annotes': expected expression [SAL_annotes(Name="SAL_null", p1="maybe")] [SALannotes(Name="SAL... ^ test.c:12:63: error: use of undeclared identifier 'Name' [SAL_annotes(Name="SAL_null", p1="maybe")] [SALannotes(Name="SAL... ^ test.c:12:86: error: use of undeclared identifier 'p1' ...p1="maybe")] [SAL_annotes(Name="SAL_writableTo", p1="byteCount(Length)... ^ test.c:12:111: error: expected member name or ';' after declaration specifiers ...[SAL_annotes(Name="SAL_writableTo", p1="byteCount(Length)")] int Area; ^ test.c:12:110: error: expected ';' at end of declaration list ...[SAL_annotes(Name="SAL_writableTo", p1="byteCount(Length)")] int Area; ^ ;
============================================== Egor Khrulev Software Engineer Intel Compiler Team