Skip to content

Commit

Permalink
use llvm's cxxflags, and avoid NDEBUG. closes #2819
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jun 14, 2013
1 parent 7ad4da6 commit d2f6a78
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
8 changes: 4 additions & 4 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
JCFLAGS = -std=gnu99 -pipe $(fPIC) -fno-strict-aliasing -D_FILE_OFFSET_BITS=64
JCXXFLAGS = -pipe $(fPIC) -fno-rtti
DEBUGFLAGS = -ggdb3 -DDEBUG -fstack-protector-all
SHIPFLAGS = -O3 -DNDEBUG -falign-functions
DEBUGFLAGS = -O0 -ggdb3 -DDEBUG -fstack-protector-all
SHIPFLAGS = -O3 -falign-functions
endif

ifeq ($(USECLANG),1)
Expand All @@ -115,8 +115,8 @@ CC = $(CROSS_COMPILE)clang
CXX = $(CROSS_COMPILE)clang++
JCFLAGS = -pipe $(fPIC) -fno-strict-aliasing -D_FILE_OFFSET_BITS=64
JCXXFLAGS = -pipe $(fPIC) -fno-rtti
DEBUGFLAGS = -g -DDEBUG -fstack-protector-all
SHIPFLAGS = -O3 -DNDEBUG
DEBUGFLAGS = -O0 -g -DDEBUG -fstack-protector-all
SHIPFLAGS = -O3
ifeq ($(OS), Darwin)
CC += -mmacosx-version-min=10.6
CXX += -mmacosx-version-min=10.6
Expand Down
6 changes: 3 additions & 3 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ FLAGS = \
-I$(call exec,$(LLVM_CONFIG) --includedir) \
-I$(LIBUV_INC) -I$(JULIAHOME)/usr/include

LIBS = $(WHOLE_ARCHIVE) $(JULIAHOME)/src/flisp/libflisp.a $(WHOLE_ARCHIVE) $(JULIAHOME)/src/support/libsupport.a -L$(BUILD)/lib $(LIBUV) $(call exec,$(LLVM_CONFIG) --libs) $(NO_WHOLE_ARCHIVE) $(call exec,$(LLVM_CONFIG) --ldflags) $(OSLIBS)
LIBS = $(WHOLE_ARCHIVE) $(JULIAHOME)/src/flisp/libflisp.a $(WHOLE_ARCHIVE) $(JULIAHOME)/src/support/libsupport.a -L$(BUILD)/lib $(LIBUV) $(NO_WHOLE_ARCHIVE) $(call exec,$(LLVM_CONFIG) --libs) $(call exec,$(LLVM_CONFIG) --ldflags) $(OSLIBS)

ifneq ($(MAKECMDGOALS),debug)
TARGET =
Expand Down Expand Up @@ -47,9 +47,9 @@ HEADERS = julia.h $(wildcard support/*.h) $(LIBUV_INC)/uv.h
%.do: %.c $(HEADERS)
$(QUIET_CC) $(CC) $(CPPFLAGS) $(CFLAGS) $(DEBUGFLAGS) -c $< -o $@
%.o: %.cpp $(HEADERS)
$(QUIET_CC) $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(SHIPFLAGS) $(call exec,$(LLVM_CONFIG) --cppflags) -c $< -o $@
$(QUIET_CC) $(CXX) $(call exec,$(LLVM_CONFIG) --cxxflags) $(CPPFLAGS) $(CXXFLAGS) $(SHIPFLAGS) -c $< -o $@
%.do: %.cpp $(HEADERS)
$(QUIET_CC) $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEBUGFLAGS) $(call exec,$(LLVM_CONFIG) --cppflags) -c $< -o $@
$(QUIET_CC) $(CXX) $(call exec,$(LLVM_CONFIG) --cxxflags) $(CPPFLAGS) $(CXXFLAGS) $(DEBUGFLAGS) -c $< -o $@

ast.o ast.do: julia_flisp.boot.inc flisp/*.h

Expand Down
11 changes: 4 additions & 7 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@
#include <vector>
#include <set>
#include <cstdio>
#ifdef DEBUG
#undef NDEBUG
#endif
#include <cassert>
using namespace llvm;

Expand Down Expand Up @@ -394,12 +391,12 @@ extern "C" DLLEXPORT
const jl_value_t *jl_dump_function(jl_function_t *f, jl_tuple_t *types, bool dumpasm)
{
if (!jl_is_function(f) || !jl_is_gf(f))
return jl_cstr_to_string((char*)"");
return jl_cstr_to_string(const_cast<char*>(""));
jl_function_t *sf = jl_get_specialization(f, types);
if (sf == NULL || sf->linfo == NULL) {
sf = jl_method_lookup_by_type(jl_gf_mtable(f), types, 0, 0);
if (sf == jl_bottom_func)
return jl_cstr_to_string((char*)"");
return jl_cstr_to_string(const_cast<char*>(""));
JL_PRINTF(JL_STDERR,
"Warning: Returned code may not match what actually runs.\n");
}
Expand Down Expand Up @@ -429,12 +426,12 @@ const jl_value_t *jl_dump_function(jl_function_t *f, jl_tuple_t *types, bool dum

if (fit == fmap.end()) {
JL_PRINTF(JL_STDERR, "Warning: Unable to find function pointer\n");
return jl_cstr_to_string((char*)"");
return jl_cstr_to_string(const_cast<char*>(""));
}
jl_dump_function_asm((void*)fptr, fit->second.lengthAdr, fit->second.lines, fstream);
fstream.flush();
}
return jl_cstr_to_string((char*)stream.str().c_str());
return jl_cstr_to_string(const_cast<char*>(stream.str().c_str()));
}

// --- code gen for intrinsic functions ---
Expand Down
2 changes: 1 addition & 1 deletion src/flisp/cvalues.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static void sweep_finalizers(void)
t->vtable->finalize(tagptr(tmp, TAG_CVALUE));
}
if (!isinlined(tmp) && owned(tmp)) {
#ifndef NDEBUG
#ifdef DEBUG
memset(cv_data(tmp), 0xbb, cv_len(tmp));
#endif
free(cv_data(tmp));
Expand Down
2 changes: 1 addition & 1 deletion src/intrinsics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ static FunctionType *ft2arg(Type *ret, Type *arg1, Type *arg2)
static void add_intrinsic(jl_module_t *m, const std::string &name, intrinsic f)
{
jl_value_t *i = jl_box32(jl_intrinsic_type, (int32_t)f);
jl_sym_t *sym = jl_symbol((char*)name.c_str());
jl_sym_t *sym = jl_symbol(const_cast<char*>(name.c_str()));
jl_set_const(m, sym, i);
jl_module_export(m, sym);
}
Expand Down

0 comments on commit d2f6a78

Please sign in to comment.