Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Clangd errors #339

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ARCH32 = -m32 -mtune=generic
ARCH64 = -march=x86-64 -mtune=generic
ARCH = ${ARCH64}
# General compiler flags
COMPILE_FLAGS = ${CFLAGS} ${PRELINKERFLAGS} -DXINERAMA -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L
COMPILE_FLAGS = ${CCFLAGS} ${PRELINKERFLAGS} -DXINERAMA -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L
# Additional release-specific flags
RCOMPILE_FLAGS = -DNDEBUG ${RELEASES}
# Additional debug-specific flags
Expand Down Expand Up @@ -81,8 +81,8 @@ INSTALL_DATA = $(INSTALL) -m 644

# Append pkg-config specific libraries if need be
ifneq ($(LIBRARIES),)
COMPILE_FLAGS += $(shell pkg-config --cflags $(LIBRARIES))
LINK_FLAGS += $(shell pkg-config --libs $(LIBRARIES))
COMPILE_FLAGS += `pkg-config --cflags $(LIBRARIES)`
LINK_FLAGS += `pkg-config --libs $(LIBRARIES)`
endif

# Verbose option, to output compile and link commands
Expand Down Expand Up @@ -243,7 +243,7 @@ $(BIN_PATH)/$(BIN_NAME): $(OBJECTS)
# After the first compilation they will be joined with the rules from the
# dependency files to provide header dependencies
$(BUILD_PATH)/%.o: $(SRC_PATH)/%.$(SRC_EXT)
@echo "Building: $< -> $@"
# @echo "Building: $< -> $@"
# @$(START_TIME)
$(CMD_PREFIX)$(CC) $(CFLAGS) $(INCLUDES) -MP -MMD -c $< -o $@
# @echo -en "\t Compile time: "
Expand Down
19 changes: 10 additions & 9 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ MANPREFIX = ${PREFIX}/share/man
# grep -r xcb

# fallback
XCB_INCS_PKG = `pkg-config --cflags --libs xcb xcb-util xcb-aux xcb-xinerama xcb-event xcb-keysyms xcb-xinput xcb-image`
XCB_INCS = -Ixcb -Ixcb-util -Ixcb-aux -Ixcb-xinerama -Ixcb-event -Ixcb-keysyms -Ixcb-xinput -Ixcb-image
TOOLS = -Itools
INCLUDE_INCS = -Iinclude
INCS = ${XCB_INCS} ${INCLUDE_INCS} ${TOOLS}

INCLUDE_LIST = tools include -Ixcb -Ixcb-util -Ixcb-aux -Ixcb-xinerama -Ixcb-event -Ixcb-keysyms -Ixcb-xinput -Ixcb-image
INCS = $(foreach dir, ${INCLUDE_LIST}, -I${dir})
#${INCLUDE_INCS} ${TOOLS}
#-lxcb-util -lxcb-icccm -lxcb-keysyms
LIBS = ${XCB_INCS_PKG} -lX11
LIBS = xcb xcb-util xcb-aux xcb-xinerama xcb-event xcb-keysyms xcb-xinput xcb-image
#x11 xcb xcb-util xcb-aux xcb-xinerama xcb-event xcb-keysyms xcb-xinput xcb-image
#${XCB_INCS} x11

CCVERSION = -std=c99
XNATIVE = -march=native -mtune=native
Expand All @@ -40,11 +41,11 @@ ifeq ($(CC), clang)
LINKTIMEOPTIMIZATIONS =
endif

PRELINKERFLAGS = -fstack-protector-strong -fstack-clash-protection -fpie ${LINKTIMEOPTIMIZATIONS} ${SECTIONCODE} ${LINKMODE}
PRELINKERFLAGS = -fstack-protector-strong -fstack-clash-protection -fpie ${LINKTIMEOPTIMIZATIONS} ${SECTIONCODE}

# can set higher but function overhead is pretty small so meh
INLINELIMIT = 15
LINKERFLAGS = ${LINKMODE} -Wl,--gc-sections,--as-needed,--relax,-z,relro,-z,now,-z,noexecstack,-z,defs,-pie -finline-limit=${INLINELIMIT} ${LINKTIMEOPTIMIZATIONS}
LINKFLAGS = ${LINKMODE} -Wl,--gc-sections,--as-needed,--relax,-z,relro,-z,now,-z,noexecstack,-z,defs,-pie -finline-limit=${INLINELIMIT} ${LINKTIMEOPTIMIZATIONS}

BINARY = ${X64}
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L ${XINERAMAFLAGS}
Expand All @@ -68,6 +69,6 @@ RELEASES= ${RELEASEFLAGS} -O3
BUILDSELF = ${RELEASEFLAGS} ${XNATIVE} -O3

# Linker flags
LDFLAGS = ${LIBS} ${LINKERFLAGS} ${BINARY}
LINKERFLAGS = ${LINKFLAGS} ${BINARY}
# Solaris
#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
2 changes: 1 addition & 1 deletion include/client.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _WM_CLIENT_H
#define _WM_CLIENT_H

#include "XCB-TRL/xcb_trl.h"
#include "../tools/XCB-TRL/xcb_trl.h"
#include "decorations.h"

#include <stdint.h>
Expand Down
2 changes: 1 addition & 1 deletion include/decorations.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define _WM_DECORATIONS_H_


