Replace MOZ_STATIC_ASSERT with static_assert in C code (and remove MOZ_STATIC_ASSERT)
Categories
(Core :: MFBT, task, P3)
Tracking
()
People
(Reporter: cpeterson, Assigned: cpeterson)
References
Details
Attachments
(2 files)
MOZ_STATIC_ASSERT
is currently used only in C code, specifically in the libmar library:
static_assert is available in both C++11 and C11. While C++11's static_assert is a keyword, C11's static_assert is a macro defined in assert.h (that expands to the C11 keywoard _Static_assert). libar's header files are included in both C and C++ code, so we must #include assert.h to use static_assert.
https://en.cppreference.com/w/c/language/_Static_assert
https://en.cppreference.com/w/cpp/language/static_assert
Assignee | ||
Comment 1•4 years ago
|
||
static_assert is available in both C++11 and C11. While C++11's static_assert is a keyword, C11's static_assert is a macro defined in assert.h (that expands to the C11 keywoard _Static_assert). libar's header files are included in both C and C++ code, so we must #include assert.h to use static_assert.
Assignee | ||
Comment 2•4 years ago
|
||
Depends on D83736
Assignee | ||
Comment 3•4 years ago
|
||
Replacing MOZ_STATIC_ASSERT
with C11's static_assert
requires compiling our C code as C11 instead of C99 (bug 1653182).
Green Try build:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=bbb5b1d93d652d655d0e95691d23dc9aebf35581
Assignee | ||
Updated•4 years ago
|
Comment 5•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/14853017df35
https://hg.mozilla.org/mozilla-central/rev/73c606e0647d
Description
•