Fix compilation under clang

This commit is contained in:
project-repo 2020-05-21 19:36:35 +02:00
commit 989438a1cb
9 changed files with 36 additions and 0 deletions

View file

@ -545,8 +545,10 @@ main(int argc, char *argv[]) {
wl_display_destroy_clients(server.wl_display);
end:
#if CG_HAS_FANALYZE
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wanalyzer-double-free"
#endif
for(unsigned int i = 0; server.modes[i] != NULL; ++i) {
free(server.modes[i]);
}
@ -577,4 +579,6 @@ end:
return ret;
}
#if CG_HAS_FANALYZE
#pragma GCC diagnostic pop
#endif

View file

@ -2,6 +2,7 @@
#define CG_CONFIG_H
#mesondefine CG_HAS_XWAYLAND
#mesondefine CG_HAS_FANALYZE
#mesondefine CG_VERSION

View file

@ -22,8 +22,10 @@ struct cg_idle_inhibitor_v1 {
struct wl_listener destroy;
};
#if CG_HAS_FANALYZE
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wanalyzer-malloc-leak"
#endif
static void
idle_inhibit_v1_check_active(struct cg_server *server) {
/* As of right now, this does not check whether the inhibitor
@ -31,7 +33,9 @@ idle_inhibit_v1_check_active(struct cg_server *server) {
bool inhibited = !wl_list_empty(&server->inhibitors);
wlr_idle_set_enabled(server->idle, NULL, !inhibited);
}
#if CG_HAS_FANALYZE
#pragma GCC diagnostic pop
#endif
static void
handle_destroy(struct wl_listener *listener, void *data) {

View file

@ -100,6 +100,12 @@ else
have_xwayland = false
endif
if cc.get_id() == 'gcc' and cc.version().version_compare('>=10')
have_fanalyze=true
else
have_fanalyze=false
endif
if get_option('version_override') != ''
version = '@0@'.format(get_option('version_override'))
else
@ -108,6 +114,7 @@ endif
conf_data = configuration_data()
conf_data.set10('CG_HAS_XWAYLAND', have_xwayland)
conf_data.set10('CG_HAS_FANALYZE', have_fanalyze)
conf_data.set_quoted('CG_VERSION', version)

View file

@ -95,8 +95,10 @@ create_message_texture(const char *string, const struct cg_output *output) {
return texture;
}
#if CG_HAS_FANALYZE
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wanalyzer-malloc-leak"
#endif
void
message_set_output(struct cg_output *output, const char *string,
struct wlr_box *box, enum cg_message_align align) {
@ -172,7 +174,9 @@ message_printf(struct cg_output *output, const char *fmt, ...) {
free(buffer);
alarm(output->server->message_timeout);
}
#if CG_HAS_FANALYZE
#pragma GCC diagnostic pop
#endif
void
message_printf_pos(struct cg_output *output, struct wlr_box *position,

View file

@ -550,8 +550,10 @@ output_configure(struct cg_server *server, struct cg_output *output) {
}
}
#if CG_HAS_FANALYZE
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wanalyzer-malloc-leak"
#endif
void
handle_new_output(struct wl_listener *listener, void *data) {
struct cg_server *server = wl_container_of(listener, server, new_output);
@ -629,7 +631,9 @@ handle_new_output(struct wl_listener *listener, void *data) {
DEFAULT_XCURSOR, server->seat->cursor);
wlr_cursor_warp(server->seat->cursor, NULL, 0, 0);
}
#if CG_HAS_FANALYZE
#pragma GCC diagnostic pop
#endif
void
output_set_window_title(struct cg_output *output, const char *title) {

View file

@ -325,12 +325,16 @@ parse_output_config(struct wl_list *config_list, char **saveptr) {
goto error;
}
#if CG_HAS_FANALYZE
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wanalyzer-malloc-leak"
#endif
cfg->output_name = strdup(name);
wl_list_insert(config_list, &cfg->link);
return 0;
#if CG_HAS_FANALYZE
#pragma GCC diagnostic pop
#endif
error:
free(cfg);

View file

@ -20,8 +20,10 @@
#include "view.h"
#include "workspace.h"
#if CG_HAS_FANALYZE
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wanalyzer-malloc-leak"
#endif
int
full_screen_workspace_tiles(struct wlr_output_layout *layout,
struct wlr_output *output,
@ -41,7 +43,9 @@ full_screen_workspace_tiles(struct wlr_output_layout *layout,
workspace->focused_tile->view = NULL;
return 0;
}
#if CG_HAS_FANALYZE
#pragma GCC diagnostic pop
#endif
struct cg_workspace *
full_screen_workspace(struct cg_output *output) {

View file

@ -32,8 +32,10 @@ xdg_decoration_handle_destroy(struct wl_listener *listener, void *_data) {
free(xdg_decoration);
}
#if CG_HAS_FANALYZE
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wanalyzer-malloc-leak"
#endif
static void
xdg_decoration_handle_request_mode(struct wl_listener *listener, void *_data) {
struct cg_xdg_decoration *xdg_decoration =
@ -44,7 +46,9 @@ xdg_decoration_handle_request_mode(struct wl_listener *listener, void *_data) {
wlr_xdg_toplevel_decoration_v1_set_mode(xdg_decoration->wlr_decoration,
mode);
}
#if CG_HAS_FANALYZE
#pragma GCC diagnostic pop
#endif
static void
xdg_popup_destroy(struct cg_view_child *child) {