Some fixes for Clang compilation.

This commit is contained in:
OBattler
2023-07-27 02:33:40 +02:00
parent 21344a6496
commit d03399c1a5
2 changed files with 46 additions and 6 deletions

View File

@@ -269,8 +269,8 @@ else
endif
ifeq ($(CLANG), y)
CPP := ${TOOL_PREFIX}clang++
CC := ${TOOL_PREFIX}clang
CPP := clang++
CC := clang
else
CPP := ${TOOL_PREFIX}g++
CC := ${TOOL_PREFIX}gcc
@@ -304,17 +304,38 @@ ifeq ($(DEBUG), y)
ifndef COPTIM
COPTIM := -Og
endif
ifndef CXXOPTIM
ifeq ($(CLANG), y)
CXXOPTIM := -Os
else
CXXOPTIM := -Og
endif
endif
else
DFLAGS += -g0
ifeq ($(OPTIM), y)
AOPTIM := -mtune=native
ifndef COPTIM
COPTIM := -O3 -ffp-contract=fast -flto
CXXOPTIM := -O3 -ffp-contract=fast -flto
endif
ifndef CXXOPTIM
ifeq ($(CLANG), y)
CXXOPTIM := -Os -ffp-contract=fast -flto
else
CXXOPTIM := -O3 -ffp-contract=fast -flto
endif
endif
else
ifndef COPTIM
COPTIM := -O3
endif
ifndef CXXOPTIM
ifeq ($(CLANG), y)
CXXOPTIM := -Os
else
CXXOPTIM := -O3
endif
endif
endif
endif
ifeq ($(AVX), y)
@@ -531,7 +552,9 @@ CFLAGS := $(OPTS) $(DFLAGS) $(COPTIM) $(AOPTIM) \
# Add freetyp2 references through pkgconfig
CFLAGS := $(CFLAGS) `pkg-config --cflags freetype2`
CXXFLAGS := $(CFLAGS)
CXXFLAGS := $(OPTS) $(DFLAGS) $(CXXOPTIM) $(AOPTIM) \
$(AFLAGS) -fomit-frame-pointer -mstackrealign -Wall \
-fno-strict-aliasing
CFLAGS += -Werror=implicit-int -Werror=implicit-function-declaration \
-Werror=int-conversion -Werror=strict-prototypes -Werror=old-style-definition
@@ -811,13 +834,21 @@ else
endif
ifeq ($(RTMIDI), y)
LIBS += -lrtmidi -lwinmm
ifeq ($(CLANG), y)
LIBS += -lrtmidi.dll -lwinmm
else
LIBS += -lrtmidi -lwinmm
endif
endif
ifeq ($(VNC), y)
LIBS += $(VNCLIB) -lws2_32
endif
LIBS += -lpng -lz -lwsock32 -liphlpapi -lpsapi -lhid -lsetupapi -luxtheme -static -lstdc++
ifeq ($(CLANG), y)
LIBS += -lpng -lz -lwsock32 -liphlpapi -lpsapi -lhid -lsetupapi -luxtheme -static -lstdc++.dll
else
LIBS += -lpng -lz -lwsock32 -liphlpapi -lpsapi -lhid -lsetupapi -luxtheme -static -lstdc++
endif
ifneq ($(X64), y)
ifneq ($(ARM64), y)
LIBS += -Wl,--large-address-aware

View File

@@ -544,6 +544,10 @@ media_menu_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
int ret = 0;
int wp = 0;
#ifdef __clang__
BROWSEINFO bi;
#endif
id = LOWORD(wParam) & 0x00ff;
switch (LOWORD(wParam) & 0xff00) {
@@ -651,10 +655,15 @@ media_menu_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
case IDM_CDROM_DIR:
#ifndef __clang__
BROWSEINFO bi = {
.hwndOwner = hwnd,
.ulFlags = BIF_EDITBOX
};
#else
bi.hwndOwner = hwnd;
bi.ulFlags = BIF_EDITBOX;
#endif
OleInitialize(NULL);
int old_dopause = dopause;
plat_pause(1);