From: Simon Tatham Date: Sun, 5 Feb 2017 11:19:22 +0000 (+0000) Subject: clang-specific pragmas to suppress -Wmissing-braces. X-Git-Tag: 0.68~47 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=730a9fdfe3d624bb663557c67f89d2cf8b575964;p=PuTTY.git clang-specific pragmas to suppress -Wmissing-braces. When I added some extra braces in commit 095072fa4 to suppress this warning, I think in fact I did the wrong thing, because the declaration syntax I was originally using is the Microsoft-recommended one in spite of clang not liking it - I think MS would be within their rights (should they feel like it) to add those missing braces in a later version of the WinSock headers, which would make the current warning-clean code stop compiling. So it's better to put the code back as it was, and avoid the clang warning by using clang's warning-suppression pragmas for just those declarations. I've also done the same thing in winnet.c, for two initialisers of IPv6 well-known addresses which had the same problem (but which I didn't notice yesterday because a misjudged set of Windows version macros had prevented me from compiling that file successfully at all). --- diff --git a/windows/winnet.c b/windows/winnet.c index b4ac166c..d9da95ce 100644 --- a/windows/winnet.c +++ b/windows/winnet.c @@ -17,8 +17,15 @@ #include #ifndef NO_IPV6 +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wmissing-braces" +#endif const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif #endif #define ipv4_is_loopback(addr) \ diff --git a/windows/winsecur.c b/windows/winsecur.c index cba7d60a..76dcae91 100644 --- a/windows/winsecur.c +++ b/windows/winsecur.c @@ -94,8 +94,16 @@ PSID get_user_sid(void) int getsids(char **error) { - SID_IDENTIFIER_AUTHORITY world_auth = { SECURITY_WORLD_SID_AUTHORITY }; - SID_IDENTIFIER_AUTHORITY nt_auth = { SECURITY_NT_AUTHORITY }; +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wmissing-braces" +#endif + SID_IDENTIFIER_AUTHORITY world_auth = SECURITY_WORLD_SID_AUTHORITY; + SID_IDENTIFIER_AUTHORITY nt_auth = SECURITY_NT_AUTHORITY; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + int ret = FALSE; *error = NULL;