#include "XCB-TRL/xcb_trl.h"
#include "../tools/XCB-TRL/xcb_trl.h"

typedef struct Decoration Decoration;

Expand Down
2 changes: 1 addition & 1 deletion include/getprop.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ enum PropertyType
PropLAST,
};

void PropInit();
void PropInit(void);
void PropDestroy(void);
void PropListen(XCBDisplay *display, XCBWindow win, enum PropertyType type);

Expand Down
2 changes: 1 addition & 1 deletion include/hashing.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _HASHING_HELPER_H
#define _HASHING_HELPER_H

#include "XCB-TRL/xcb_trl.h"
#include "../tools/XCB-TRL/xcb_trl.h"

struct Client;

Expand Down
6 changes: 1 addition & 5 deletions include/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@
#include "desktop.h"
#include "monitor.h"
#include "x.h"
#include "util.h"
#include "XCB-TRL/xcb_trl.h"
#include "XCB-TRL/xcb_winutil.h"
#include "XCB-TRL/xcb_gtk.h"
#include "XCB-TRL/xcb_xembed.h"
#include "../tools/util.h"


#ifndef VERSION
Expand Down
5 changes: 4 additions & 1 deletion include/x.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@


#include <stdint.h>
#include "XCB-TRL/xcb_trl.h"
#include "../tools/XCB-TRL/xcb_trl.h"
#include "../tools/XCB-TRL/xcb_winutil.h"
#include "../tools/XCB-TRL/xcb_gtk.h"
#include "../tools/XCB-TRL/xcb_xembed.h"



Expand Down
5 changes: 0 additions & 5 deletions src/client.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
#include <math.h> /* fabsf() */

#include "client.h"

#include "desktop.h"

#include "main.h"
#include "keybinds.h"
#include "util.h"
#include "hashing.h"

#include <string.h>
Expand Down
2 changes: 2 additions & 0 deletions src/desktop.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ attachfocusbefore(Client *start, Client *after)
Desktop *desk = start->desktop;
detachfocus(after);
__attach_before(start, after, fnext, fprev, desk->focus, desk->slast, attachfocus);
/* block 'unused' variable warnings */
(void)desk;
}

void
Expand Down
2 changes: 2 additions & 0 deletions src/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,8 @@ visibilitynotify(XCBGenericEvent *event)
const XCBWindow win = ev->window;
const u8 state = ev->state;

(void)win;

switch(state)
{
case XCB_VISIBILITY_UNOBSCURED:
Expand Down
5 changes: 2 additions & 3 deletions src/getprop.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ static PropHandler __prop_handler[PropLAST] =


static void
LockMainThread()
LockMainThread(void)
{
if(__threads.use_threads)
{ pthread_mutex_lock(&_wm.mutex);
}
}

static void
UnlockMainThread()
UnlockMainThread(void)
{
if(__threads.use_threads)
{ pthread_mutex_unlock(&_wm.mutex);
Expand Down Expand Up @@ -481,7 +481,6 @@ static void
PropCreateWorkers(uint32_t threads)
{
int32_t i;
pthread_t id = 0;
for(i = 0; i < threads; ++i)
{ CreateWorker(&__threads.threads[i]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ X11GTKSetUseCSD(
}

void
X11GTK(
X11GTK(void
)
{
}
1 change: 0 additions & 1 deletion src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,6 @@ SCParserNewVar(
}
}

SCItem *items = parser->items;
SCItem *item = parser->items + parser->index;

if(_optional_type == SCTypeSTRING)
Expand Down
2 changes: 1 addition & 1 deletion src/toggle.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extern void (*handler[XCBLASTEvent]) (XCBGenericEvent *);
extern WM _wm;
extern XCBCursor cursors[CurLast];

static const char *
const char const*
GET_BOOL(i64 x)
{
if(x)
Expand Down
6 changes: 4 additions & 2 deletions tests/ssname.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


void
func()
func(void)
{
/* TODO, without this XServer sends way too many requests way too fast causing the window manager to hang till the event queue is clear.
* A malicious app could hang the window manager.
Expand All @@ -23,11 +23,13 @@ func()
* What shouldnt happen is the window manager crashes, (adress sanatizer) due to buffer overrun.
*/
int
back()
back(void)
{
Display *dpy = XOpenDisplay(NULL);
int screen = DefaultScreen(dpy);

(void)screen;

Window root = DefaultRootWindow(dpy);

Window win = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0);
Expand Down
6 changes: 3 additions & 3 deletions tools/XCB-TRL/xcb_trl.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ XCBBreakPoint(void)
#endif

char *
XCBDebugGetCallStack()
XCBDebugGetCallStack(void)
{
char *stack = NULL;
#ifdef DBG
Expand Down Expand Up @@ -285,7 +285,7 @@ XCBDebugGetCallStack()
}

char *
XCBDebugGetLastCall()
XCBDebugGetLastCall(void)
{
const char *lastcall = NULL;
#ifdef DBG
Expand All @@ -300,7 +300,7 @@ XCBDebugGetLastCall()
}

char *
XCBDebugGetFirstCall()
XCBDebugGetFirstCall(void)
{
char *firstcall = NULL;
#if DBG
Expand Down