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)
33set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
44 "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
55
6project(zig C CXX)
6project(zig CXX)
77set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
88
99set(ZIG_VERSION_MAJOR 0)
......@@ -40,14 +40,13 @@ configure_file (
4040 ${CONFIGURE_OUT_FILE}
4141)
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
4848add_executable(zig ${ZIG_SOURCES})
4949set_target_properties(zig PROPERTIES
50 LINKER_LANGUAGE C
5150 COMPILE_FLAGS ${EXE_CFLAGS})
5251target_link_libraries(zig LINK_PUBLIC
5352 ${LLVM_LIBRARIES}
README.md-1
......@@ -40,7 +40,6 @@ readable, safe, optimal, and concise code to solve any computing problem.
4040
4141## Roadmap
4242
43 * Produce executable file instead of .o file.
4443 * Add debugging symbols.
4544 * Debug/Release mode.
4645 * C style comments.
src/buffer.hpp+2
......@@ -13,6 +13,8 @@
1313#include <assert.h>
1414#include <stdint.h>
1515
16#define BUF_INIT {{0}}
17
1618struct Buf {
1719 ZigList<char> list;
1820};
src/codegen.cpp+1-1
......@@ -423,7 +423,7 @@ void code_gen_link(CodeGen *g, bool is_static, const char *out_file) {
423423 LLVMTargetMachineRef target_machine = LLVMCreateTargetMachine(target_ref, native_triple,
424424 native_cpu, native_features, opt_level, reloc_mode, LLVMCodeModelDefault);
425425
426 Buf out_file_o = {0};
426 Buf out_file_o = BUF_INIT;
427427 buf_init_from_str(&out_file_o, out_file);
428428 buf_append_str(&out_file_o, ".o");
429429
src/parser.cpp+3-2
......@@ -10,7 +10,8 @@
1010#include <stdarg.h>
1111#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, ...) {
1415 int line = token->start_line + 1;
1516 int column = token->start_column + 1;
1617
......@@ -221,7 +222,7 @@ static void parse_string_literal(ParseContext *pc, Token *token, Buf *buf) {
221222}
222223
223224static void ast_invalid_token_error(ParseContext *pc, Token *token) {
224 Buf token_value = {0};
225 Buf token_value = BUF_INIT;
225226 ast_buf_from_token(pc, token, &token_value);
226227 ast_error(token, "invalid token: '%s'", buf_ptr(&token_value));
227228}
src/zig_llvm.cpp+7-8
......@@ -32,14 +32,13 @@ char *LLVMZigGetHostCPUName(void) {
3232}
3333
3434char *LLVMZigGetNativeFeatures(void) {
35 return strdup("");
36 //SubtargetFeatures features;
35 SubtargetFeatures features;
3736
38 //StringMap<bool> host_features;
39 //if (sys::getHostCPUFeatures(host_features)) {
40 // for (auto &F : host_features)
41 // features.AddFeature(F.first(), F.second);
42 //}
37 StringMap<bool> host_features;
38 if (sys::getHostCPUFeatures(host_features)) {
39 for (auto &F : host_features)
40 features.AddFeature(F.first(), F.second);
41 }
4342
44 //return strdup(features.getString().c_str());
43 return strdup(features.getString().c_str());
4544}