authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2015-11-24 15:01:37-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2015-11-24 15:01:37-07:00
logbaf5167171fa0159adb8bd55c6a111b006f8c038
tree47f207dea456ffb79c38fbab0fac32707a4e2778
parentfefbee166d68d17dd0d5904fc52f72397fb51092

fix not using subtarget features


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)
3set(CMAKE_BUILD_TYPE "Debug" CACHE STRING3set(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)
55
6project(zig C CXX)6project(zig CXX)
7set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})7set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
88
9set(ZIG_VERSION_MAJOR 0)9set(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)
4242
43set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wno-unused-variable -Wno-unused-but-set-variable")43set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wno-unused-variable -Wno-unused-but-set-variable")
4444
45set(EXE_CFLAGS "-std=c++11 -Werror -Wall -Werror=strict-prototypes -Werror=old-style-definition -Werror=missing-prototypes")45set(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")
4646
4747
48add_executable(zig ${ZIG_SOURCES})48add_executable(zig ${ZIG_SOURCES})
49set_target_properties(zig PROPERTIES49set_target_properties(zig PROPERTIES
50 LINKER_LANGUAGE C
51 COMPILE_FLAGS ${EXE_CFLAGS})50 COMPILE_FLAGS ${EXE_CFLAGS})
52target_link_libraries(zig LINK_PUBLIC51target_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.
4040
41## Roadmap41## Roadmap
4242
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>
1515
16#define BUF_INIT {{0}}
17
16struct Buf {18struct 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);
425425
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");
429429
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>
1212
13void ast_error(Token *token, const char *format, ...) {13__attribute__ ((format (printf, 2, 3)))
14static 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;
1617
...@@ -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}
222223
223static void ast_invalid_token_error(ParseContext *pc, Token *token) {224static 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}
3333
34char *LLVMZigGetNativeFeatures(void) {34char *LLVMZigGetNativeFeatures(void) {
35 return strdup("");35 SubtargetFeatures features;
36 //SubtargetFeatures features;
3736
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 }
4342
44 //return strdup(features.getString().c_str());43 return strdup(features.getString().c_str());
45}44}