Skip to content

WinAdapter.h is not compilable under Clang on Linux #7248

Closed
@Svenny

Description

@Svenny

Description
Getting a bunch of errors like this:

In file included from .../dxc/dxcapi.h:36:
.../dxc/WinAdapter.h:572:33: error: expected parameter declarator
  572 | CROSS_PLATFORM_UUIDOF(IUnknown, "00000000-0000-0000-C000-000000000046")
      |                                 ^
.../dxc/WinAdapter.h:572:33: error: expected ')'
.../dxc/WinAdapter.h:572:1: note: to match this '('
  572 | CROSS_PLATFORM_UUIDOF(IUnknown, "00000000-0000-0000-C000-000000000046")
      | ^
.../dxc/WinAdapter.h:552:25: note: expanded from macro 'CROSS_PLATFORM_UUIDOF'
  552 |   struct __declspec(uuid(spec)) interface;
      |                         ^
.../dxc/WinAdapter.h:572:23: error: expected function body after function declarator
  572 | CROSS_PLATFORM_UUIDOF(IUnknown, "00000000-0000-0000-C000-000000000046")
      |                       ^
.../dxc/WinAdapter.h:579:36: error: 'Q' does not refer to a value
  579 |     return QueryInterface(__uuidof(Q), (void **)pp);
      |                                    ^
.../dxc/WinAdapter.h:578:19: note: declared here
  578 |   template <class Q> HRESULT QueryInterface(Q **pp) {
      |                   ^

This part of the header is incorrect:

// If it is GCC, there is no UUID support and we must emulate it.
#ifndef __clang__
#define __EMULATE_UUID 1
#endif // __clang__

Maybe UUID-related extensions were accepted in old versions of Clang even on Linux without -fms-extensions, but with recent ones they are not. This check must be removed to always emulate UUID on Linux.

Steps to Reproduce
One-line reproducer on godbolt

Environment

  • DXC version: any
  • Host Operating System: any Linux with Clang compiler

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug, regression, crashneeds-triageAwaiting triage

    Type

    No type

    Projects

    Status

    Triaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions