[PATCH] D19639: AMDGPU: Fix a gcc warning

Nicolai Hähnle via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 27 16:16:56 PDT 2016


nhaehnle created this revision.
nhaehnle added reviewers: arsenm, tstellarAMD, artem.tamazov.
nhaehnle added a subscriber: llvm-commits.
Herald added a subscriber: arsenm.

.../AMDGPUAsmParser.cpp:1703:12: warning: suggest explicit braces to avoid
                                          ambiguous ‘else’ [-Wparentheses]
         if (HwRegCode < 0 || HwRegCode > 63)
            ^

Seems like a good idea even without the warning.

http://reviews.llvm.org/D19639

Files:
  lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp

Index: lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
===================================================================
--- lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
+++ lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
@@ -1700,11 +1700,12 @@
         // HwRegCode (6) [5:0]
         // Offset (5) [10:6]
         // WidthMinusOne (5) [15:11]
-        if (HwRegCode < 0 || HwRegCode > 63)
+        if (HwRegCode < 0 || HwRegCode > 63) {
           if (IsIdentifier)
             Error(S, "invalid symbolic name of hardware register");
           else
             Error(S, "invalid code of hardware register: only 6-bit values are legal");
+        }
         if (Offset < 0 || Offset > 31)
           Error(S, "invalid bit offset: only 5-bit values are legal");
         if (Width < 1 || Width > 32)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19639.55350.patch
Type: text/x-patch
Size: 809 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160427/1dc22a1d/attachment.bin>


More information about the llvm-commits mailing list