!31 使用判断语句支持clang
From: @shen-chenbang Reviewed-by: @Charlie_li Signed-off-by: @Charlie_li
This commit is contained in:
commit
ac0d62929e
239
0004-clang-support.patch
Normal file
239
0004-clang-support.patch
Normal file
@ -0,0 +1,239 @@
|
|||||||
|
diff -uNr vdo-8.2.2.2-patchedbackup/utils/uds/Makefile vdo-8.2.2.2-patched/utils/uds/Makefile
|
||||||
|
--- vdo-8.2.2.2-patchedbackup/utils/uds/Makefile 2024-09-27 10:05:29.529846385 +0800
|
||||||
|
+++ vdo-8.2.2.2-patched/utils/uds/Makefile 2024-09-27 10:34:25.699840596 +0800
|
||||||
|
@@ -22,42 +22,46 @@
|
||||||
|
|
||||||
|
DEPDIR = .deps
|
||||||
|
|
||||||
|
-ifeq ($(origin CC), default)
|
||||||
|
- CC=gcc
|
||||||
|
-endif
|
||||||
|
-
|
||||||
|
ifeq ($(filter riscv64%,$(MAKE_HOST)),)
|
||||||
|
Wcast-align = -Wcast-align
|
||||||
|
endif
|
||||||
|
-WARNS = -Wall \
|
||||||
|
- $(Wcast-align) \
|
||||||
|
- -Werror \
|
||||||
|
- -Wextra \
|
||||||
|
- -Winit-self \
|
||||||
|
- -Wlogical-op \
|
||||||
|
- -Wmissing-include-dirs \
|
||||||
|
- -Wpointer-arith \
|
||||||
|
- -Wredundant-decls \
|
||||||
|
- -Wunused \
|
||||||
|
- -Wwrite-strings
|
||||||
|
-
|
||||||
|
-C_WARNS = -Wbad-function-cast \
|
||||||
|
- -Wcast-qual \
|
||||||
|
- -Wfloat-equal \
|
||||||
|
- -Wformat=2 \
|
||||||
|
- -Wmissing-declarations \
|
||||||
|
- -Wmissing-format-attribute \
|
||||||
|
- -Wmissing-prototypes \
|
||||||
|
- -Wnested-externs \
|
||||||
|
- -Wold-style-definition \
|
||||||
|
- -Wswitch-default
|
||||||
|
+
|
||||||
|
+# Define WARNS and C_WARNS only if using gcc
|
||||||
|
+CLANG_VERSION := $(shell $(CC) --version | grep -i clang)
|
||||||
|
+ifeq ($(findstring clang, $(CLANG_VERSION)),clang)
|
||||||
|
+WARNS =
|
||||||
|
+C_WARNS =
|
||||||
|
+else
|
||||||
|
+WARNS = -Wall \
|
||||||
|
+ $(Wcast-align) \
|
||||||
|
+ -Werror \
|
||||||
|
+ -Wextra \
|
||||||
|
+ -Winit-self \
|
||||||
|
+ -Wlogical-op \
|
||||||
|
+ -Wmissing-include-dirs \
|
||||||
|
+ -Wpointer-arith \
|
||||||
|
+ -Wredundant-decls \
|
||||||
|
+ -Wunused \
|
||||||
|
+ -Wwrite-strings
|
||||||
|
+
|
||||||
|
+C_WARNS = -Wbad-function-cast \
|
||||||
|
+ -Wcast-qual \
|
||||||
|
+ -Wfloat-equal \
|
||||||
|
+ -Wformat=2 \
|
||||||
|
+ -Wmissing-declarations \
|
||||||
|
+ -Wmissing-format-attribute \
|
||||||
|
+ -Wmissing-prototypes \
|
||||||
|
+ -Wnested-externs \
|
||||||
|
+ -Wold-style-definition \
|
||||||
|
+ -Wswitch-default
|
||||||
|
+endif
|
||||||
|
|
||||||
|
OPT_FLAGS = -O3 -fno-omit-frame-pointer
|
||||||
|
DEBUG_FLAGS =
|
||||||
|
RPM_OPT_FLAGS ?= -fpic
|
||||||
|
-GLOBAL_FLAGS = $(RPM_OPT_FLAGS) -D_GNU_SOURCE -g $(OPT_FLAGS) \
|
||||||
|
- $(WARNS) $(shell getconf LFS_CFLAGS) $(DEBUG_FLAGS) \
|
||||||
|
- -DCURRENT_VERSION='"$(BUILD_VERSION)"' \
|
||||||
|
+GLOBAL_FLAGS = $(RPM_OPT_FLAGS) -D_GNU_SOURCE -g $(OPT_FLAGS) \
|
||||||
|
+ $(WARNS) $(shell getconf LFS_CFLAGS) $(DEBUG_FLAGS) \
|
||||||
|
+ -DCURRENT_VERSION='"$(BUILD_VERSION)"'
|
||||||
|
|
||||||
|
CFLAGS = $(GLOBAL_FLAGS) -I. -std=gnu99 -pedantic $(C_WARNS) $(MY_CFLAGS)
|
||||||
|
LDFLAGS = $(RPM_LD_FLAGS) $(MY_LDFLAGS)
|
||||||
|
@@ -69,48 +73,48 @@
|
||||||
|
vpath %.c .
|
||||||
|
vpath %.c ./murmur
|
||||||
|
|
||||||
|
-UDS_OBJECTS = murmurhash3.o \
|
||||||
|
- buffer.o \
|
||||||
|
- buffered-reader.o \
|
||||||
|
- buffered-writer.o \
|
||||||
|
- chapter-index.o \
|
||||||
|
- config.o \
|
||||||
|
- delta-index.o \
|
||||||
|
- errors.o \
|
||||||
|
- event-count.o \
|
||||||
|
- fileIORegion.o \
|
||||||
|
- fileUtils.o \
|
||||||
|
- funnel-queue.o \
|
||||||
|
- geometry.o \
|
||||||
|
- hash-utils.o \
|
||||||
|
- index.o \
|
||||||
|
- index-layout.o \
|
||||||
|
- index-page-map.o \
|
||||||
|
- index-session.o \
|
||||||
|
- ioFactory.o \
|
||||||
|
- logger.o \
|
||||||
|
- memoryAlloc.o \
|
||||||
|
- minisyslog.o \
|
||||||
|
- open-chapter.o \
|
||||||
|
- page-cache.o \
|
||||||
|
- permassert.o \
|
||||||
|
- radix-sort.o \
|
||||||
|
- random.o \
|
||||||
|
- record-page.o \
|
||||||
|
- requestQueue.o \
|
||||||
|
- sparse-cache.o \
|
||||||
|
- string-utils.o \
|
||||||
|
- syscalls.o \
|
||||||
|
- threadCondVar.o \
|
||||||
|
- threadMutex.o \
|
||||||
|
- threadSemaphore.o \
|
||||||
|
- time-utils.o \
|
||||||
|
- uds-threads.o \
|
||||||
|
- volume.o \
|
||||||
|
- volume-index005.o \
|
||||||
|
- volume-index006.o \
|
||||||
|
- volume-index-ops.o \
|
||||||
|
- volume-store.o
|
||||||
|
+UDS_OBJECTS = murmurhash3.o \
|
||||||
|
+ buffer.o \
|
||||||
|
+ buffered-reader.o \
|
||||||
|
+ buffered-writer.o \
|
||||||
|
+ chapter-index.o \
|
||||||
|
+ config.o \
|
||||||
|
+ delta-index.o \
|
||||||
|
+ errors.o \
|
||||||
|
+ event-count.o \
|
||||||
|
+ fileIORegion.o \
|
||||||
|
+ fileUtils.o \
|
||||||
|
+ funnel-queue.o \
|
||||||
|
+ geometry.o \
|
||||||
|
+ hash-utils.o \
|
||||||
|
+ index.o \
|
||||||
|
+ index-layout.o \
|
||||||
|
+ index-page-map.o \
|
||||||
|
+ index-session.o \
|
||||||
|
+ ioFactory.o \
|
||||||
|
+ logger.o \
|
||||||
|
+ memoryAlloc.o \
|
||||||
|
+ minisyslog.o \
|
||||||
|
+ open-chapter.o \
|
||||||
|
+ page-cache.o \
|
||||||
|
+ permassert.o \
|
||||||
|
+ radix-sort.o \
|
||||||
|
+ random.o \
|
||||||
|
+ record-page.o \
|
||||||
|
+ requestQueue.o \
|
||||||
|
+ sparse-cache.o \
|
||||||
|
+ string-utils.o \
|
||||||
|
+ syscalls.o \
|
||||||
|
+ threadCondVar.o \
|
||||||
|
+ threadMutex.o \
|
||||||
|
+ threadSemaphore.o \
|
||||||
|
+ time-utils.o \
|
||||||
|
+ uds-threads.o \
|
||||||
|
+ volume.o \
|
||||||
|
+ volume-index005.o \
|
||||||
|
+ volume-index006.o \
|
||||||
|
+ volume-index-ops.o \
|
||||||
|
+ volume-store.o
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
all: libuds.a
|
||||||
|
@@ -129,7 +133,6 @@
|
||||||
|
%.s: %.c
|
||||||
|
$(CC) $(CFLAGS) -S $^
|
||||||
|
|
||||||
|
-
|
||||||
|
########################################################################
|
||||||
|
# Dependency processing
|
||||||
|
|
||||||
|
diff -uNr vdo-8.2.2.2-patchedbackup/utils/vdo/Makefile vdo-8.2.2.2-patched/utils/vdo/Makefile
|
||||||
|
--- vdo-8.2.2.2-patchedbackup/utils/vdo/Makefile 2024-09-27 10:05:29.529846385 +0800
|
||||||
|
+++ vdo-8.2.2.2-patched/utils/vdo/Makefile 2024-09-27 10:34:19.959840728 +0800
|
||||||
|
@@ -25,30 +25,34 @@
|
||||||
|
ifeq ($(filter riscv64%,$(MAKE_HOST)),)
|
||||||
|
Wcast-align = -Wcast-align
|
||||||
|
endif
|
||||||
|
-WARNS = \
|
||||||
|
- -Wall \
|
||||||
|
- $(Wcast-align) \
|
||||||
|
- -Werror \
|
||||||
|
- -Wextra \
|
||||||
|
- -Winit-self \
|
||||||
|
- -Wlogical-op \
|
||||||
|
- -Wmissing-include-dirs \
|
||||||
|
- -Wpointer-arith \
|
||||||
|
- -Wredundant-decls \
|
||||||
|
- -Wunused \
|
||||||
|
- -Wwrite-strings \
|
||||||
|
+CLANG_VERSION := $(shell $(CC) --version | grep -i clang)
|
||||||
|
+ifeq ($(findstring clang, $(CLANG_VERSION)),clang)
|
||||||
|
+WARNS =
|
||||||
|
+C_WARNS =
|
||||||
|
+else
|
||||||
|
+WARNS = -Wall \
|
||||||
|
+ $(Wcast-align) \
|
||||||
|
+ -Werror \
|
||||||
|
+ -Wextra \
|
||||||
|
+ -Winit-self \
|
||||||
|
+ -Wlogical-op \
|
||||||
|
+ -Wmissing-include-dirs \
|
||||||
|
+ -Wpointer-arith \
|
||||||
|
+ -Wredundant-decls \
|
||||||
|
+ -Wunused \
|
||||||
|
+ -Wwrite-strings
|
||||||
|
|
||||||
|
-C_WARNS = \
|
||||||
|
- -Wbad-function-cast \
|
||||||
|
- -Wcast-qual \
|
||||||
|
- -Wfloat-equal \
|
||||||
|
- -Wformat=2 \
|
||||||
|
- -Wmissing-declarations \
|
||||||
|
- -Wmissing-format-attribute \
|
||||||
|
- -Wmissing-prototypes \
|
||||||
|
- -Wnested-externs \
|
||||||
|
- -Wold-style-definition \
|
||||||
|
- -Wswitch-default \
|
||||||
|
+C_WARNS = -Wbad-function-cast \
|
||||||
|
+ -Wcast-qual \
|
||||||
|
+ -Wfloat-equal \
|
||||||
|
+ -Wformat=2 \
|
||||||
|
+ -Wmissing-declarations \
|
||||||
|
+ -Wmissing-format-attribute \
|
||||||
|
+ -Wmissing-prototypes \
|
||||||
|
+ -Wnested-externs \
|
||||||
|
+ -Wold-style-definition \
|
||||||
|
+ -Wswitch-default
|
||||||
|
+endif
|
||||||
|
|
||||||
|
ifeq ($(AR), ar)
|
||||||
|
ifeq ($(origin AR), default)
|
||||||
6
vdo.spec
6
vdo.spec
@ -1,6 +1,6 @@
|
|||||||
Name: vdo
|
Name: vdo
|
||||||
Version: 8.2.2.2
|
Version: 8.2.2.2
|
||||||
Release: 2
|
Release: 3
|
||||||
Summary: Management tools for Virtual Data Optimizer
|
Summary: Management tools for Virtual Data Optimizer
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
URL: http://github.com/dm-vdo/vdo
|
URL: http://github.com/dm-vdo/vdo
|
||||||
@ -8,6 +8,7 @@ Source0: https://github.com/dm-vdo/vdo/archive/refs/tags/%{version}.tar.gz
|
|||||||
Patch0001: 0001-Add-loongarch64-support.patch
|
Patch0001: 0001-Add-loongarch64-support.patch
|
||||||
Patch0002: 0002-fix_dmeventd_linking.patch
|
Patch0002: 0002-fix_dmeventd_linking.patch
|
||||||
Patch0003: 0003-RISC-V-support.patch
|
Patch0003: 0003-RISC-V-support.patch
|
||||||
|
Patch0004: 0004-clang-support.patch
|
||||||
|
|
||||||
BuildRequires: gcc libuuid-devel device-mapper-devel device-mapper-event-devel
|
BuildRequires: gcc libuuid-devel device-mapper-devel device-mapper-event-devel
|
||||||
BuildRequires: zlib-devel libblkid-devel
|
BuildRequires: zlib-devel libblkid-devel
|
||||||
@ -54,6 +55,9 @@ This package provides the user-space management tools for VDO.
|
|||||||
%{_mandir}/man8/*
|
%{_mandir}/man8/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Aug 27 2024 shenchenbang <1944340417@qq.com> - 8.2.2.2-3
|
||||||
|
- Fix add if else to support clang
|
||||||
|
|
||||||
* Sun Apr 28 2024 yinsist <jianhui.oerv@isrc.iscas.ac.cn> - 8.2.2.2-2
|
* Sun Apr 28 2024 yinsist <jianhui.oerv@isrc.iscas.ac.cn> - 8.2.2.2-2
|
||||||
- Valgrind does not support certain architectures like RISC-V, Before depending on Valgrind, first check if Valgrind supports the architecture
|
- Valgrind does not support certain architectures like RISC-V, Before depending on Valgrind, first check if Valgrind supports the architecture
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user