diff mbox series

[1/7,libsanitizer,committed] Remove semicolon after do {} while (0) in macro body

Message ID b76b4cda-b96c-a149-2349-2e3520a1f64c@mentor.com
State New
Headers show
Series [1/7,libsanitizer,committed] Remove semicolon after do {} while (0) in macro body | expand

Commit Message

Tom de Vries Nov. 5, 2017, 10:02 a.m. UTC
Hi,

this removes a semicolon after "do {} while (0)" in several macro bodies 
in libsanitizer. This allows the macros to be used in if-then-elses 
without curly braces.

Committed as obvious.

Thanks,
- Tom

2017-11-02  Tom de Vries  <tom@codesourcery.com>

	PR other/82784
	* asan/asan_poisoning.cc (CHECK_SMALL_REGION): Remove semicolon
	after "do {} while (0)".
	* lsan/lsan_common.cc (LOG_POINTERS, LOG_THREADS): Same.

Signed-off-by: Tom de Vries <tom@codesourcery.com>
---
      libsanitizer/asan/asan_poisoning.cc | 2 +-
      libsanitizer/lsan/lsan_common.cc    | 4 ++--
      2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Jakub Jelinek Nov. 8, 2017, 8:16 a.m. UTC | #1
On Sun, Nov 05, 2017 at 11:02:32AM +0100, Tom de Vries wrote:
> this removes a semicolon after "do {} while (0)" in several macro bodies in
> libsanitizer. This allows the macros to be used in if-then-elses without
> curly braces.
> 
> Committed as obvious.

This is wrong, these files are copied directly from upstream, so if you
want those changes, you'd need to submit it into the LLVM phabricator,
get it approved there.  Otherwise these changes will go away next time
merge from upstream is performed.

> 2017-11-02  Tom de Vries  <tom@codesourcery.com>
> 
> 	PR other/82784
> 	* asan/asan_poisoning.cc (CHECK_SMALL_REGION): Remove semicolon
> 	after "do {} while (0)".
> 	* lsan/lsan_common.cc (LOG_POINTERS, LOG_THREADS): Same.
> 
> Signed-off-by: Tom de Vries <tom@codesourcery.com>
> ---
>      libsanitizer/asan/asan_poisoning.cc | 2 +-
>      libsanitizer/lsan/lsan_common.cc    | 4 ++--
>      2 files changed, 3 insertions(+), 3 deletions(-)

	Jakub
Tom de Vries Nov. 8, 2017, 12:58 p.m. UTC | #2
On 11/08/2017 09:16 AM, Jakub Jelinek wrote:
> On Sun, Nov 05, 2017 at 11:02:32AM +0100, Tom de Vries wrote:
>> this removes a semicolon after "do {} while (0)" in several macro bodies in
>> libsanitizer. This allows the macros to be used in if-then-elses without
>> curly braces.
>>
>> Committed as obvious.
> 
> This is wrong, these files are copied directly from upstream, so if you
> want those changes, you'd need to submit it into the LLVM phabricator,
> get it approved there.  Otherwise these changes will go away next time
> merge from upstream is performed.

Thanks for pointing this out.

Filed:
- https://reviews.llvm.org/D39793
   "[asan] Remove semicolon after do {} while (0)"
- https://reviews.llvm.org/D39794
   "[lsan] Remove semicolon after do {} while (0)"

Thanks,
- Tom
diff mbox series

Patch

diff --git a/libsanitizer/asan/asan_poisoning.cc b/libsanitizer/asan/asan_poisoning.cc
index 15cd8ea..1343dfb 100644
--- a/libsanitizer/asan/asan_poisoning.cc
+++ b/libsanitizer/asan/asan_poisoning.cc
@@ -215,7 +215,7 @@  uptr __asan_region_is_poisoned(uptr beg, uptr size) {
       uptr __bad = __asan_region_is_poisoned(__p, __size);    \
       __asan_report_error(pc, bp, sp, __bad, isWrite, __size, 0);\
     }                                                         \
-  } while (false);                                            \
+  } while (false)
 
 
 extern "C" SANITIZER_INTERFACE_ATTRIBUTE
diff --git a/libsanitizer/lsan/lsan_common.cc b/libsanitizer/lsan/lsan_common.cc
index a3274d5..4afce9d 100644
--- a/libsanitizer/lsan/lsan_common.cc
+++ b/libsanitizer/lsan/lsan_common.cc
@@ -55,12 +55,12 @@  void RegisterLsanFlags(FlagParser *parser, Flags *f) {
 #define LOG_POINTERS(...)                           \
   do {                                              \
     if (flags()->log_pointers) Report(__VA_ARGS__); \
-  } while (0);
+  } while (0)
 
 #define LOG_THREADS(...)                           \
   do {                                             \
     if (flags()->log_threads) Report(__VA_ARGS__); \
-  } while (0);
+  } while (0)
 
 ALIGNED(64) static char suppression_placeholder[sizeof(SuppressionContext)];
 static SuppressionContext *suppression_ctx = nullptr;