From df927cf7d62fdb6f1ee3ce37575b32044270e4ea Mon Sep 17 00:00:00 2001 From: servostar Date: Wed, 24 Apr 2024 22:47:59 +0200 Subject: [PATCH] fixed flag error and made option nounistd in lexer depend on compiler used --- CMakeLists.txt | 7 ++++++- src/lex/lexer.l | 3 --- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f27873..1cfeefc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,11 @@ add_custom_command(OUTPUT ${LEX_GENERATED_SOURCE_FILE} COMMENT "generate C source file for lexer" VERBATIM) +# remove dependency when compiling with MSVC on windows +if (MSVC) + add_compile_definitions(YY_NO_UNISTD_H) +endif() + # ------------------------------------------------ # # Yacc # # ------------------------------------------------ # @@ -140,7 +145,7 @@ set_target_properties(check if (MSVC) set(CHECK_FLAGS /DEBUG /WX) else() - set(DEBUG_FLAGS -g /Werror) + set(DEBUG_FLAGS -g -Werror) endif() # compiler flags targeting a GCC debug environment diff --git a/src/lex/lexer.l b/src/lex/lexer.l index c1efd4f..8823195 100644 --- a/src/lex/lexer.l +++ b/src/lex/lexer.l @@ -12,9 +12,6 @@ %option nounput %option noinput -/* prevent depency of unistd.h */ -%option nounistd - %% "\n" yyLineNumber++;