| author | |
| committer | |
| log | baf5167171fa0159adb8bd55c6a111b006f8c038 |
| tree | 47f207dea456ffb79c38fbab0fac32707a4e2778 |
| parent | fefbee166d68d17dd0d5904fc52f72397fb51092 |
6 files changed, 16 insertions(+), 16 deletions(-)
CMakeLists.txt+3-4| ... | @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8) | ... | @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8) |
| 3 | set(CMAKE_BUILD_TYPE "Debug" CACHE STRING | 3 | set(CMAKE_BUILD_TYPE "Debug" CACHE STRING |
| 4 | "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) | 4 | "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) |
| 5 | 5 | ||
| 6 | project(zig C CXX) | 6 | project(zig CXX) |
| 7 | set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) | 7 | set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) |
| 8 | 8 | ||
| 9 | set(ZIG_VERSION_MAJOR 0) | 9 | set(ZIG_VERSION_MAJOR 0) |
| ... | @@ -40,14 +40,13 @@ configure_file ( | ... | @@ -40,14 +40,13 @@ configure_file ( |
| 40 | ${CONFIGURE_OUT_FILE} | 40 | ${CONFIGURE_OUT_FILE} |
| 41 | ) | 41 | ) |
| 42 | 42 | ||
| 43 | set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wno-unused-variable -Wno-unused-but-set-variable") | 43 | set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wno-unused-variable -Wno-unused-but-set-variable") |
| 44 | 44 | ||
| 45 | set(EXE_CFLAGS "-std=c++11 -Werror -Wall -Werror=strict-prototypes -Werror=old-style-definition -Werror=missing-prototypes") | 45 | set(EXE_CFLAGS "-std=c++11 -fno-exceptions -fno-rtti -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Werror -Wall -Werror=strict-prototypes -Werror=old-style-definition -Werror=missing-prototypes") |
| 46 | 46 | ||
| 47 | 47 | ||
| 48 | add_executable(zig ${ZIG_SOURCES}) | 48 | add_executable(zig ${ZIG_SOURCES}) |
| 49 | set_target_properties(zig PROPERTIES | 49 | set_target_properties(zig PROPERTIES |
| 50 | LINKER_LANGUAGE C | ||
| 51 | COMPILE_FLAGS ${EXE_CFLAGS}) | 50 | COMPILE_FLAGS ${EXE_CFLAGS}) |
| 52 | target_link_libraries(zig LINK_PUBLIC | 51 | target_link_libraries(zig LINK_PUBLIC |
| 53 | ${LLVM_LIBRARIES} | 52 | ${LLVM_LIBRARIES} |
README.md-1| ... | @@ -40,7 +40,6 @@ readable, safe, optimal, and concise code to solve any computing problem. | ... | @@ -40,7 +40,6 @@ readable, safe, optimal, and concise code to solve any computing problem. |
| 40 | 40 | ||
| 41 | ## Roadmap | 41 | ## Roadmap |
| 42 | 42 | ||
| 43 | * Produce executable file instead of .o file. | ||
| 44 | * Add debugging symbols. | 43 | * Add debugging symbols. |
| 45 | * Debug/Release mode. | 44 | * Debug/Release mode. |
| 46 | * C style comments. | 45 | * C style comments. |
src/buffer.hpp+2| ... | @@ -13,6 +13,8 @@ | ... | @@ -13,6 +13,8 @@ |
| 13 | #include <assert.h> | 13 | #include <assert.h> |
| 14 | #include <stdint.h> | 14 | #include <stdint.h> |
| 15 | 15 | ||
| 16 | #define BUF_INIT {{0}} | ||
| 17 | |||
| 16 | struct Buf { | 18 | struct Buf { |
| 17 | ZigList<char> list; | 19 | ZigList<char> list; |
| 18 | }; | 20 | }; |
src/codegen.cpp+1-1| ... | @@ -423,7 +423,7 @@ void code_gen_link(CodeGen *g, bool is_static, const char *out_file) { | ... | @@ -423,7 +423,7 @@ void code_gen_link(CodeGen *g, bool is_static, const char *out_file) { |
| 423 | LLVMTargetMachineRef target_machine = LLVMCreateTargetMachine(target_ref, native_triple, | 423 | LLVMTargetMachineRef target_machine = LLVMCreateTargetMachine(target_ref, native_triple, |
| 424 | native_cpu, native_features, opt_level, reloc_mode, LLVMCodeModelDefault); | 424 | native_cpu, native_features, opt_level, reloc_mode, LLVMCodeModelDefault); |
| 425 | 425 | ||
| 426 | Buf out_file_o = {0}; | 426 | Buf out_file_o = BUF_INIT; |
| 427 | buf_init_from_str(&out_file_o, out_file); | 427 | buf_init_from_str(&out_file_o, out_file); |
| 428 | buf_append_str(&out_file_o, ".o"); | 428 | buf_append_str(&out_file_o, ".o"); |
| 429 | 429 |
src/parser.cpp+3-2| ... | @@ -10,7 +10,8 @@ | ... | @@ -10,7 +10,8 @@ |
| 10 | #include <stdarg.h> | 10 | #include <stdarg.h> |
| 11 | #include <stdio.h> | 11 | #include <stdio.h> |
| 12 | 12 | ||
| 13 | void ast_error(Token *token, const char *format, ...) { | 13 | __attribute__ ((format (printf, 2, 3))) |
| 14 | static void ast_error(Token *token, const char *format, ...) { | ||
| 14 | int line = token->start_line + 1; | 15 | int line = token->start_line + 1; |
| 15 | int column = token->start_column + 1; | 16 | int column = token->start_column + 1; |
| 16 | 17 | ||
| ... | @@ -221,7 +222,7 @@ static void parse_string_literal(ParseContext *pc, Token *token, Buf *buf) { | ... | @@ -221,7 +222,7 @@ static void parse_string_literal(ParseContext *pc, Token *token, Buf *buf) { |
| 221 | } | 222 | } |
| 222 | 223 | ||
| 223 | static void ast_invalid_token_error(ParseContext *pc, Token *token) { | 224 | static void ast_invalid_token_error(ParseContext *pc, Token *token) { |
| 224 | Buf token_value = {0}; | 225 | Buf token_value = BUF_INIT; |
| 225 | ast_buf_from_token(pc, token, &token_value); | 226 | ast_buf_from_token(pc, token, &token_value); |
| 226 | ast_error(token, "invalid token: '%s'", buf_ptr(&token_value)); | 227 | ast_error(token, "invalid token: '%s'", buf_ptr(&token_value)); |
| 227 | } | 228 | } |
src/zig_llvm.cpp+7-8| ... | @@ -32,14 +32,13 @@ char *LLVMZigGetHostCPUName(void) { | ... | @@ -32,14 +32,13 @@ char *LLVMZigGetHostCPUName(void) { |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | char *LLVMZigGetNativeFeatures(void) { | 34 | char *LLVMZigGetNativeFeatures(void) { |
| 35 | return strdup(""); | 35 | SubtargetFeatures features; |
| 36 | //SubtargetFeatures features; | ||
| 37 | 36 | ||
| 38 | //StringMap<bool> host_features; | 37 | StringMap<bool> host_features; |
| 39 | //if (sys::getHostCPUFeatures(host_features)) { | 38 | if (sys::getHostCPUFeatures(host_features)) { |
| 40 | // for (auto &F : host_features) | 39 | for (auto &F : host_features) |
| 41 | // features.AddFeature(F.first(), F.second); | 40 | features.AddFeature(F.first(), F.second); |
| 42 | //} | 41 | } |
| 43 | 42 | ||
| 44 | //return strdup(features.getString().c_str()); | 43 | return strdup(features.getString().c_str()); |
| 45 | } | 44 | } |