Fix about a dozen compile warnings

Summary:
It fixes the following compile warnings:
1. '0' flag ignored with precision and ‘%d’ gnu_printf format
2. enumeral and non-enumeral type in conditional expression
3. format ‘%d’ expects argument of type ‘int’, but argument 4 has type ...
4. enumeration value ‘...’ not handled in switch
5. cast from type ‘const uint64_t* {aka ...}’ to type ‘int64_t* {aka ...}’ casts away qualifiers
6. extra ‘;’
7. comparison between signed and unsigned integer expressions
8. variable ‘register_operand’ set but not used
9. control reaches end of non-void function

Reviewers: jingham, emaste, zturner, clayborg

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D24331

llvm-svn: 281191
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 42e6dbc..4f18715 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1938,9 +1938,9 @@
         sect_type = eSectionTypeGoSymtab;
 
       const uint32_t permissions =
-          ((header.sh_flags & SHF_ALLOC) ? ePermissionsReadable : 0) |
-          ((header.sh_flags & SHF_WRITE) ? ePermissionsWritable : 0) |
-          ((header.sh_flags & SHF_EXECINSTR) ? ePermissionsExecutable : 0);
+          ((header.sh_flags & SHF_ALLOC) ? ePermissionsReadable : 0u) |
+          ((header.sh_flags & SHF_WRITE) ? ePermissionsWritable : 0u) |
+          ((header.sh_flags & SHF_EXECINSTR) ? ePermissionsExecutable : 0u);
       switch (header.sh_type) {
       case SHT_SYMTAB:
         assert(sect_type == eSectionTypeOther);
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 69ff351..d243803 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1458,13 +1458,13 @@
             }
           }
           if (m_data.GetU32(&offset, &load_cmd.maxprot, 4)) {
-            const uint32_t segment_permissions =
-                ((load_cmd.initprot & VM_PROT_READ) ? ePermissionsReadable
-                                                    : 0) |
-                ((load_cmd.initprot & VM_PROT_WRITE) ? ePermissionsWritable
-                                                     : 0) |
-                ((load_cmd.initprot & VM_PROT_EXECUTE) ? ePermissionsExecutable
-                                                       : 0);
+            uint32_t segment_permissions = 0;
+            if (load_cmd.initprot & VM_PROT_READ)
+              segment_permissions |= ePermissionsReadable;
+            if (load_cmd.initprot & VM_PROT_WRITE)
+              segment_permissions |= ePermissionsWritable;
+            if (load_cmd.initprot & VM_PROT_EXECUTE)
+              segment_permissions |= ePermissionsExecutable;
 
             const bool segment_is_encrypted =
                 (load_cmd.flags & SG_PROTECTED_VERSION_1) != 0;
@@ -2621,8 +2621,7 @@
           "/System/Library/Caches/com.apple.dyld/", /* IPHONE_DYLD_SHARED_CACHE_DIR
                                                        */
           "dyld_shared_cache_", /* DYLD_SHARED_CACHE_BASE_NAME */
-          header_arch.GetArchitectureName(),
-          ".development");
+          header_arch.GetArchitectureName(), ".development");
 
       FileSpec dsc_nondevelopment_filespec(dsc_path, false);
       FileSpec dsc_development_filespec(dsc_path_development, false);