/tmp/acl-master/lib_acl/src/stdlib/common/acl_hash.c:500:4: note: in expansion of macro ‘HASHC’ HASHC; ^~~~~ /tmp/acl-master/lib_acl/src/stdlib/common/acl_hash.c:501:2: note: here case 3: ^~~~ /tmp/acl-master/lib_acl/src/stdlib/common/acl_hash.c:484:17: error: this statement may fall through [-Werror=implicit-fallthrough=] #define HASHC n = *k++ + 65599 * n ~~^~~~~~~~~~~~~~~~~~
gcc --version gcc (GCC) 8.1.1 20180531 Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
在高版本clang/gcc中,需要加入-Wno-implicit-fallthrough
另外,这个文件涉及到中文注释是gbk编码的,最好还是转成utf-8比较好
在 lib_acl/Makefile 文件中有针对 gcc 版本的判断,如下: ifeq ($(findstring gcc, $(CC)), gcc) CFLAGS += -Wstrict-prototypes GCC_VERSION=$(shell gcc --version | grep ^gcc | sed 's/^.* //g') GCC_MAJOR:=$(shell echo "$(GCC_VERSION)" | cut -d'.' -f1) GCC_MINOR:=$(shell echo "$(GCC_VERSION)" | cut -d'.' -f2) GCC_SUB:=$(shell echo "$(GCC_VERSION)" | cut -d'.' -f3) GCC_VER:=$(shell [ $(GCC_MAJOR) -gt 4 -o ( $(GCC_MAJOR) -eq 4 -a $(GCC_MINOR) -gt 4 ) ] && echo true) ifeq ($(GCC_VER), true) CFLAGS += -Wno-implicit-fallthrough endif endif
针对字符集编码问题,主要是为了兼容 VC,VC 针对 UTF8 要求得要有 BOM,所以目前暂时还是采用 GBK 编码,你可以使用一些工具,如 iconv 进行字符集转换
我用的cmake 。。可能这个和Makefile的配置还不太一样
cmake 也支持了,你可以试一下.
该提问来源于开源项目:acl-dev/acl