The Duet change is to avoid an unneeded 64-bit left shift. With the
NOOPT build, a function call is generated for the shift.

The first two StdLib changes avoid a warning about assignment in
conditional expression. The third enhances the recent change to
silence a similar warning from gcc.

-- 

StdLib, DuetPkg: fix Microsoft warnings exposed by NOOPT build.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Scott Duplichan <sc...@notabs.org>

--


Index: DuetPkg/DxeIpl/HobGeneration.c
===================================================================
--- DuetPkg/DxeIpl/HobGeneration.c      (revision 16302)
+++ DuetPkg/DxeIpl/HobGeneration.c      (working copy)
@@ -609,7 +609,7 @@
   // Prepare Low Memory
   // 0x18 pages is 72 KB.
   //
-  EbdaAddress = ((UINT64)(*(UINT16 *)(UINTN)(EBDA_VALUE_ADDRESS))) << 4;
+  EbdaAddress = (UINT64)((*(UINT16 *)(UINTN)(EBDA_VALUE_ADDRESS)) << 4);
   if (EbdaAddress < 0x9A000 || EbdaAddress > EFI_MEMORY_BELOW_1MB_END) {
     //
     // EBDA should not go below 0x9A000 in any implementation,
Index: StdLib/BsdSocketLib/ns_addr.c
===================================================================
--- StdLib/BsdSocketLib/ns_addr.c       (revision 16302)
+++ StdLib/BsdSocketLib/ns_addr.c       (working copy)
@@ -79,7 +79,8 @@
                separator = '#';
        else {
                hostname = strchr(buf, '.');
-               if ((cp = strchr(buf, ':')) &&
+        cp = strchr(buf, ':');
+               if (cp &&
                    ((hostname && cp < hostname) || (hostname == 0))) {
                        hostname = cp;
                        separator = ':';
Index: StdLib/BsdSocketLib/res_mkupdate.c
===================================================================
--- StdLib/BsdSocketLib/res_mkupdate.c  (revision 16302)
+++ StdLib/BsdSocketLib/res_mkupdate.c  (working copy)
@@ -438,8 +438,11 @@
          u_int class, u_int type, u_long ttl) {
     ns_updrec *rrecp = (ns_updrec *)calloc(1, sizeof(ns_updrec));
 
-    if (!rrecp || !(rrecp->r_dname = strdup(dname)))
+    if (!rrecp)
         return (NULL);
+    rrecp->r_dname = strdup(dname);
+    if (!rrecp->r_dname)
+        return (NULL);
     rrecp->r_class = (u_int16_t)class;
     rrecp->r_type = (u_int16_t)type;
     rrecp->r_ttl = (u_int32_t)ttl;
Index: StdLib/BsdSocketLib/res_update.c
===================================================================
--- StdLib/BsdSocketLib/res_update.c    (revision 16302)
+++ StdLib/BsdSocketLib/res_update.c    (working copy)
@@ -130,7 +130,7 @@
     int i, j, k = 0, n, ancount, nscount, arcount, rcode, rdatasize,
         newgroup, done, myzone, seen_before, numzones = 0;
     u_int16_t dlen, class, qclass, type, qtype;
-    u_int32_t ttl;
+    u_int32_t ttl = 0;
 
     if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
         h_errno = NETDB_INTERNAL;

-- 

Attachment: noopt-fixes.patch
Description: Binary data

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to