From a74560ebeb9e088e410139595a6ca74f6720b502 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Mon, 20 Mar 2017 13:31:28 +0000 Subject: [PATCH] re PR sanitizer/80063 (gcc/asan.c: PVS-Studio: Incorrect Block Delimitation (CWE-483)) PR sanitizer/80063 * asan.c (DEF_SANITIZER_BUILTIN): Use do { } while (0). From-SVN: r246278 --- gcc/ChangeLog | 5 +++++ gcc/asan.c | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f8b56a2807f..90c85563214 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-03-20 Marek Polacek + + PR sanitizer/80063 + * asan.c (DEF_SANITIZER_BUILTIN): Use do { } while (0). + 2017-03-20 Richard Biener PR tree-optimization/80113 diff --git a/gcc/asan.c b/gcc/asan.c index edcc6ea5a91..a13679d030f 100644 --- a/gcc/asan.c +++ b/gcc/asan.c @@ -2567,10 +2567,12 @@ initialize_sanitizer_builtins (void) #define DEF_BUILTIN_STUB(ENUM, NAME) #undef DEF_SANITIZER_BUILTIN #define DEF_SANITIZER_BUILTIN(ENUM, NAME, TYPE, ATTRS) \ - decl = add_builtin_function ("__builtin_" NAME, TYPE, ENUM, \ - BUILT_IN_NORMAL, NAME, NULL_TREE); \ - set_call_expr_flags (decl, ATTRS); \ - set_builtin_decl (ENUM, decl, true); + do { \ + decl = add_builtin_function ("__builtin_" NAME, TYPE, ENUM, \ + BUILT_IN_NORMAL, NAME, NULL_TREE); \ + set_call_expr_flags (decl, ATTRS); \ + set_builtin_decl (ENUM, decl, true); \ + } while (0); #include "sanitizer.def" -- 2.30.2