From 23b3135ae7245fd2eb82045201123c65e4932cd4 Mon Sep 17 00:00:00 2001 From: g012 Date: Thu, 28 Sep 2017 12:06:33 +0200 Subject: [PATCH] Fixed linux x86_64 compilation. --- CMakeLists.txt | 8 ++++---- embed.c | 2 +- lpeg.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d550f5..1a7693e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,9 +62,8 @@ else () add_definitions(-D_FILE_OFFSET_BITS=64) - add_compile_options(-fno-strict-aliasing -fomit-frame-pointer -ffast-math -fvisibility=hidden -fno-threadsafe-statics -fvisibility-inlines-hidden) - add_compile_options(-fno-rtti -fno-exceptions) - add_compile_options(-Werror -Wsign-compare -Wno-dangling-else -Wno-missing-braces -Wno-unused-function -Wno-shift-op-parentheses -Wno-unused-variable -Wno-switch -Wno-parentheses) + add_compile_options(-fno-strict-aliasing -fomit-frame-pointer -ffast-math -fvisibility=hidden) + add_compile_options(-Wsign-compare -Wno-missing-braces -Wno-unused-function -Wno-unused-variable -Wno-switch -Wno-parentheses) endif() @@ -93,6 +92,7 @@ set(L65_SCRIPTS ) add_executable(embed ${L65_SOURCE_DIR}/embed.c) +set_property(TARGET embed PROPERTY C_STANDARD 99) add_custom_command( OUTPUT ${L65_BINARY_DIR}/scripts.h COMMAND embed -o ${L65_BINARY_DIR}/scripts.h ${L65_SCRIPTS} @@ -101,7 +101,6 @@ add_custom_command( add_custom_target(prereq DEPENDS ${L65_BINARY_DIR}/scripts.h) add_executable(${PROJECT_NAME} ${L65_SOURCES} ${L65_HEADERS} ${L65_RESOURCES}) add_dependencies(${PROJECT_NAME} prereq) - set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) target_include_directories(${PROJECT_NAME} PRIVATE "${L65_SOURCE_DIR}" "${L65_BINARY_DIR}") @@ -115,4 +114,5 @@ elseif (UNIX) endif() +target_link_libraries(embed ${LINKLIBS}) target_link_libraries(${PROJECT_NAME} ${LINKLIBS}) diff --git a/embed.c b/embed.c index bc4234a..3f95f73 100644 --- a/embed.c +++ b/embed.c @@ -116,7 +116,7 @@ static int pmain(lua_State* L) int size = (int)ftell(l); rewind(l); unsigned char *buffer = malloc(size); - if (size != fread(buffer, 1, size, l)) fatal("failed reading input file"); + if (size != (int)fread(buffer, 1, size, l)) fatal("failed reading input file"); fclose(l); fprintf(f, "static const char %s[] = {", name); for (int i = 0; i < size; ++i) diff --git a/lpeg.c b/lpeg.c index 9b23f6a..db0d3b8 100644 --- a/lpeg.c +++ b/lpeg.c @@ -283,7 +283,7 @@ typedef struct Pattern { /* number of children for each tree */ -extern const byte numsiblings[]; +static const byte numsiblings[]; /* access to children */ #define sib1(t) ((t) + 1)