[Bf-blender-cvs] [72049021e7a] sybren-usd: USD: Avoid use of `default` in `switch`

Sybren A. Stüvel noreply at git.blender.org
Fri Jun 21 16:40:09 CEST 2019


Commit: 72049021e7a1d5c577f66817b15c874c1b0efefe
Author: Sybren A. Stüvel
Date:   Thu Jun 20 16:03:30 2019 +0200
Branches: sybren-usd
https://developer.blender.org/rB72049021e7a1d5c577f66817b15c874c1b0efefe

USD: Avoid use of `default` in `switch`

By avoiding `default` and listing all valid `OB_xxx` cases explicitly the
compiler can warn us about any missing cases in the future.

===================================================================

M	source/blender/usd/intern/usd_hierarchy_iterator.cc

===================================================================

diff --git a/source/blender/usd/intern/usd_hierarchy_iterator.cc b/source/blender/usd/intern/usd_hierarchy_iterator.cc
index 17c1ff03467..4d720db9f29 100644
--- a/source/blender/usd/intern/usd_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/usd_hierarchy_iterator.cc
@@ -54,11 +54,26 @@ AbstractHierarchyWriter *USDHierarchyIterator::create_data_writer(const Hierarch
     case OB_MESH:
       data_writer = new USDMeshWriter(usd_export_context);
       break;
-    default:
+
+    case OB_EMPTY:
+    case OB_CURVE:
+    case OB_SURF:
+    case OB_FONT:
+    case OB_MBALL:
+    case OB_LAMP:
+    case OB_CAMERA:
+    case OB_SPEAKER:
+    case OB_LIGHTPROBE:
+    case OB_LATTICE:
+    case OB_ARMATURE:
+    case OB_GPENCIL:
       printf("USD-\033[34mXFORM-ONLY\033[0m object %s  type=%d (no data writer)\n",
              context.object->id.name,
              context.object->type);
       return nullptr;
+    case OB_TYPE_MAX:
+      BLI_assert(!"OB_TYPE_MAX should not be used");
+      return nullptr;
   }
 
   if (!data_writer->is_supported()) {



More information about the Bf-blender-cvs mailing list