[PATCH] [clang] Replacing asserts with static_asserts where appropriate

David Blaikie dblaikie at gmail.com
Sat Mar 14 11:42:11 PDT 2015


LGTM, please commit.

On Sat, Mar 14, 2015 at 11:11 AM, Szabolcs Sipos <
szabolcs.sipos at ericsson.com> wrote:

> Hi alexfh,
>
> This patch consists of the suggestions of clang-tidy/misc-static-assert
> check.
>
> http://reviews.llvm.org/D8344
>
> Files:
>   lib/Sema/SemaChecking.cpp
>
> Index: lib/Sema/SemaChecking.cpp
> ===================================================================
> --- lib/Sema/SemaChecking.cpp
> +++ lib/Sema/SemaChecking.cpp
> @@ -1305,9 +1305,10 @@
>    //   M is C if C is an integer, and ptrdiff_t if C is a pointer, and
>    //   the int parameters are for orderings.
>
> -  assert(AtomicExpr::AO__c11_atomic_init == 0 &&
> -         AtomicExpr::AO__c11_atomic_fetch_xor + 1 ==
> AtomicExpr::AO__atomic_load
> -         && "need to update code for modified C11 atomics");
> +  static_assert(AtomicExpr::AO__c11_atomic_init == 0 &&
> +                    AtomicExpr::AO__c11_atomic_fetch_xor + 1 ==
> +                        AtomicExpr::AO__atomic_load,
> +                "need to update code for modified C11 atomics");
>    bool IsC11 = Op >= AtomicExpr::AO__c11_atomic_init &&
>                 Op <= AtomicExpr::AO__c11_atomic_fetch_xor;
>    bool IsN = Op == AtomicExpr::AO__atomic_load_n ||
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150314/74f6628a/attachment.html>


More information about the cfe-commits mailing list