Kill the spvCheckReturn macro.

diff --git a/source/validate.cpp b/source/validate.cpp
index 0c62937..4676aca 100644
--- a/source/validate.cpp
+++ b/source/validate.cpp
@@ -68,9 +68,10 @@
     const spv_ext_inst_table extInstTable, const ValidationState_t& state,
     spv_position position, spv_diagnostic* pDiagnostic) {
   position->index = SPV_INDEX_INSTRUCTION;
-  spvCheckReturn(spvValidateInstructionIDs(pInsts, count, opcodeTable,
-                                           operandTable, extInstTable, state,
-                                           position, pDiagnostic));
+  if (auto error =
+          spvValidateInstructionIDs(pInsts, count, opcodeTable, operandTable,
+                                    extInstTable, state, position, pDiagnostic))
+    return error;
   return SPV_SUCCESS;
 }
 
@@ -132,10 +133,10 @@
 
   DebugInstructionPass(_, inst);
   // TODO(umar): Perform data rules pass
-  spvCheckReturn(IdPass(_, inst));
-  spvCheckReturn(ModuleLayoutPass(_, inst));
-  spvCheckReturn(CfgPass(_, inst));
-  spvCheckReturn(InstructionPass(_, inst));
+  if (auto error = IdPass(_, inst)) return error;
+  if (auto error = ModuleLayoutPass(_, inst)) return error;
+  if (auto error = CfgPass(_, inst)) return error;
+  if (auto error = InstructionPass(_, inst)) return error;
 
   return SPV_SUCCESS;
 }
@@ -166,7 +167,9 @@
 #ifdef __clang__
 #define UNUSED(func) [[gnu::unused]] func
 #elif defined(__GNUC__)
-#define UNUSED(func) func __attribute__((unused)); func
+#define UNUSED(func)            \
+  func __attribute__((unused)); \
+  func
 #elif defined(_MSC_VER)
 #define UNUSED(func) func
 #endif
@@ -204,9 +207,10 @@
   // NOTE: Parse the module and perform inline validation checks. These
   // checks do not require the the knowledge of the whole module.
   ValidationState_t vstate(pDiagnostic, context);
-  spvCheckReturn(spvBinaryParse(context, &vstate, binary->code,
-                                binary->wordCount, setHeader,
-                                ProcessInstruction, pDiagnostic));
+  if (auto error =
+          spvBinaryParse(context, &vstate, binary->code, binary->wordCount,
+                         setHeader, ProcessInstruction, pDiagnostic))
+    return error;
 
   if (vstate.in_function_body())
     return vstate.diag(SPV_ERROR_INVALID_LAYOUT)
@@ -230,9 +234,9 @@
 
   // CFG checks are performed after the binary has been parsed
   // and the CFGPass has collected information about the control flow
-  spvCheckReturn(PerformCfgChecks(vstate));
-  spvCheckReturn(UpdateIdUse(vstate));
-  spvCheckReturn(CheckIdDefinitionDominateUse(vstate));
+  if (auto error = PerformCfgChecks(vstate)) return error;
+  if (auto error = UpdateIdUse(vstate)) return error;
+  if (auto error = CheckIdDefinitionDominateUse(vstate)) return error;
 
   // NOTE: Copy each instruction for easier processing
   std::vector<spv_instruction_t> instructions;
@@ -250,10 +254,8 @@
   }
 
   position.index = SPV_INDEX_INSTRUCTION;
-  spvCheckReturn(spvValidateIDs(instructions.data(), instructions.size(),
-                                context->opcode_table, context->operand_table,
-                                context->ext_inst_table, vstate, &position,
-                                pDiagnostic));
-
-  return SPV_SUCCESS;
+  return spvValidateIDs(instructions.data(), instructions.size(),
+                        context->opcode_table, context->operand_table,
+                        context->ext_inst_table, vstate, &position,
+                        pDiagnostic);
 }
diff --git a/source/validate.h b/source/validate.h
index b8ba662..3123c40 100644
--- a/source/validate.h
+++ b/source/validate.h
@@ -196,7 +196,4 @@
                             const spv_ext_inst_table extInstTable,
                             spv_position position, spv_diagnostic* pDiagnostic);
 
-#define spvCheckReturn(expression) \
-  if (spv_result_t error = (expression)) return error;
-
 #endif  // LIBSPIRV_VALIDATE_H_
