clang-cl doesn't support __annotation, TraceLoggingProvider.h |
|
Issue descriptionTraceLoggingProvider.h is a convenient way of emitting ETW events. It uses the __annotation directive (undocumented?) which clang-cl does not support, which complicates the task of supporting ETW events from battor_agent. A sample CL which builds in VC++ but not in clang-cl is here: https://chromium-review.googlesource.com/604810 The output from clang-cl is attached. The settings used were: is_component_build = false is_debug = false target_cpu = "x64" enable_nacl = true treat_warnings_as_errors = false use_goma = true is_win_fastlink = true symbol_level = 2 proprietary_codecs = true ffmpeg_branding = "Chrome"
,
Aug 15 2017
,
Aug 15 2017
It's more than just __annotation, there's also pre-processor incompatibility.
Here's how MSVC expands TRACELOGGING_DEFINE_PROVIDER after formatting:
static void __cdecl _TlgDefineProvider_annotation__Tlgg_hMyComponentProviderProv(
void) {
__annotation(L"_TlgDefineProvider:|"
L"11"
L"|"
L"g_hMyComponentProvider"
L"|"
L"SimpleTraceLoggingProvider");
};
__pragma(execution_character_set(push, "UTF-8"))
__pragma(pack(push, 1)) static struct {
struct _TlgProviderMetadata_t _TlgProv;
char _TlgName[sizeof("SimpleTraceLoggingProvider")];
} const __declspec(allocate(".rdata$zETW2")) __declspec(align(1))
_Tlgg_hMyComponentProviderProv_Meta = {
{_TlgBlobProvider3,
{0x3970f9cf, 0x2c0c, 0x4f11, 0xb1, 0xcc, 0xe3, 0xa1, 0xe9, 0x95, 0x88,
0x33},
sizeof(_Tlgg_hMyComponentProviderProv_Meta) - 1 - 16},
("SimpleTraceLoggingProvider")};
__pragma(pack(pop)) __pragma(execution_character_set(
pop)) static struct _TlgProvider_t _Tlgg_hMyComponentProviderProv = {
0, &_Tlgg_hMyComponentProviderProv_Meta._TlgProv.RemainingSize, 0, 0, 0, 0,
0, &_TlgDefineProvider_annotation__Tlgg_hMyComponentProviderProv};
extern const TraceLoggingHProvider g_hMyComponentProvider =
&_Tlgg_hMyComponentProviderProv;
Here's how clang expands it:
static void __cdecl _TlgDefineProvider_annotation__Tlgg_hMyComponentProviderProv(
void) {
__annotation(L"_TlgDefineProvider:|"
L"11"
L"|"
L"g_hMyComponentProvider"
L"|"
L"SimpleTraceLoggingProvider");
};
_TlgProviderStorage_imp0(_Tlgg_hMyComponentProviderProv,
"SimpleTraceLoggingProvider",
(0x3970f9cf, 0x2c0c, 0x4f11, 0xb1, 0xcc, 0xe3, 0xa1,
0xe9, 0x95, 0x88, 0x33),
1);
extern const TraceLoggingHProvider g_hMyComponentProvider =
&_Tlgg_hMyComponentProviderProv;
"_TlgProviderStorage_imp0" is unexpanded.
,
Sep 26 2017
https://bugs.llvm.org/show_bug.cgi?id=32021 is a better upstream bug. I reduced things a bit more over there.
,
Sep 26 2017
Thanks for the update. I've confirmed that the newest version of clang-cl appears to handle __annotation directives, but the preprocessor incompatibilities are still a problem. |
|
►
Sign in to add a comment |
|
Comment 1 by brucedaw...@chromium.org
, Aug 15 2017The error messages are quite verbose and are best viewed in the try-job output but I'll include some excerpts here: FAILED: obj/tools/battor_agent/battor_agent_lib/battor_agent.obj E:\b\c\goma_client/gomacc.exe ../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe /nologo /showIncludes @obj/tools/battor_agent/battor_agent_lib/battor_agent.obj.rsp /c ../../tools/battor_agent/battor_agent.cc /Foobj/tools/battor_agent/battor_agent_lib/battor_agent.obj /Fd"obj/tools/battor_agent/battor_agent_lib_cc.pdb" ../../tools/battor_agent/battor_agent.cc(33,1): error: use of undeclared identifier '__annotation' TRACELOGGING_DEFINE_PROVIDER( ../../tools/battor_agent/battor_agent.cc(37,6): error: expression result unused [-Werror,-Wunused-value] (0xc58f1405, 0x1112, 0x54dc, 0xad, 0xf1, 0xb8, 0xac, 0xb8, 0xc0, 0x50, 0xec)); ^~~~~~~~~~ It's not clear whether the "result unused" warnings are a side-effect of the lack of support for __annotation or something separate.