binpac: Add cmake-format and typos pre-commit configs

This commit is contained in:
Tim Wojtulewicz 2023-10-30 13:16:15 -07:00
parent 3297de477b
commit 964817f9bf
8 changed files with 108 additions and 104 deletions

View file

@ -1,16 +1,22 @@
bison_target(PACParser pac_parse.yy ${BinPAC_BINARY_DIR}/src/pac_parse.cc
DEFINES_FILE ${BinPAC_BINARY_DIR}/src/pac_parse.h
COMPILE_FLAGS "--debug")
bison_target(
PACParser pac_parse.yy ${BinPAC_BINARY_DIR}/src/pac_parse.cc
DEFINES_FILE ${BinPAC_BINARY_DIR}/src/pac_parse.h
COMPILE_FLAGS "--debug")
flex_target(PACScanner pac_scan.ll ${BinPAC_BINARY_DIR}/pac_scan.cc)
add_flex_bison_dependency(PACScanner PACParser)
if (MSVC)
set_property(SOURCE pac_scan.cc APPEND_STRING PROPERTY COMPILE_FLAGS "/wd4018")
if(MSVC)
set_property(
SOURCE pac_scan.cc
APPEND_STRING
PROPERTY COMPILE_FLAGS "/wd4018")
else()
set_property(SOURCE pac_scan.cc APPEND_STRING PROPERTY COMPILE_FLAGS "-Wno-sign-compare")
set_property(
SOURCE pac_scan.cc
APPEND_STRING
PROPERTY COMPILE_FLAGS "-Wno-sign-compare")
endif()
include_directories(${PROJECT_SOURCE_DIR}/src
${PROJECT_BINARY_DIR}/src)
include_directories(${PROJECT_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src)
set(binpac_SRCS
${BISON_PACParser_INPUT}
@ -98,25 +104,25 @@ set(binpac_SRCS
pac_typedecl.h
pac_utils.h
pac_varfield.h
pac_withinput.h
)
pac_withinput.h)
add_executable(binpac ${binpac_SRCS})
target_compile_features(binpac PRIVATE cxx_std_17)
set_target_properties(binpac PROPERTIES CXX_EXTENSIONS OFF)
if ( MSVC )
# If building separately from zeek, we need to add the libunistd subdirectory so
# that linking doesn't fail.
if ("${CMAKE_PROJECT_NAME}" STREQUAL "BinPAC")
add_subdirectory(auxil/libunistd EXCLUDE_FROM_ALL)
endif()
target_link_libraries(binpac PRIVATE libunistd)
if(MSVC)
# If building separately from zeek, we need to add the libunistd subdirectory
# so that linking doesn't fail.
if("${CMAKE_PROJECT_NAME}" STREQUAL "BinPAC")
add_subdirectory(auxil/libunistd EXCLUDE_FROM_ALL)
endif()
target_link_libraries(binpac PRIVATE libunistd)
endif()
install(TARGETS binpac DESTINATION bin)
# This is set to assist superprojects that want to build BinPac
# from source and rely on it as a target
set(BinPAC_EXE binpac
# This is set to assist superprojects that want to build BinPac from source and
# rely on it as a target
set(BinPAC_EXE
binpac
CACHE STRING "BinPAC executable" FORCE)

View file

@ -55,7 +55,7 @@ public:
//
const char* EvalExpr(Output* out, Env* env);
// force evaulation of IDs contained in this expression;
// force evaluation of IDs contained in this expression;
// necessary with case expr and conditional let fields (&if)
// for correct parsing of fields
void ForceIDEval(Output* out_cc, Env* env);

View file

@ -5,8 +5,8 @@
// ExternType represent external C++ types that are not defined in
// PAC specification (therefore they cannot appear in data layout
// spefication, e.g., in a record field). The type name is copied
// literally to the compiled code.
// specification, e.g., in a record field). The type name is copied
// literally to the compiled code.
class ExternType : public Type {
public: