layers: Enable Wall and Werror.
diff --git a/layers/device_limits.cpp b/layers/device_limits.cpp
index 1b15819..b11f34c 100644
--- a/layers/device_limits.cpp
+++ b/layers/device_limits.cpp
@@ -97,8 +97,6 @@
 
 static unordered_map<void *, layer_data *> layer_data_map;
 
-static LOADER_PLATFORM_THREAD_ONCE_DECLARATION(g_initOnce);
-
 // TODO : This can be much smarter, using separate locks for separate global data
 static int globalLockInitialized = 0;
 static loader_platform_thread_mutex globalLock;
@@ -558,9 +556,11 @@
                             "Cannot enable in occlusion queries in vkBeginCommandBuffer() and set queryFlags to %d which is not a valid combination of VkQueryControlFlagBits.",
                             pInfo->queryFlags);
     }
+    VkResult result = VK_ERROR_VALIDATION_FAILED_EXT;
     if (!skipCall)
-        return dev_data->device_dispatch_table->BeginCommandBuffer(commandBuffer, pBeginInfo);
-	return VK_ERROR_VALIDATION_FAILED_EXT;
+        result = dev_data->device_dispatch_table->BeginCommandBuffer(
+            commandBuffer, pBeginInfo);
+    return result;
 }
 
 VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue)
@@ -613,7 +613,6 @@
     const VkCopyDescriptorSet  *pDescriptorCopies)
 {
     layer_data* dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
-    VkResult    result   = VK_ERROR_VALIDATION_FAILED_EXT;
     VkBool32    skipCall = VK_FALSE;
 
     for (uint32_t i = 0; i < descriptorWriteCount; i++) {
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp
index d73319e..bac580c 100644
--- a/layers/draw_state.cpp
+++ b/layers/draw_state.cpp
@@ -219,7 +219,6 @@
 // TODO : Do we need to guard access to layer_data_map w/ lock?
 static unordered_map<void*, layer_data*> layer_data_map;
 
-static LOADER_PLATFORM_THREAD_ONCE_DECLARATION(g_initOnce);
 // TODO : This can be much smarter, using separate locks for separate global data
 static int globalLockInitialized = 0;
 static loader_platform_thread_mutex globalLock;
@@ -1362,7 +1361,6 @@
     /* We seem to allow pipeline stages to be specified out of order, so collect and identify them
      * before trying to do anything more: */
     int vertex_stage = get_shader_stage_id(VK_SHADER_STAGE_VERTEX_BIT);
-    int geometry_stage = get_shader_stage_id(VK_SHADER_STAGE_GEOMETRY_BIT);
     int fragment_stage = get_shader_stage_id(VK_SHADER_STAGE_FRAGMENT_BIT);
 
     shader_module **shaders = new shader_module*[fragment_stage + 1];  /* exclude CS */
@@ -1910,9 +1908,10 @@
         case VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET:
             // TODO : Need to understand this case better and make sure code is correct
             return ((VkCopyDescriptorSet*)pUpdateStruct)->descriptorCount;
+        default:
+            return 0;
     }
-
-	return 0;
+    return 0;
 }
 
 // For given Layout Node and binding, return index where that binding begins
@@ -1999,10 +1998,6 @@
     VkBool32 skipCall = VK_FALSE;
     VkWriteDescriptorSet* pWDS = NULL;
     VkCopyDescriptorSet* pCDS = NULL;
-    size_t array_size = 0;
-    size_t base_array_size = 0;
-    size_t total_array_size = 0;
-    size_t baseBuffAddr = 0;
     switch (pUpdate->sType)
     {
         case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET:
@@ -2177,11 +2172,7 @@
 {
     VkBool32 skipCall = VK_FALSE;
     // First verify that for the given Descriptor type, the correct DescriptorInfo data is supplied
-    VkBufferView* pBufferView = NULL;
     const VkSampler* pSampler = NULL;
-    VkImageView* pImageView = NULL;
-    VkImageLayout* pImageLayout = NULL;
-    VkDescriptorBufferInfo* pBufferInfo = NULL;
     VkBool32 immutable = VK_FALSE;
     uint32_t i = 0;
     // For given update type, verify that update contents are correct
@@ -2235,6 +2226,8 @@
                 skipCall |= validateBufferInfo(my_data, &(pWDS->pBufferInfo[i]));
             }
             break;
+        default:
+            break;
     }
     return skipCall;
 }
