From f649a949e2d529b9556fee3d29ffa30a244172cb Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sun, 20 Jan 2019 21:15:20 +0000 Subject: [PATCH] Even more includes Expand the modulemap to cover some of the system headers too. Signed-off-by: Yuxuan Shui --- src/backend/backend.c | 2 + src/backend/backend_common.c | 2 + src/backend/gl/gl_common.c | 7 +- src/backend/gl/gl_common.h | 1 + src/backend/gl/glx.c | 6 +- src/backend/xrender.c | 5 ++ src/c2.c | 2 + src/compton.c | 12 ++-- src/compton.h | 26 ++----- src/compton.modulemap | 133 +++++++++++++++++++++++++++++++++-- src/config.c | 4 ++ src/config.h | 2 + src/config_libconfig.c | 1 + src/dbus.c | 3 + src/diagnostic.c | 3 + src/log.c | 1 + src/opengl.c | 5 ++ src/opengl.h | 4 ++ src/options.c | 14 ++-- src/region.h | 1 + src/render.c | 7 ++ src/render.h | 1 + src/utils.c | 1 + src/vsync.c | 2 + src/win.c | 4 ++ src/win.h | 4 +- src/x.c | 6 ++ 27 files changed, 216 insertions(+), 43 deletions(-) diff --git a/src/backend/backend.c b/src/backend/backend.c index 0b0923e5..7a705b1d 100644 --- a/src/backend/backend.c +++ b/src/backend/backend.c @@ -1,3 +1,5 @@ +#include + #include "backend.h" #include "config.h" #include "win.h" diff --git a/src/backend/backend_common.c b/src/backend/backend_common.c index 6b5d9e7d..2cdc2e7c 100644 --- a/src/backend/backend_common.c +++ b/src/backend/backend_common.c @@ -1,5 +1,7 @@ +#include #include #include +#include #include "backend.h" #include "backend_common.h" diff --git a/src/backend/gl/gl_common.c b/src/backend/gl/gl_common.c index ef5df844..78101624 100644 --- a/src/backend/gl/gl_common.c +++ b/src/backend/gl/gl_common.c @@ -2,14 +2,17 @@ #include #include #include +#include +#include +#include // for xcb_render_fixed_t, XXX #include "common.h" +#include "compiler.h" +#include "config.h" #include "log.h" #include "region.h" #include "string_utils.h" #include "utils.h" -#include "compiler.h" -#include "config.h" #include "backend/gl/gl_common.h" diff --git a/src/backend/gl/gl_common.h b/src/backend/gl/gl_common.h index 63aff46b..bf201061 100644 --- a/src/backend/gl/gl_common.h +++ b/src/backend/gl/gl_common.h @@ -1,4 +1,5 @@ #pragma once +#include #include #include diff --git a/src/backend/gl/glx.c b/src/backend/gl/glx.c index 8956b885..ff06254a 100644 --- a/src/backend/gl/glx.c +++ b/src/backend/gl/glx.c @@ -9,9 +9,14 @@ * */ +#include #include #include #include +#include +#include +#include +#include #include "backend/backend.h" #include "backend/gl/gl_common.h" @@ -19,7 +24,6 @@ #include "compiler.h" #include "log.h" #include "region.h" -#include "string_utils.h" #include "utils.h" #include "win.h" #include "config.h" diff --git a/src/backend/xrender.c b/src/backend/xrender.c index a57543e1..2b07aab0 100644 --- a/src/backend/xrender.c +++ b/src/backend/xrender.c @@ -1,8 +1,13 @@ #include #include +#include +#include +#include #include #include +#include +#include #include "backend/backend.h" #include "backend_common.h" diff --git a/src/c2.c b/src/c2.c index bbf6886f..3ea8a4be 100644 --- a/src/c2.c +++ b/src/c2.c @@ -10,6 +10,8 @@ * */ +#include +#include #include #include diff --git a/src/compton.c b/src/compton.c index 32748c6c..d5dcc525 100644 --- a/src/compton.c +++ b/src/compton.c @@ -9,9 +9,11 @@ * */ -#include +#include #include +#include #include +#include #include #include #include @@ -19,7 +21,10 @@ #include #include #include -#include +#include +#include +#include +#include #include @@ -33,14 +38,11 @@ #include "x.h" #include "config.h" #include "diagnostic.h" -#include "string_utils.h" #include "render.h" #include "utils.h" #include "region.h" #include "types.h" #include "c2.h" -#include "kernel.h" -#include "vsync.h" #include "log.h" #ifdef CONFIG_DBUS #include "dbus.h" diff --git a/src/compton.h b/src/compton.h index 9bd6acd8..660416a7 100644 --- a/src/compton.h +++ b/src/compton.h @@ -2,33 +2,16 @@ // Copyright (c) // Throw everything in here. - +// !!! DON'T !!! // === Includes === -#include -#include -#include -#include -#include +#include +#include #include -#include - -#ifdef CONFIG_VSYNC_DRM -#include -// We references some definitions in drm.h, which could also be found in -// /usr/src/linux/include/drm/drm.h, but that path is probably even less -// reliable than libdrm -#include -#include -#include -#endif +#include #include -#include -#ifdef CONFIG_OPENGL -#include "opengl.h" // XXX clean up -#endif #include "common.h" #include "win.h" #include "x.h" @@ -39,6 +22,7 @@ #include "types.h" #include "utils.h" #include "render.h" +#include "config.h" // == Functions == // TODO move static inline functions that are only used in compton.c, into diff --git a/src/compton.modulemap b/src/compton.modulemap index 3e20f4b7..dde8ed35 100644 --- a/src/compton.modulemap +++ b/src/compton.modulemap @@ -14,14 +14,15 @@ module kernel { header "kernel.h" } module utils { + // Has macros expands to calloc/malloc header "utils.h" + export libc.stdlib } module region { header "region.h" } module compton { header "compton.h" - exclude header "/usr/include/X11/Xlib.h" } module types { header "types.h" @@ -43,7 +44,6 @@ module diagnostic { } module win { header "win.h" - exclude header "/usr/include/GL/glx.h" } module log { header "log.h" @@ -56,8 +56,6 @@ module vsync { } module common { header "common.h" - exclude header "/usr/include/X11/Xlib.h" - exclude header "/usr/include/GL/glx.h" } module config { header "config.h" @@ -78,7 +76,128 @@ module backend { header "backend/backend_common.h" } } -module Xlib { - header "/usr/include/X11/Xlib.h" - export * +module xcb [system] { + module xcb { + header "/usr/include/xcb/xcb.h" + export * + } + module randr { + header "/usr/include/xcb/randr.h" + export * + } + module render { + header "/usr/include/xcb/render.h" + export * + } + module sync { + header "/usr/include/xcb/sync.h" + export * + } + module composite { + header "/usr/include/xcb/composite.h" + export * + } + module xfixes { + header "/usr/include/xcb/xfixes.h" + export * + } + module damage { + header "/usr/include/xcb/damage.h" + export * + } + module xproto { + header "/usr/include/xcb/xproto.h" + export * + } + module present { + header "/usr/include/xcb/present.h" + } + module util { + module render { + header "/usr/include/xcb/xcb_renderutil.h" + export * + } + } +} +module X11 [system] { + module Xlib { + header "/usr/include/X11/Xlib.h" + export * + } + module Xutil { + header "/usr/include/X11/Xutil.h" + export * + } +} +module GL [system] { + module glx { + header "/usr/include/GL/glx.h" + export * + } + module gl { + header "/usr/include/GL/gl.h" + export * + } +} +module libc [system] { + export * + module assert { + export * + textual header "/usr/include/assert.h" + } + module string { + export * + header "/usr/include/string.h" + } + module ctype { + export * + header "/usr/include/ctype.h" + } + module errno { + export * + header "/usr/include/errno.h" + } + module fenv { + export * + header "/usr/include/fenv.h" + } + module inttypes { + export * + header "/usr/include/inttypes.h" + } + module math { + export * + header "/usr/include/math.h" + } + module setjmp { + export * + header "/usr/include/setjmp.h" + } + module stdio { + export * + header "/usr/include/stdio.h" + } + + module stdlib [system] { + export * + header "/usr/include/stdlib.h" + } +} + +// glib specific header. In it's own module because it +// doesn't exist on some systems with unpatched glib 2.26+ +module "xlocale.h" [system] { + export * + header "/usr/include/xlocale.h" +} + +// System header that we have difficult with merging. +module "sys_types.h" [system] { + export * + header "/usr/include/sys/types.h" +} + +module "signal.h" [system] { + export * + header "/usr/include/signal.h" } diff --git a/src/config.c b/src/config.c index 26456e21..58bf1a30 100644 --- a/src/config.c +++ b/src/config.c @@ -2,8 +2,12 @@ // Copyright (c) 2011-2013, Christopher Jeffrey // Copyright (c) 2013 Richard Grenville +#include #include #include +#include +#include +#include // for xcb_render_fixed_t, XXX #include "compiler.h" #include "common.h" diff --git a/src/config.h b/src/config.h index 1059c6b6..cfe24603 100644 --- a/src/config.h +++ b/src/config.h @@ -11,6 +11,8 @@ #include #include #include +#include +#include // for xcb_render_fixed_t, XXX #include #ifdef CONFIG_LIBCONFIG diff --git a/src/config_libconfig.c b/src/config_libconfig.c index d980fd28..9dd9ae84 100644 --- a/src/config_libconfig.c +++ b/src/config_libconfig.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include diff --git a/src/dbus.c b/src/dbus.c index 0fe79189..cc79179f 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -9,11 +9,14 @@ * */ +#include +#include #include #include #include #include #include +#include #include "common.h" #include "config.h" diff --git a/src/diagnostic.c b/src/diagnostic.c index 16450bf6..edb3c53a 100644 --- a/src/diagnostic.c +++ b/src/diagnostic.c @@ -1,6 +1,9 @@ // SPDX-License-Identifier: MPL-2.0 // Copyright (c) 2018 Yuxuan Shui +#include +#include + #include "diagnostic.h" #include "config.h" #include "common.h" diff --git a/src/log.c b/src/log.c index 0f93dafd..4c09c695 100644 --- a/src/log.c +++ b/src/log.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include diff --git a/src/opengl.c b/src/opengl.c index e6dc9ce0..3f63cd7e 100644 --- a/src/opengl.c +++ b/src/opengl.c @@ -9,7 +9,12 @@ * */ +#include +#include #include +#include +#include +#include #include "compiler.h" #include "string_utils.h" diff --git a/src/opengl.h b/src/opengl.h index 87728254..47af38e5 100644 --- a/src/opengl.h +++ b/src/opengl.h @@ -18,8 +18,12 @@ #include "win.h" #include "log.h" +#include +#include +#include #include #include +#include /// @brief Wrapper of a GLX FBConfig. typedef struct glx_fbconfig { diff --git a/src/options.c b/src/options.c index 7832b7fc..b58583b5 100644 --- a/src/options.c +++ b/src/options.c @@ -4,14 +4,18 @@ #include #include #include +#include +#include +#include #include +#include // for xcb_render_fixed_t, XXX #include "common.h" +#include "config.h" #include "log.h" +#include "options.h" #include "utils.h" #include "win.h" -#include "config.h" -#include "options.h" #pragma GCC diagnostic error "-Wunused-parameter" @@ -466,8 +470,7 @@ static const struct option longopts[] = { /// Get config options that are needed to parse the rest of the options /// Return true if we should quit -bool get_early_config(int argc, char *const *argv, char **config_file, bool *all_xerrors, - int *exit_code) { +bool get_early_config(int argc, char *const *argv, char **config_file, bool *all_xerrors, int *exit_code) { int o = 0, longopt_idx = -1; // Pre-parse the commandline arguments to check for --config and invalid @@ -839,8 +842,7 @@ void get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable, DOUBLE_TO_XFIXED(1), DOUBLE_TO_XFIXED(1), }; - opt->blur_kerns[0] = - ccalloc(ARR_SIZE(convolution_blur), xcb_render_fixed_t); + opt->blur_kerns[0] = ccalloc(ARR_SIZE(convolution_blur), xcb_render_fixed_t); memcpy(opt->blur_kerns[0], convolution_blur, sizeof(convolution_blur)); } diff --git a/src/region.h b/src/region.h index e5483961..3e424d2f 100644 --- a/src/region.h +++ b/src/region.h @@ -2,6 +2,7 @@ // Copyright (c) 2018 Yuxuan Shui #pragma once #include +#include #include #include diff --git a/src/render.c b/src/render.c index 50211ec6..ae6cd071 100644 --- a/src/render.c +++ b/src/render.c @@ -1,12 +1,19 @@ // SPDX-License-Identifier: MPL-2.0 // Copyright (c) Yuxuan Shui +#include +#include #include +#include +#include +#include +#include #include "common.h" #include "options.h" #ifdef CONFIG_OPENGL +#include #include "opengl.h" #endif diff --git a/src/render.h b/src/render.h index fca0653c..c7b798e4 100644 --- a/src/render.h +++ b/src/render.h @@ -2,6 +2,7 @@ // Copyright (c) Yuxuan Shui #pragma once +#include #include #include #include "region.h" diff --git a/src/utils.c b/src/utils.c index 1707ee7d..d7e6b6f0 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1,4 +1,5 @@ #include +#include #include #include "compiler.h" diff --git a/src/vsync.c b/src/vsync.c index 18c37a84..18691473 100644 --- a/src/vsync.c +++ b/src/vsync.c @@ -3,6 +3,8 @@ /// Function pointers to init VSync modes. +#include + #include "common.h" #include "log.h" diff --git a/src/win.c b/src/win.c index 62424b57..7af304cd 100644 --- a/src/win.c +++ b/src/win.c @@ -3,11 +3,15 @@ // Copyright (c) 2013 Richard Grenville #include +#include +#include #include #include #include #include #include +#include +#include #include "compiler.h" #include "common.h" diff --git a/src/win.h b/src/win.h index 9c3ecfef..39a3eedc 100644 --- a/src/win.h +++ b/src/win.h @@ -3,11 +3,13 @@ // Copyright (c) 2013 Richard Grenville #pragma once #include +#include +#include #include // FIXME shouldn't need this #ifdef CONFIG_OPENGL -#include +#include #endif #include "x.h" diff --git a/src/x.c b/src/x.c index 00448971..1d9a7e98 100644 --- a/src/x.c +++ b/src/x.c @@ -1,12 +1,18 @@ // SPDX-License-Identifier: MPL-2.0 // Copyright (c) 2018 Yuxuan Shui #include +#include #include +#include #include #include #include +#include +#include +#include #include +#include #include "utils.h" #include "region.h"