]> eyrie.org Git - kerberos/wallet.git/commitdiff
Fix warnings from Clang's analyzer
authorRuss Allbery <eagle@eyrie.org>
Mon, 18 May 2020 02:57:08 +0000 (19:57 -0700)
committerRuss Allbery <eagle@eyrie.org>
Mon, 18 May 2020 02:57:08 +0000 (19:57 -0700)
Suppress a warning about not declaring a function noreturn that's
only noreturn in some configurations.  Add an assert to unconfuse
the static analyzer about a default value for a struct.

client/srvtab.c
client/wallet.c

index c0c5c408041f9d9e9ef096235879522cb36e815c..5fd39dcf51b3861f1ba2bbff0aa57ce89fdf5500 100644 (file)
 # define REALM_SZ 40
 #endif
 
+/*
+ * Disable the warning about a missing noreturn attribute, which may be
+ * triggered if the version of the Kerberos libraries doesn't contain
+ * krb5_524_conv_principal.
+ */
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2) || defined(__clang__)
+#    pragma GCC diagnostic ignored "-Wmissing-noreturn"
+#endif
+
 
 /*
  * Given the Kerberos context, srvtab file name, a Kerberos principal (as a
index 194f1f5d843b68fcb95413a9ad395dcfc3109c00..435f0001af1f975d203907f3db87e1093d538301 100644 (file)
@@ -2,7 +2,7 @@
  * The client program for the wallet system.
  *
  * Written by Russ Allbery <eagle@eyrie.org>
- * Copyright 2018 Russ Allbery <eagle@eyrie.org>
+ * Copyright 2018, 2020 Russ Allbery <eagle@eyrie.org>
  * Copyright 2006-2008, 2010, 2014
  *     The Board of Trustees of the Leland Stanford Junior University
  *
@@ -14,6 +14,7 @@
 #include <portable/system.h>
 #include <portable/uio.h>
 
+#include <assert.h>
 #include <errno.h>
 #include <remctl.h>
 
@@ -181,6 +182,7 @@ main(int argc, char *argv[])
                 count++;
         }
         command = xcalloc(count, sizeof(struct iovec));
+        assert(options.type != NULL);
         command[0].iov_base = (char *) options.type;
         command[0].iov_len = strlen(options.type);
         for (i = 0; i < argc; i++) {