Skip to content

[SR-1101] invalid application of 'typeof' to bit-field when compiled with Clang 3.9 #749

@swift-ci

Description

@swift-ci
Previous ID SR-1101
Radar None
Original Reporter vivkong (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Linux on System z

Additional Detail from JIRA
Votes 0
Component/s libdispatch
Labels Bug
Assignee dgrove-oss (JIRA)
Priority Medium

md5: a7951153e57029c0fb082e9d3b092d9d

Issue Description:

Trying to compile libdispatch using Clang 3.9 (trunk) and ran into these errors:

In file included from allocator.c:21:
In file included from ./internal.h:824:
./inline_internal.h:500:2: error: invalid application of 'typeof' to bit-field
        dispatch_assert(dq->dq_is_thread_bound);
        ^
./internal.h:401:10: note: expanded from macro 'dispatch_assert'
                        typeof(e) _e = fastpath(e); /* always eval 'e' */ \
                              ^
queue.c:3071:6: error: invalid application of 'typeof' to bit-field
        if (slowpath(dq->dq_is_thread_bound) ||
            ^
./internal.h:320:29: note: expanded from macro 'slowpath'
#define slowpath(x) ((typeof(x))__builtin_expect((long)(x), 0l))
source.c:624:2: error: invalid application of 'typeof' to bit-field
        dispatch_assert_zero(ds->ds_is_installed);
        ^
./internal.h:423:10: note: expanded from macro 'dispatch_assert_zero'
                        typeof(e) _e = slowpath(e); /* always eval 'e' */ \
                              ^
source.c:624:2: error: invalid application of 'typeof' to bit-field
./internal.h:423:19: note: expanded from macro 'dispatch_assert_zero'
                        typeof(e) _e = slowpath(e); /* always eval 'e' */ \
                                       ^
./internal.h:320:29: note: expanded from macro 'slowpath'
#define slowpath(x) ((typeof(x))__builtin_expect((long)(x), 0l))
                            ^

We need to use Clang 3.9 as we encountered some bugs in Clang 3.6 that has been fixed in trunk. The restriction on applying typeof to a bit-field was added last November:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20151109/142911.html

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions