Fix and enable -Wnested-anon-types

Bug: dawn:394
Change-Id: I51b533c07f21bcacd22a058cf4a080b9b2b853f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20700
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/common/BUILD.gn b/src/common/BUILD.gn
index b74fbdc..0d55996 100644
--- a/src/common/BUILD.gn
+++ b/src/common/BUILD.gn
@@ -118,7 +118,6 @@
       "-Wno-gnu-zero-variadic-macro-arguments",
       "-Wno-language-extension-token",
       "-Wno-microsoft-enum-value",
-      "-Wno-nested-anon-types",
     ]
   }
 }
diff --git a/src/dawn_native/BuddyAllocator.h b/src/dawn_native/BuddyAllocator.h
index af82636..8404158 100644
--- a/src/dawn_native/BuddyAllocator.h
+++ b/src/dawn_native/BuddyAllocator.h
@@ -71,19 +71,23 @@
             // Track whether this block has been split or not.
             BlockState mState;
 
+            struct FreeLinks {
+                BuddyBlock* pPrev;
+                BuddyBlock* pNext;
+            };
+
+            struct SplitLink {
+                BuddyBlock* pLeft;
+            };
+
             union {
                 // Used upon allocation.
                 // Avoids searching for the next free block.
-                struct {
-                    BuddyBlock* pPrev;
-                    BuddyBlock* pNext;
-                } free;
+                FreeLinks free;
 
                 // Used upon de-allocation.
                 // Had this block split upon allocation, it and it's buddy is to be deleted.
-                struct {
-                    BuddyBlock* pLeft;
-                } split;
+                SplitLink split;
             };
         };
 
diff --git a/third_party/gn/glm/BUILD.gn b/third_party/gn/glm/BUILD.gn
index 46e48eb..205be21 100644
--- a/third_party/gn/glm/BUILD.gn
+++ b/third_party/gn/glm/BUILD.gn
@@ -18,6 +18,12 @@
 
 config("glm_public_config") {
   include_dirs = [ "${dawn_glm_dir}" ]
+
+  # GLM tries to suppress the warning for clang but gets confused by clang-cl
+  # and thinks it is MSVC.
+  if (is_win && is_clang) {
+    cflags = [ "-Wno-nested-anon-types" ]
+  }
 }
 source_set("glm") {
   configs -= [ "//build/config/compiler:chromium_code" ]