@@ -2464,10 +2457,7 @@
     while(pShadowUpdate) {
         pFreeUpdate = pShadowUpdate;
         pShadowUpdate = (GENERIC_HEADER*)pShadowUpdate->pNext;
-        uint32_t index = 0;
         VkWriteDescriptorSet * pWDS = NULL;
-        VkCopyDescriptorSet * pCDS = NULL;
-        void** ppToFree = NULL;
         switch (pFreeUpdate->sType)
         {
             case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET:
@@ -2873,7 +2863,6 @@
 static VkBool32 printDSConfig(layer_data* my_data, const VkCommandBuffer cb)
 {
     VkBool32 skipCall = VK_FALSE;
-    char ds_config_str[1024*256] = {0}; // TODO : Currently making this buffer HUGE w/o overrun protection.  Need to be smarter, start smaller, and grow as needed.
     GLOBAL_CB_NODE* pCB = getCBNode(my_data, cb);
     if (pCB && pCB->lastBoundDescriptorSet) {
         SET_NODE* pSet = getSetNode(my_data, pCB->lastBoundDescriptorSet);
@@ -3806,7 +3795,6 @@
 VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator)
 {
     layer_data* dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
-    VkBool32 skip_call = VK_FALSE;
     loader_platform_thread_lock_mutex(&globalLock);
     if (!validateIdleBuffer(dev_data, buffer)) {
         loader_platform_thread_unlock_mutex(&globalLock);
diff --git a/layers/draw_state.h b/layers/draw_state.h
index f815a11..8e8cd2e 100755
--- a/layers/draw_state.h
+++ b/layers/draw_state.h
@@ -319,7 +319,7 @@
                 const uint32_t att = subpass->pColorAttachments[j].attachment;
                 const VkFormat format = pCreateInfo->pAttachments[att].format;
 
-                color_formats.push_back(pCreateInfo->pAttachments[att].format);
+                color_formats.push_back(format);
             }
 
             subpassColorFormats.push_back(color_formats);
@@ -412,10 +412,11 @@
     vector<uint32_t>           maxDescriptorTypeCount; // max # of descriptors of each type in this pool
     vector<uint32_t>           availableDescriptorTypeCount; // available # of descriptors of each type in this pool
 
-    _DESCRIPTOR_POOL_NODE(const VkDescriptorPool pool, const VkDescriptorPoolCreateInfo* pCreateInfo) :
-    pool(pool), createInfo(*pCreateInfo), maxSets(pCreateInfo->maxSets), pSets(NULL),
-    maxDescriptorTypeCount(VK_DESCRIPTOR_TYPE_RANGE_SIZE), availableDescriptorTypeCount(VK_DESCRIPTOR_TYPE_RANGE_SIZE)
-    {
+    _DESCRIPTOR_POOL_NODE(const VkDescriptorPool pool,
+                          const VkDescriptorPoolCreateInfo *pCreateInfo)
+        : pool(pool), maxSets(pCreateInfo->maxSets), createInfo(*pCreateInfo),
+          pSets(NULL), maxDescriptorTypeCount(VK_DESCRIPTOR_TYPE_RANGE_SIZE),
+          availableDescriptorTypeCount(VK_DESCRIPTOR_TYPE_RANGE_SIZE) {
         if (createInfo.poolSizeCount) { // Shadow type struct from ptr into local struct
             size_t poolSizeCountSize = createInfo.poolSizeCount * sizeof(VkDescriptorPoolSize);
             createInfo.pPoolSizes = new VkDescriptorPoolSize[poolSizeCountSize];
diff --git a/layers/image.cpp b/layers/image.cpp
index a40b2f2..62c4284 100644
--- a/layers/image.cpp
+++ b/layers/image.cpp
@@ -343,7 +343,7 @@
 {
     VkBool32                skipCall              = VK_FALSE;
     VkResult                result                = VK_ERROR_VALIDATION_FAILED_EXT;
-    VkImageFormatProperties ImageFormatProperties = {0};
+    VkImageFormatProperties ImageFormatProperties;
 
     layer_data       *device_data    = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
     VkPhysicalDevice  physicalDevice = device_data->physicalDevice;
diff --git a/layers/mem_tracker.cpp b/layers/mem_tracker.cpp
index 196596a..a7e8c29 100644
--- a/layers/mem_tracker.cpp
+++ b/layers/mem_tracker.cpp
@@ -52,7 +52,6 @@
 #include "vk_layer_table.h"
 #include "vk_layer_data.h"
 #include "vk_layer_logging.h"
-static LOADER_PLATFORM_THREAD_ONCE_DECLARATION(g_initOnce);
 
 // WSI Image Objects bypass usual Image Object creation methods.  A special Memory
 // Object value will be used to identify them internally.
@@ -127,6 +126,8 @@
                 return &(*it).second;
             break;
         }
+        default:
+            break;
     }
     return retValue;
 }
@@ -229,6 +230,8 @@
             pCI->mem = mem;
             break;
         }
+        default:
+            break;
     }
 }
 
@@ -270,6 +273,8 @@
                 const_cast<VkSwapchainCreateInfoKHR*>(static_cast<const VkSwapchainCreateInfoKHR *>(pCreateInfo))->imageUsage;
             break;
         }
+        default:
+            break;
     }
 }
 
