mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
daemon: Ignore -Wnull-dereference & -Wshift-overflow warnings.
One -Wnull-dereference warning is real: we deliberately cause a segfault in one of the tests. There is a -Wshift-overflow bug in a Gtk 2 header. The others are the result of shortcomings in GCC. In all cases we have to add GCC diagnostic overrides to ignore the warnings when compiling with ./configure --enable-werror.
This commit is contained in:
@@ -28,6 +28,11 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* GCC can't work out that the YAJL_IS_<foo> test is sufficient to
|
||||
* ensure that YAJL_GET_<foo> later doesn't return NULL.
|
||||
*/
|
||||
#pragma GCC diagnostic ignored "-Wnull-dereference"
|
||||
|
||||
#define Val_none (Val_int (0))
|
||||
|
||||
value virt_builder_yajl_tree_parse (value stringv);
|
||||
|
||||
@@ -989,6 +989,9 @@ do_internal_rhbz914931 (int count)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wnull-dereference"
|
||||
|
||||
static void
|
||||
deliberately_cause_a_segfault (void)
|
||||
{
|
||||
@@ -1001,3 +1004,5 @@ deliberately_cause_a_segfault (void)
|
||||
/* coverity[var_deref_op] */
|
||||
*ptr = 1;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -32,6 +32,11 @@
|
||||
#include "actions.h"
|
||||
#include "optgroups.h"
|
||||
|
||||
/* GCC can't work out that the YAJL_IS_<foo> test is sufficient to
|
||||
* ensure that YAJL_GET_<foo> later doesn't return NULL.
|
||||
*/
|
||||
#pragma GCC diagnostic ignored "-Wnull-dereference"
|
||||
|
||||
GUESTFSD_EXT_CMD(str_ldmtool, ldmtool);
|
||||
|
||||
int
|
||||
|
||||
@@ -122,8 +122,14 @@ receive_stdout (int s)
|
||||
error (EXIT_FAILURE, errno, "recvmsg stdout fd");
|
||||
|
||||
cmptr = CMSG_FIRSTHDR (&msg);
|
||||
if (cmptr == NULL)
|
||||
if (cmptr == NULL) {
|
||||
error (EXIT_FAILURE, errno, "didn't receive a stdout file descriptor");
|
||||
/* Makes GCC happy. error() cannot be declared as noreturn, so
|
||||
* GCC doesn't know that the subsequent dereference of cmptr isn't
|
||||
* reachable when cmptr is NULL.
|
||||
*/
|
||||
abort ();
|
||||
}
|
||||
if (cmptr->cmsg_len != CMSG_LEN (sizeof (int)))
|
||||
error (EXIT_FAILURE, 0, "cmsg_len != CMSG_LEN (sizeof (int))");
|
||||
if (cmptr->cmsg_level != SOL_SOCKET)
|
||||
|
||||
@@ -66,8 +66,12 @@
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wstrict-prototypes" /* error in <gtk.h> */
|
||||
/* errors in <gtk.h> */
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
|
||||
#pragma GCC diagnostic ignored "-Wshift-overflow"
|
||||
#include <gtk/gtk.h>
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#include "ignore-value.h"
|
||||
|
||||
|
||||
@@ -33,8 +33,12 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wstrict-prototypes" /* error in <gtk.h> */
|
||||
/* errors in <gtk.h> */
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
|
||||
#pragma GCC diagnostic ignored "-Wshift-overflow"
|
||||
#include <gtk/gtk.h>
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#include "ignore-value.h"
|
||||
#include "p2v.h"
|
||||
|
||||
Reference in New Issue
Block a user