Project

General

Profile

Actions

Bug #13894

closed

compile time assertions need more uniqueness

Added by Rich Lowe 11 months ago. Updated 11 months ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
zfs - Zettabyte File System
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

At present, we do compile time assertions like this:

#define    CTASSERT(x)        _CTASSERT(x, __LINE__)
#define    _CTASSERT(x, y)        __CTASSERT(x, y)
#define    __CTASSERT(x, y) \
    typedef char __compile_time_assertion__ ## y [(x) ? 1 : -1] __unused

Which appeared with the OpenZFS crypto checksum support.

Unfortunately, this means that only the source line is used to provide uniqueness. One cannot have two assertions at the same line number in the same compilation unit, which includes any headers.


Related issues

Related to illumos gate - Feature #14454: sys/debug.h: CTASSERT should use _Static_assertClosedToomas Soome

Actions
Is duplicate of illumos gate - Bug #12994: CTASSERT should not clash on same line numNew

Actions
Actions #1

Updated by Rich Lowe 11 months ago

  • Status changed from New to Duplicate
Actions #2

Updated by Rich Lowe 11 months ago

  • Is duplicate of Bug #12994: CTASSERT should not clash on same line num added
Actions #3

Updated by Patrick Mooney 4 months ago

  • Related to Feature #14454: sys/debug.h: CTASSERT should use _Static_assert added
Actions

Also available in: Atom PDF