@@ -898,7 +903,6 @@
                 pInfo->refCount++;
             }
             // Need to set mem binding for this object
-            MT_MEM_OBJ_INFO* pPrevBinding = get_mem_obj_info(my_data, pObjBindInfo->mem);
             pObjBindInfo->mem = mem;
         }
     }
diff --git a/layers/object_tracker.h b/layers/object_tracker.h
index 1f2b41a..33202e9 100644
--- a/layers/object_tracker.h
+++ b/layers/object_tracker.h
@@ -495,24 +495,6 @@
 extern unordered_map<uint64_t, OBJTRACK_NODE*> VkSwapchainKHRMap;
 extern unordered_map<uint64_t, OBJTRACK_NODE*> VkSurfaceKHRMap;
 
-static VkBool32 set_status(VkQueue dispatchable_object, VkFence object, VkDebugReportObjectTypeEXT objType, ObjectStatusFlags status_flag)
-{
-    VkBool32 skipCall = VK_FALSE;
-    if (object != VK_NULL_HANDLE) {
-        if (VkFenceMap.find((uint64_t)(object)) != VkFenceMap.end()) {
-            OBJTRACK_NODE* pNode = VkFenceMap[(uint64_t)(object)];
-            pNode->status |= status_flag;
-        }
-        else {
-            // If we do not find it print an error
-            skipCall |= log_msg(mdd(dispatchable_object), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT) 0, (uint64_t) object, __LINE__, OBJTRACK_NONE, "OBJTRACK",
-                "Unable to set status for non-existent object 0x%" PRIxLEAST64 " of %s type",
-                (uint64_t)(object), string_VkDebugReportObjectTypeEXT(objType));
-        }
-    }
-    return skipCall;
-}
-
 static void create_physical_device(VkInstance dispatchable_object, VkPhysicalDevice vkObj, VkDebugReportObjectTypeEXT objType)
 {
     log_msg(mdd(dispatchable_object), VK_DEBUG_REPORT_INFO_BIT_EXT, objType, reinterpret_cast<uint64_t>(vkObj), __LINE__, OBJTRACK_NONE, "OBJTRACK",
diff --git a/layers/param_checker.cpp b/layers/param_checker.cpp
index 7f08594..3aa0f56 100644
--- a/layers/param_checker.cpp
+++ b/layers/param_checker.cpp
@@ -4053,10 +4053,9 @@
         "vkCreateGraphicsPipelines parameter, VkStructureType pCreateInfos->pColorBlendState->sType, is an invalid enumerator");
         return false;
     }
