[openweave-core] Re-enable exception warnings

Patches in some local fixes to the existing exceptions and re-enables
them. Some exceptions are still ignored in favor of enabling the
features that would remove them.

Bug: 46091
Test: Verified build.
Change-Id: I957fc683a429b6cb5059b47f9c1701dfad53fe1b
diff --git a/device-layer.gni b/device-layer.gni
index 84c58dc..73ce5ac 100644
--- a/device-layer.gni
+++ b/device-layer.gni
@@ -59,7 +59,10 @@
   }
 
   config(target_name + "_openweave_config") {
-    include_dirs = [ "$top_builddir/src/adaptations/device-layer/include" ]
+    include_dirs = [
+      "$top_builddir/src/adaptations/device-layer/include",
+      "$top_builddir/src/adaptations/device-layer/trait-support",
+    ]
     if (defined(invoker.include_dirs)) {
       include_dirs += invoker.include_dirs
     }
diff --git a/src/adaptations/device-layer/ServiceDirectoryManager.cpp b/src/adaptations/device-layer/ServiceDirectoryManager.cpp
index 4fab182..e57af68 100644
--- a/src/adaptations/device-layer/ServiceDirectoryManager.cpp
+++ b/src/adaptations/device-layer/ServiceDirectoryManager.cpp
@@ -165,7 +165,7 @@
 
         const ptrdiff_t remainingSpace = (rootDirBuf + rootDirBufSize) - p;
 
-        if (remainingSpace < encodedEntrySize)
+        if (remainingSpace < 0 || ((const size_t)remainingSpace) < encodedEntrySize)
         {
             VerifyOrExit(numHostPortEntries > 1, err = WEAVE_ERROR_BUFFER_TOO_SMALL);
             break;
diff --git a/src/include/BUILD.gn b/src/include/BUILD.gn
index ab4364f..d61851f 100644
--- a/src/include/BUILD.gn
+++ b/src/include/BUILD.gn
@@ -15,14 +15,9 @@
   # Temporarily adding ignore cases for openweave warnings.
   # TODO(fxb/46070): Resolve these warnings in mainline.
   cflags = [
-    "-Wno-ignored-qualifiers",
-    "-Wno-missing-field-initializers",
-    "-Wno-sign-compare",
-    "-Wno-tautological-constant-out-of-range-compare",
+    # Should be removable when WARM thread routing is enabled.
     "-Wno-unused-const-variable",
     "-Wno-unused-function",
-    "-Wno-unused-private-field",
-    "-Wno-nonportable-include-path",
   ]
 }
 
diff --git a/src/lib/profiles/data-management/Current/MessageDef.cpp b/src/lib/profiles/data-management/Current/MessageDef.cpp
index 7a94b48..dede683 100644
--- a/src/lib/profiles/data-management/Current/MessageDef.cpp
+++ b/src/lib/profiles/data-management/Current/MessageDef.cpp
@@ -1904,7 +1904,7 @@
         bool Data : 1;
     };
 
-    TagPresence tagPresence = { 0 };
+    TagPresence tagPresence = {};
 
     PRETTY_PRINT("\t{");
 
@@ -3717,7 +3717,7 @@
         bool Authenticator;
     };
 
-    TagPresence tagPresence = { 0 };
+    TagPresence tagPresence = {};
 
     PRETTY_PRINT("{");
 
@@ -4107,7 +4107,7 @@
         bool Response;
     };
 
-    TagPresence tagPresence = { 0 };
+    TagPresence tagPresence = {};
 
     PRETTY_PRINT("{");
 
@@ -4245,7 +4245,7 @@
         bool UpdateRequestIndex;
     };
 
-    TagPresence tagPresence = { 0 };
+    TagPresence tagPresence = {};
 
     PRETTY_PRINT("{");
 
@@ -4459,7 +4459,7 @@
         bool VersionList;
     };
 
-    TagPresence tagPresence = { 0 };
+    TagPresence tagPresence = {};
 
     reader.Init(mReader);
 
diff --git a/src/lib/profiles/data-management/Current/UpdateClient.h b/src/lib/profiles/data-management/Current/UpdateClient.h
index 387ebe5..d017191 100644
--- a/src/lib/profiles/data-management/Current/UpdateClient.h
+++ b/src/lib/profiles/data-management/Current/UpdateClient.h
@@ -83,7 +83,6 @@
     EventCallback mEventCallback;
     nl::Weave::ExchangeContext * mEC;
     UpdateClientState mState;
-    utc_timestamp_t mExpiryTimeMicroSecond;
 
     static void OnSendError(ExchangeContext * aEC, WEAVE_ERROR aErrorCode, void * aMsgSpecificContext);
     static void OnResponseTimeout(nl::Weave::ExchangeContext * aEC);
diff --git a/src/lib/profiles/time/WeaveTime.h b/src/lib/profiles/time/WeaveTime.h
index 7e8fb22..a18e70e 100644
--- a/src/lib/profiles/time/WeaveTime.h
+++ b/src/lib/profiles/time/WeaveTime.h
@@ -1070,7 +1070,7 @@
     WEAVE_ERROR SendSyncRequest(bool * const rIsMessageSent, Contact * const aContact);
 
     void SetClientState(const ClientState state);
-    const char * const GetClientStateName(void) const;
+    const char * GetClientStateName(void) const;
 
     /// internal function to kick off an auto sync session
     void AutoSyncNow(void);
diff --git a/src/lib/profiles/time/WeaveTimeClient.cpp b/src/lib/profiles/time/WeaveTimeClient.cpp
index 39e8097..8ea4f82 100644
--- a/src/lib/profiles/time/WeaveTimeClient.cpp
+++ b/src/lib/profiles/time/WeaveTimeClient.cpp
@@ -179,7 +179,7 @@
 }
 #endif // WEAVE_CONFIG_TIME_CLIENT_FABRIC_LOCAL_DISCOVERY
 
-const char * const TimeSyncNode::GetClientStateName() const
+const char * TimeSyncNode::GetClientStateName() const
 {
     const char * stateName = NULL;