Genivia / RE-flex

A high-performance C++ regex library and lexical analyzer generator with Unicode support. Extends Flex++ with Unicode support, indent/dedent anchors, lazy quantifiers, functions for lex and syntax error reporting and more. Seamlessly integrates with Bison and other parsers.
https://www.genivia.com/doc/reflex/html
BSD 3-Clause "New" or "Revised" License
504 stars 85 forks source link

build error with HAVE_AVX512BW #188

Closed haihuayang closed 1 year ago

haihuayang commented 1 year ago

Hi, I got the following error with clang-13 because it detected HAVE_AVX512BW

c++ -Wall -Wunused -Wextra -O2 -I. -I../include -mavx512bw -DHAVE_AVX512BW -c matcher_avx2.cpp
matcher_avx2.cpp:39:4: error: matcher_avx2.cpp must be compiled with -mavx2 or /arch:avx2.
#  error matcher_avx2.cpp must be compiled with -mavx2 or /arch:avx2.
   ^
1 error generated.

do you think if the workaround is good?

diff --git a/RE-flex-3.3.6/lib/matcher_avx2.cpp b/RE-flex-3.3.6/lib/matcher_avx2.cpp
index d2b4bef642..f560af6ad9 100644
--- a/RE-flex-3.3.6/lib/matcher_avx2.cpp
+++ b/RE-flex-3.3.6/lib/matcher_avx2.cpp
@@ -34,8 +34,8 @@
 @copyright (c) BSD-3 License - see LICENSE.txt
 */

-#if defined(HAVE_AVX2) || defined(HAVE_AVX512BW)
-# if !defined(__AVX2__) || defined(__AVX512BW__)
+#if defined(HAVE_AVX2)
+# if !defined(__AVX2__)
 #  error matcher_avx2.cpp must be compiled with -mavx2 or /arch:avx2.
 # endif
 #endif
genivia-inc commented 1 year ago

Looks good. Thanks for the feedback!

I should check with an AVX512 capable machine more often. I may have overlooked this problem after an update. Sorry for that.