-    if(pCreateInfos->pColorBlendState->logicOpEnable == VK_TRUE &&
-        pCreateInfos->pColorBlendState->logicOp < VK_LOGIC_OP_BEGIN_RANGE ||
-        pCreateInfos->pColorBlendState->logicOp > VK_LOGIC_OP_END_RANGE)
-    {
+    if (pCreateInfos->pColorBlendState->logicOpEnable == VK_TRUE &&
+        (pCreateInfos->pColorBlendState->logicOp < VK_LOGIC_OP_BEGIN_RANGE ||
+         pCreateInfos->pColorBlendState->logicOp > VK_LOGIC_OP_END_RANGE)) {
         log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK",
         "vkCreateGraphicsPipelines parameter, VkLogicOp pCreateInfos->pColorBlendState->logicOp, is an unrecognized enumerator");
         return false;
diff --git a/layers/swapchain.cpp b/layers/swapchain.cpp
index de9fc77..1e233e9 100644
--- a/layers/swapchain.cpp
+++ b/layers/swapchain.cpp
@@ -1044,7 +1044,6 @@
     VkBool32 skipCall = VK_FALSE;
     layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
     loader_platform_thread_lock_mutex(&globalLock);
-    SwpInstance *pInstance = &(my_data->instanceMap[instance]);
     SwpSurface *pSurface = &my_data->surfaceMap[surface];
 
     // Regardless of skipCall value, do some internal cleanup:
@@ -1502,7 +1501,6 @@
 {
 // TODO: Validate cases of re-creating a swapchain (the current code
 // assumes a new swapchain is being created).
-    VkResult result = VK_SUCCESS;
     VkBool32 skipCall = VK_FALSE;
     layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
     char fn[] = "vkCreateSwapchainKHR";
@@ -2207,7 +2205,6 @@
     for (uint32_t i = 0;
          pPresentInfo && (i < pPresentInfo->swapchainCount);
          i++) {
-        uint32_t swapchainCount = pPresentInfo->swapchainCount;
         uint32_t index = pPresentInfo->pImageIndices[i];
         SwpSwapchain *pSwapchain =
             &my_data->swapchainMap[pPresentInfo->pSwapchains[i]];
diff --git a/layers/vk_layer_table.cpp b/layers/vk_layer_table.cpp
index 3cee6dd..9277a8d 100644
--- a/layers/vk_layer_table.cpp
+++ b/layers/vk_layer_table.cpp
@@ -1,6 +1,7 @@
 /* Copyright (c) 2015-2016 The Khronos Group Inc.
  * Copyright (c) 2015-2016 Valve Corporation
  * Copyright (c) 2015-2016 LunarG, Inc.
+ * Copyright (c) 2015-2016 Google, Inc.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and/or associated documentation files (the "Materials"), to
@@ -63,8 +64,8 @@
 
 void destroy_dispatch_table(device_table_map &map, dispatch_key key)
 {
-    device_table_map::const_iterator it = map.find((void *) key);
 #if DISPATCH_MAP_DEBUG
+    device_table_map::const_iterator it = map.find((void *)key);
     if (it != map.end()) {
         fprintf(stderr, "destroy device dispatch_table: map: %p, key: %p, table: %p\n", &map, key, it->second);
     } else {
@@ -77,8 +78,8 @@
 
 void destroy_dispatch_table(instance_table_map &map, dispatch_key key)
 {
-    instance_table_map::const_iterator it = map.find((void *) key);
 #if DISPATCH_MAP_DEBUG
+    instance_table_map::const_iterator it = map.find((void *)key);
     if (it != map.end()) {
         fprintf(stderr, "destroy instance dispatch_table: map: %p, key: %p, table: %p\n", &map, key, it->second);
     } else {
diff --git a/layers/vk_layer_utils.cpp b/layers/vk_layer_utils.cpp
index 59c4222..e1612fd 100644
--- a/layers/vk_layer_utils.cpp
+++ b/layers/vk_layer_utils.cpp
@@ -613,7 +613,6 @@
 VkStringErrorFlags vk_string_validate(const int max_length, const char *utf8)
 {
     VkStringErrorFlags result = VK_STRING_ERROR_NONE;
-    int                code;
     int                num_char_bytes;
     int                i,j;