From 4bbbf03b8bc266ed2b63c461cd0945250bb134fe Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 5 Jan 2021 10:13:27 +0000 Subject: [PATCH] Ignore completely bogus GCC 11 warnings. Various varieties of this: | 45 | tempfile = strdup ("/tmp/luksXXXXXX"); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (19) this call could return NULL | 46 | if (!tempfile) { | | ~ | | | | | (20) following 'false' branch (when 'tempfile' is non-NULL)... |...... | 51 | fd = mkstemp (tempfile); | | ~~ ~~~~~~~~~~~~~~~~~~ | | | | | | | (22) argument 1 ('tempfile') from (19) could be NULL where non-null expected | | (21) ...to here --- daemon/luks.c | 3 +++ daemon/ntfsclone.c | 3 +++ df/main.c | 3 +++ format/format.c | 3 +++ 4 files changed, 12 insertions(+) diff --git a/daemon/luks.c b/daemon/luks.c index 51ced585d..166cc953a 100644 --- a/daemon/luks.c +++ b/daemon/luks.c @@ -34,6 +34,8 @@ optgroup_luks_available (void) return prog_exists ("cryptsetup"); } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wanalyzer-possible-null-argument" /* Callers must also call remove_temp (tempfile). */ static char * write_key_to_temp (const char *key) @@ -73,6 +75,7 @@ write_key_to_temp (const char *key) free (tempfile); return NULL; } +#pragma GCC diagnostic pop static void remove_temp (char *tempfile) diff --git a/daemon/ntfsclone.c b/daemon/ntfsclone.c index 4eb7066a6..d4baec6ff 100644 --- a/daemon/ntfsclone.c +++ b/daemon/ntfsclone.c @@ -30,6 +30,8 @@ #include "actions.h" #include "optgroups.h" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wanalyzer-null-argument" /* Read the error file. Returns a string that the caller must free. */ static char * read_error_file (char *error_file) @@ -51,6 +53,7 @@ read_error_file (char *error_file) return str; /* caller frees */ } +#pragma GCC diagnostic pop static int write_cb (void *fd_ptr, const void *buf, size_t len) diff --git a/df/main.c b/df/main.c index e80b97015..ac79a3691 100644 --- a/df/main.c +++ b/df/main.c @@ -313,6 +313,8 @@ main (int argc, char *argv[]) exit (err == 0 ? EXIT_SUCCESS : EXIT_FAILURE); } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wanalyzer-null-argument" /* Generate a display name for the single guest mode. See comments in * https://bugzilla.redhat.com/show_bug.cgi?id=880801 */ @@ -370,6 +372,7 @@ single_drive_display_name (struct drv *drvs) return name; } +#pragma GCC diagnostic pop static char * make_display_name (struct drv *drvs) diff --git a/format/format.c b/format/format.c index 57e843c06..5a041f915 100644 --- a/format/format.c +++ b/format/format.c @@ -302,6 +302,8 @@ main (int argc, char *argv[]) exit (EXIT_SUCCESS); } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wanalyzer-null-argument" /* Parse lvm string of the form "/dev/VG/LV" or "VG/LV". * This sets the global variables 'vg' and 'lv', or exits on failure. */ @@ -327,6 +329,7 @@ parse_vg_lv (const char *lvm) if (strchr (vg, '/') || strchr (lv, '/')) goto cannot_parse; } +#pragma GCC diagnostic pop /* Returns 0 on success, 1 if we need to retry. */ static int