From d4ad02c7210b4b2936cee45b426db9e8e78a7bc4 Mon Sep 17 00:00:00 2001 From: makise-homura Date: Sat, 10 Jul 2021 03:57:06 +0300 Subject: [PATCH 1/3] Add support for MCST LCC compiler --- lib/common/compiler.h | 9 ++++++++- programs/zstdcli.c | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/common/compiler.h b/lib/common/compiler.h index 9e2a8fe70..cae0061a1 100644 --- a/lib/common/compiler.h +++ b/lib/common/compiler.h @@ -79,6 +79,13 @@ # define UNUSED_ATTR #endif +/* CONST_ARGC tells the compiler correct const argc specificator for -Wmain. */ +#if !defined(__LCC__) +# define CONST_ARGC const +#else +# define CONST_ARGC +#endif + /* force no inlining */ #ifdef _MSC_VER # define FORCE_NOINLINE static __declspec(noinline) @@ -151,7 +158,7 @@ /* vectorization * older GCC (pre gcc-4.3 picked as the cutoff) uses a different syntax */ -#if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) +#if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && !defined(__LCC__) # if (__GNUC__ == 4 && __GNUC_MINOR__ > 3) || (__GNUC__ >= 5) # define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize"))) # else diff --git a/programs/zstdcli.c b/programs/zstdcli.c index e496852f3..845610dc3 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -741,7 +741,7 @@ typedef enum { zom_compress, zom_decompress, zom_test, zom_bench, zom_train, zom # define MAXCLEVEL ZSTD_maxCLevel() #endif -int main(int const argCount, const char* argv[]) +int main(int CONST_ARGC argCount, const char* argv[]) { int argNb, followLinks = 0, From a5f518ae273ff0000bfd4c50689663f690f95d24 Mon Sep 17 00:00:00 2001 From: makise-homura Date: Wed, 14 Jul 2021 19:55:47 +0300 Subject: [PATCH 2/3] Change zstdcli's main() declaration due to -Wmain on some compilers --- lib/common/compiler.h | 7 ------- programs/zstdcli.c | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/common/compiler.h b/lib/common/compiler.h index cae0061a1..a01c30cc1 100644 --- a/lib/common/compiler.h +++ b/lib/common/compiler.h @@ -79,13 +79,6 @@ # define UNUSED_ATTR #endif -/* CONST_ARGC tells the compiler correct const argc specificator for -Wmain. */ -#if !defined(__LCC__) -# define CONST_ARGC const -#else -# define CONST_ARGC -#endif - /* force no inlining */ #ifdef _MSC_VER # define FORCE_NOINLINE static __declspec(noinline) diff --git a/programs/zstdcli.c b/programs/zstdcli.c index 845610dc3..9178a4bef 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -741,7 +741,7 @@ typedef enum { zom_compress, zom_decompress, zom_test, zom_bench, zom_train, zom # define MAXCLEVEL ZSTD_maxCLevel() #endif -int main(int CONST_ARGC argCount, const char* argv[]) +int main(int argCount, const char* argv[]) { int argNb, followLinks = 0, From 3cd085cec3cc805f19e52ec98bfe60e7f1543672 Mon Sep 17 00:00:00 2001 From: makise-homura Date: Wed, 14 Jul 2021 20:00:44 +0300 Subject: [PATCH 3/3] Clarify no-tree-vectorize usage for ICC and LCC --- lib/common/compiler.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/common/compiler.h b/lib/common/compiler.h index a01c30cc1..012ff0221 100644 --- a/lib/common/compiler.h +++ b/lib/common/compiler.h @@ -150,7 +150,8 @@ } /* vectorization - * older GCC (pre gcc-4.3 picked as the cutoff) uses a different syntax */ + * older GCC (pre gcc-4.3 picked as the cutoff) uses a different syntax, + * and some compilers, like Intel ICC and MCST LCC, do not support it at all. */ #if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && !defined(__LCC__) # if (__GNUC__ == 4 && __GNUC_MINOR__ > 3) || (__GNUC__ >= 5) # define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize")))