More compiler warning flags
This commit is contained in:
parent
4940a93f03
commit
3ce59930a4
24
Makefile
24
Makefile
|
@ -16,7 +16,11 @@ INCS =
|
||||||
OBJS = compton.o config.o
|
OBJS = compton.o config.o
|
||||||
|
|
||||||
# === Configuration flags ===
|
# === Configuration flags ===
|
||||||
CFG = -std=c11 -D_GNU_SOURCE
|
CFG = -std=c11 -D_GNU_SOURCE -Wall -Wextra -Wno-unused-parameter
|
||||||
|
|
||||||
|
ifeq "$(CC)" "clang"
|
||||||
|
CFG += -Wconditional-uninitialized
|
||||||
|
endif
|
||||||
|
|
||||||
# ==== Xinerama ====
|
# ==== Xinerama ====
|
||||||
# Enables support for --xinerama-shadow-crop
|
# Enables support for --xinerama-shadow-crop
|
||||||
|
@ -112,24 +116,22 @@ LDFLAGS ?= -Wl,-O1 -Wl,--as-needed
|
||||||
BUILD_TYPE ?= "Debug"
|
BUILD_TYPE ?= "Debug"
|
||||||
|
|
||||||
ifeq "$(BUILD_TYPE)" "Release"
|
ifeq "$(BUILD_TYPE)" "Release"
|
||||||
CFLAGS += -DNDEBUG -O2 -D_FORTIFY_SOURCE=2
|
CFG += -DNDEBUG -O2 -D_FORTIFY_SOURCE=2
|
||||||
else ifeq "$(BUILD_TYPE)" "Debug"
|
else ifeq "$(BUILD_TYPE)" "Debug"
|
||||||
CFLAGS += -ggdb -Wshadow
|
CFG += -ggdb -Wshadow
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq "$(ENABLE_SAN)" "1"
|
ifeq "$(ENABLE_SAN)" "1"
|
||||||
CFLAGS += -fsanitize=address,undefined
|
CFG += -fsanitize=address,undefined
|
||||||
else ifeq "$(ENABLE_SAN)" "thread"
|
else ifeq "$(ENABLE_SAN)" "thread"
|
||||||
CFLAGS += -fsanitize=thread
|
CFG += -fsanitize=thread
|
||||||
else ifeq "$(ENABLE_SAN)" "memory"
|
else ifeq "$(ENABLE_SAN)" "memory"
|
||||||
CFLAGS += -fsanitize=memory
|
CFG += -fsanitize=memory
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LIBS += $(shell pkg-config --libs $(PACKAGES))
|
LIBS += $(shell pkg-config --libs $(PACKAGES))
|
||||||
INCS += $(shell pkg-config --cflags $(PACKAGES))
|
INCS += $(shell pkg-config --cflags $(PACKAGES))
|
||||||
|
|
||||||
CFLAGS += -Wall -Wimplicit-fallthrough
|
|
||||||
|
|
||||||
BINS = compton bin/compton-trans
|
BINS = compton bin/compton-trans
|
||||||
MANPAGES = man/compton.1 man/compton-trans.1
|
MANPAGES = man/compton.1 man/compton-trans.1
|
||||||
MANPAGES_HTML = $(addsuffix .html,$(MANPAGES))
|
MANPAGES_HTML = $(addsuffix .html,$(MANPAGES))
|
||||||
|
@ -138,7 +140,7 @@ MANPAGES_HTML = $(addsuffix .html,$(MANPAGES))
|
||||||
.DEFAULT_GOAL := compton
|
.DEFAULT_GOAL := compton
|
||||||
|
|
||||||
src/.clang_complete: Makefile
|
src/.clang_complete: Makefile
|
||||||
@(for i in $(filter-out -O% -DNDEBUG, $(CFG) $(CPPFLAGS) $(CFLAGS) $(INCS)); do echo "$$i"; done) > $@
|
@(for i in $(filter-out -O% -DNDEBUG, $(CFG) $(CPPFLAGS) $(INCS)); do echo "$$i"; done) > $@
|
||||||
|
|
||||||
.deps:
|
.deps:
|
||||||
mkdir -p .deps
|
mkdir -p .deps
|
||||||
|
@ -149,10 +151,10 @@ src/.clang_complete: Makefile
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $(DEP); \
|
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $(DEP); \
|
||||||
rm -f $@.$$$$
|
rm -f $@.$$$$
|
||||||
$(CC) $(CFG) $(CPPFLAGS) $(CFLAGS) $(INCS) -c src/$*.c
|
$(CC) $(CFG) $(CPPFLAGS) $(INCS) -c src/$*.c
|
||||||
|
|
||||||
compton: $(OBJS)
|
compton: $(OBJS)
|
||||||
$(CC) $(CFG) $(CPPFLAGS) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
|
$(CC) $(CFG) $(CPPFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
|
||||||
|
|
||||||
man/%.1: man/%.1.asciidoc
|
man/%.1: man/%.1.asciidoc
|
||||||
a2x --format manpage $<
|
a2x --format manpage $<
|
||||||
|
|
|
@ -2014,8 +2014,9 @@ rect_crop(XRectangle *pdst, const XRectangle *psrc, const XRectangle *pbound) {
|
||||||
*/
|
*/
|
||||||
static inline bool
|
static inline bool
|
||||||
rect_is_fullscreen(session_t *ps, int x, int y, unsigned wid, unsigned hei) {
|
rect_is_fullscreen(session_t *ps, int x, int y, unsigned wid, unsigned hei) {
|
||||||
return (x <= 0 && y <= 0
|
return (x <= 0 && y <= 0 &&
|
||||||
&& (x + wid) >= ps->root_width && (y + hei) >= ps->root_height);
|
(x + wid) >= (unsigned int)ps->root_width &&
|
||||||
|
(y + hei) >= (unsigned int)ps->root_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -170,7 +170,7 @@ parse_conv_kern_lst(session_t *ps, const char *src, XFixed **dest, int max) {
|
||||||
{ "9x9gaussian", "9,9,0.000000,0.000000,0.000001,0.000006,0.000012,0.000006,0.000001,0.000000,0.000000,0.000000,0.000003,0.000102,0.000849,0.001723,0.000849,0.000102,0.000003,0.000000,0.000001,0.000102,0.003493,0.029143,0.059106,0.029143,0.003493,0.000102,0.000001,0.000006,0.000849,0.029143,0.243117,0.493069,0.243117,0.029143,0.000849,0.000006,0.000012,0.001723,0.059106,0.493069,0.493069,0.059106,0.001723,0.000012,0.000006,0.000849,0.029143,0.243117,0.493069,0.243117,0.029143,0.000849,0.000006,0.000001,0.000102,0.003493,0.029143,0.059106,0.029143,0.003493,0.000102,0.000001,0.000000,0.000003,0.000102,0.000849,0.001723,0.000849,0.000102,0.000003,0.000000,0.000000,0.000000,0.000001,0.000006,0.000012,0.000006,0.000001,0.000000,0.000000," },
|
{ "9x9gaussian", "9,9,0.000000,0.000000,0.000001,0.000006,0.000012,0.000006,0.000001,0.000000,0.000000,0.000000,0.000003,0.000102,0.000849,0.001723,0.000849,0.000102,0.000003,0.000000,0.000001,0.000102,0.003493,0.029143,0.059106,0.029143,0.003493,0.000102,0.000001,0.000006,0.000849,0.029143,0.243117,0.493069,0.243117,0.029143,0.000849,0.000006,0.000012,0.001723,0.059106,0.493069,0.493069,0.059106,0.001723,0.000012,0.000006,0.000849,0.029143,0.243117,0.493069,0.243117,0.029143,0.000849,0.000006,0.000001,0.000102,0.003493,0.029143,0.059106,0.029143,0.003493,0.000102,0.000001,0.000000,0.000003,0.000102,0.000849,0.001723,0.000849,0.000102,0.000003,0.000000,0.000000,0.000000,0.000001,0.000006,0.000012,0.000006,0.000001,0.000000,0.000000," },
|
||||||
{ "11x11gaussian", "11,11,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000001,0.000006,0.000012,0.000006,0.000001,0.000000,0.000000,0.000000,0.000000,0.000000,0.000003,0.000102,0.000849,0.001723,0.000849,0.000102,0.000003,0.000000,0.000000,0.000000,0.000001,0.000102,0.003493,0.029143,0.059106,0.029143,0.003493,0.000102,0.000001,0.000000,0.000000,0.000006,0.000849,0.029143,0.243117,0.493069,0.243117,0.029143,0.000849,0.000006,0.000000,0.000000,0.000012,0.001723,0.059106,0.493069,0.493069,0.059106,0.001723,0.000012,0.000000,0.000000,0.000006,0.000849,0.029143,0.243117,0.493069,0.243117,0.029143,0.000849,0.000006,0.000000,0.000000,0.000001,0.000102,0.003493,0.029143,0.059106,0.029143,0.003493,0.000102,0.000001,0.000000,0.000000,0.000000,0.000003,0.000102,0.000849,0.001723,0.000849,0.000102,0.000003,0.000000,0.000000,0.000000,0.000000,0.000000,0.000001,0.000006,0.000012,0.000006,0.000001,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000," },
|
{ "11x11gaussian", "11,11,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000001,0.000006,0.000012,0.000006,0.000001,0.000000,0.000000,0.000000,0.000000,0.000000,0.000003,0.000102,0.000849,0.001723,0.000849,0.000102,0.000003,0.000000,0.000000,0.000000,0.000001,0.000102,0.003493,0.029143,0.059106,0.029143,0.003493,0.000102,0.000001,0.000000,0.000000,0.000006,0.000849,0.029143,0.243117,0.493069,0.243117,0.029143,0.000849,0.000006,0.000000,0.000000,0.000012,0.001723,0.059106,0.493069,0.493069,0.059106,0.001723,0.000012,0.000000,0.000000,0.000006,0.000849,0.029143,0.243117,0.493069,0.243117,0.029143,0.000849,0.000006,0.000000,0.000000,0.000001,0.000102,0.003493,0.029143,0.059106,0.029143,0.003493,0.000102,0.000001,0.000000,0.000000,0.000000,0.000003,0.000102,0.000849,0.001723,0.000849,0.000102,0.000003,0.000000,0.000000,0.000000,0.000000,0.000000,0.000001,0.000006,0.000012,0.000006,0.000001,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000," },
|
||||||
};
|
};
|
||||||
for (int i = 0;
|
for (unsigned int i = 0;
|
||||||
i < sizeof(CONV_KERN_PREDEF) / sizeof(CONV_KERN_PREDEF[0]); ++i)
|
i < sizeof(CONV_KERN_PREDEF) / sizeof(CONV_KERN_PREDEF[0]); ++i)
|
||||||
if (!strcmp(CONV_KERN_PREDEF[i].name, src))
|
if (!strcmp(CONV_KERN_PREDEF[i].name, src))
|
||||||
return parse_conv_kern_lst(ps, CONV_KERN_PREDEF[i].kern_str, dest, max);
|
return parse_conv_kern_lst(ps, CONV_KERN_PREDEF[i].kern_str, dest, max);
|
||||||
|
|
|
@ -451,7 +451,12 @@ glx_init_blur(session_t *ps) {
|
||||||
{
|
{
|
||||||
int wid = XFixedToDouble(kern[0]), hei = XFixedToDouble(kern[1]);
|
int wid = XFixedToDouble(kern[0]), hei = XFixedToDouble(kern[1]);
|
||||||
int nele = wid * hei - 1;
|
int nele = wid * hei - 1;
|
||||||
int len = strlen(FRAG_SHADER_BLUR_PREFIX) + strlen(sampler_type) + strlen(extension) + (strlen(shader_add) + strlen(texture_func) + 42) * nele + strlen(FRAG_SHADER_BLUR_SUFFIX) + strlen(texture_func) + 12 + 1;
|
unsigned int len = strlen(FRAG_SHADER_BLUR_PREFIX) +
|
||||||
|
strlen(sampler_type) +
|
||||||
|
strlen(extension) +
|
||||||
|
(strlen(shader_add) + strlen(texture_func) + 42) * nele +
|
||||||
|
strlen(FRAG_SHADER_BLUR_SUFFIX) +
|
||||||
|
strlen(texture_func) + 12 + 1;
|
||||||
char *shader_str = calloc(len, sizeof(char));
|
char *shader_str = calloc(len, sizeof(char));
|
||||||
if (!shader_str) {
|
if (!shader_str) {
|
||||||
printf_errf("(): Failed to allocate %d bytes for shader string.", len);
|
printf_errf("(): Failed to allocate %d bytes for shader string.", len);
|
||||||
|
@ -1899,7 +1904,7 @@ glx_create_program_from_str(const char *vert_shader_str,
|
||||||
|
|
||||||
{
|
{
|
||||||
GLuint shaders[2];
|
GLuint shaders[2];
|
||||||
int count = 0;
|
unsigned int count = 0;
|
||||||
if (vert_shader)
|
if (vert_shader)
|
||||||
shaders[count++] = vert_shader;
|
shaders[count++] = vert_shader;
|
||||||
if (frag_shader)
|
if (frag_shader)
|
||||||
|
|
Loading…
Reference in New Issue