diff --git a/source/validate_cfg.cpp b/source/validate_cfg.cpp
index 66a9b94..988256a 100644
--- a/source/validate_cfg.cpp
+++ b/source/validate_cfg.cpp
@@ -416,11 +416,10 @@
     auto ignore_edge = [](cbb_ptr, cbb_ptr) {};
     if (!function.ordered_blocks().empty()) {
       /// calculate dominators
-      DepthFirstTraversal(function.first_block(),
-                          function.AugmentedCFGSuccessorsFunction(),
-                          ignore_block,
-                          [&](cbb_ptr b) { postorder.push_back(b); },
-                          ignore_edge);
+      DepthFirstTraversal(
+          function.first_block(), function.AugmentedCFGSuccessorsFunction(),
+          ignore_block, [&](cbb_ptr b) { postorder.push_back(b); },
+          ignore_edge);
       auto edges = libspirv::CalculateDominators(
           postorder, function.AugmentedCFGPredecessorsFunction());
       for (auto edge : edges) {
@@ -428,11 +427,10 @@
       }
 
       /// calculate post dominators
-      DepthFirstTraversal(function.pseudo_exit_block(),
-                          function.AugmentedCFGPredecessorsFunction(),
-                          ignore_block,
-                          [&](cbb_ptr b) { postdom_postorder.push_back(b); },
-                          ignore_edge);
+      DepthFirstTraversal(
+          function.pseudo_exit_block(),
+          function.AugmentedCFGPredecessorsFunction(), ignore_block,
+          [&](cbb_ptr b) { postdom_postorder.push_back(b); }, ignore_edge);
       auto postdom_edges = libspirv::CalculateDominators(
           postdom_postorder, function.AugmentedCFGSuccessorsFunction());
       for (auto edge : postdom_edges) {
@@ -468,7 +466,8 @@
 
     /// Structured control flow checks are only required for shader capabilities
     if (_.HasCapability(SpvCapabilityShader)) {
-      spvCheckReturn(StructuredControlFlowChecks(_, function, back_edges));
+      if (auto error = StructuredControlFlowChecks(_, function, back_edges))
+        return error;
     }
   }
   return SPV_SUCCESS;
@@ -479,21 +478,24 @@
   SpvOp opcode = static_cast<SpvOp>(inst->opcode);
   switch (opcode) {
     case SpvOpLabel:
-      spvCheckReturn(_.current_function().RegisterBlock(inst->result_id));
+      if (auto error = _.current_function().RegisterBlock(inst->result_id))
+        return error;
       break;
     case SpvOpLoopMerge: {
       uint32_t merge_block = inst->words[inst->operands[0].offset];
       uint32_t continue_block = inst->words[inst->operands[1].offset];
       CFG_ASSERT(MergeBlockAssert, merge_block);
 
-      spvCheckReturn(
-          _.current_function().RegisterLoopMerge(merge_block, continue_block));
+      if (auto error = _.current_function().RegisterLoopMerge(merge_block,
+                                                              continue_block))
+        return error;
     } break;
     case SpvOpSelectionMerge: {
       uint32_t merge_block = inst->words[inst->operands[0].offset];
       CFG_ASSERT(MergeBlockAssert, merge_block);
 
-      spvCheckReturn(_.current_function().RegisterSelectionMerge(merge_block));
+      if (auto error = _.current_function().RegisterSelectionMerge(merge_block))
+        return error;
     } break;
     case SpvOpBranch: {
       uint32_t target = inst->words[inst->operands[0].offset];
diff --git a/source/validate_layout.cpp b/source/validate_layout.cpp
index 33519c1..af1af49 100644
--- a/source/validate_layout.cpp
+++ b/source/validate_layout.cpp
@@ -89,12 +89,15 @@
         }
         auto control_mask = static_cast<SpvFunctionControlMask>(
             inst->words[inst->operands[2].offset]);
-        spvCheckReturn(
-            _.RegisterFunction(inst->result_id, inst->type_id, control_mask,
-                               inst->words[inst->operands[3].offset]));
-        if (_.current_layout_section() == kLayoutFunctionDefinitions)
-          spvCheckReturn(_.current_function().RegisterSetFunctionDeclType(
-              FunctionDecl::kFunctionDeclDefinition));
+        if (auto error =
+                _.RegisterFunction(inst->result_id, inst->type_id, control_mask,
+                                   inst->words[inst->operands[3].offset]))
+          return error;
+        if (_.current_layout_section() == kLayoutFunctionDefinitions) {
+          if (auto error = _.current_function().RegisterSetFunctionDeclType(
+                  FunctionDecl::kFunctionDeclDefinition))
+            return error;
+        }
       } break;
 
       case SpvOpFunctionParameter:
@@ -108,8 +111,9 @@
                  << "Function parameters must only appear immediately after "
                     "the function definition";
         }
-        spvCheckReturn(_.current_function().RegisterFunctionParameter(
-            inst->result_id, inst->type_id));
+        if (auto error = _.current_function().RegisterFunctionParameter(
+                inst->result_id, inst->type_id))
+          return error;
         break;
 
       case SpvOpFunctionEnd:
@@ -128,10 +132,11 @@
                                                      "function definitions.";
         }
         if (_.current_layout_section() == kLayoutFunctionDeclarations) {
-          spvCheckReturn(_.current_function().RegisterSetFunctionDeclType(
-              FunctionDecl::kFunctionDeclDeclaration));
+          if (auto error = _.current_function().RegisterSetFunctionDeclType(
+                  FunctionDecl::kFunctionDeclDeclaration))
+            return error;
         }
-        spvCheckReturn(_.RegisterFunctionEnd());
+        if (auto error = _.RegisterFunctionEnd()) return error;
         break;
 
       case SpvOpLine:
@@ -151,8 +156,9 @@
         }
         if (_.current_layout_section() == kLayoutFunctionDeclarations) {
           _.ProgressToNextLayoutSectionOrder();
-          spvCheckReturn(_.current_function().RegisterSetFunctionDeclType(
-              FunctionDecl::kFunctionDeclDefinition));
+          if (auto error = _.current_function().RegisterSetFunctionDeclType(
+                  FunctionDecl::kFunctionDeclDefinition))
+            return error;
         }
         break;
 
@@ -198,13 +204,15 @@
     case kLayoutDebug2:
     case kLayoutAnnotations:
     case kLayoutTypes:
-      spvCheckReturn(ModuleScopedInstructions(_, inst, opcode));
+      if (auto error = ModuleScopedInstructions(_, inst, opcode)) return error;
       break;
     case kLayoutFunctionDeclarations:
     case kLayoutFunctionDefinitions:
-      spvCheckReturn(FunctionScopedInstructions(_, inst, opcode));
+      if (auto error = FunctionScopedInstructions(_, inst, opcode)) {
+        return error;
+      }
       break;
-  }  // switch(getLayoutSection())
+  }
   return SPV_SUCCESS;
 }
 }  /// namespace libspirv