]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add and use __attribute__((nonnull)) in dnssec-signzone.c
authorOndřej Surý <ondrej@isc.org>
Thu, 21 Aug 2025 21:51:38 +0000 (23:51 +0200)
committerOndřej Surý <ondrej@sury.org>
Thu, 28 Aug 2025 14:27:00 +0000 (16:27 +0200)
Clang 20 is complaining about passing NULL to an argument with 'nonnull'
attribute.  Mark these two functions with the same attribute to assure
that these two function also don't accept NULL as an argument.

(cherry picked from commit 9e350c177403ead4c8a6630a08f36f304b04484c)

bin/dnssec/dnssec-signzone.c
lib/isc/include/isc/attributes.h

index b2c77d497a44b396e83e716e1706f4c2b5b92a16..6c4bf3631ee8c9c4e61cd53d1910f872a9648993 100644 (file)
@@ -3199,6 +3199,8 @@ writeset(const char *prefix, dns_rdatatype_t type) {
        dns_db_detach(&db);
 }
 
+static void
+print_time(FILE *fp) ISC_ATTR_NONNULL(1);
 static void
 print_time(FILE *fp) {
        time_t currenttime = time(NULL);
@@ -3215,6 +3217,8 @@ print_time(FILE *fp) {
        fprintf(fp, "; File written on %s\n", timebuf);
 }
 
+static void
+print_version(FILE *fp) ISC_ATTR_NONNULL(1);
 static void
 print_version(FILE *fp) {
        if (outputformat != dns_masterformat_text) {
@@ -4021,6 +4025,7 @@ main(int argc, char *argv[]) {
                        fatal("failed to open temporary output file: %s",
                              isc_result_totext(result));
                }
+               INSIST(outfp != NULL);
                removefile = true;
                setfatalcallback(&removetempfile);
        }
index f38a558552eafaee09866b212c559585f07e1511..ecb3e93a508d4d57acf2ba22308dbcb0f80ddd7a 100644 (file)
@@ -82,3 +82,9 @@
 #endif /* HAVE_FUNC_ATTRIBUTE_MALLOC */
 
 #define ISC_ATTR_UNUSED __attribute__((__unused__))
+
+#if __has_attribute(__nonnull__)
+#define ISC_ATTR_NONNULL(...) __attribute__((__nonnull__(__VA_ARGS__)))
+#else
+#define ISC_ATTR_NONNULL(...)
+#endif