diff --git a/src/Makefile b/src/Makefile index bbdf0879..91f51c5a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,4 +1,6 @@ debug ?= yes +pedantic ?= yes + ifeq ($(debug),yes) CPPFLAGS += -DKAK_DEBUG suffix := .debug @@ -11,6 +13,10 @@ else endif endif +ifeq ($(pedantic),yes) + CXXFLAGS += -pedantic +endif + sources := $(wildcard *.cc) objects := $(addprefix ., $(sources:.cc=$(suffix).o)) deps := $(addprefix ., $(sources:.cc=$(suffix).d)) @@ -22,8 +28,6 @@ bindir := $(DESTDIR)$(PREFIX)/bin sharedir := $(DESTDIR)$(PREFIX)/share/kak docdir := $(DESTDIR)$(PREFIX)/share/doc/kak -CXXFLAGS += -std=gnu++11 -g -Wall -Wno-reorder -Wno-sign-compare -pedantic - os := $(shell uname) ifeq ($(os),Darwin) @@ -46,6 +50,8 @@ else LDFLAGS += -rdynamic endif +CXXFLAGS += -std=gnu++11 -g -Wall -Wno-reorder -Wno-sign-compare + kak : $(objects) $(CXX) $(LDFLAGS) $(CXXFLAGS) $(objects) $(LIBS) -o $@ diff --git a/src/backtrace.cc b/src/backtrace.cc index adeb9301..677702c8 100644 --- a/src/backtrace.cc +++ b/src/backtrace.cc @@ -2,21 +2,24 @@ #include "string.hh" -#if defined(__linux__) || defined(__APPLE__) +#if defined(__GLIBC__) || defined(__APPLE__) # include -# include #elif defined(__CYGWIN__) # include # include # include #endif +#if defined(__linux__) || defined(__APPLE__) +# include +#endif + namespace Kakoune { Backtrace::Backtrace() { - #if defined(__linux__) || defined(__APPLE__) + #if defined(__GLIBC__) || defined(__APPLE__) num_frames = backtrace(stackframes, max_frames); #elif defined(__CYGWIN__) num_frames = CaptureStackBackTrace(0, max_frames, stackframes, nullptr); @@ -25,7 +28,7 @@ Backtrace::Backtrace() String Backtrace::desc() const { - #if defined(__linux__) || defined(__APPLE__) + #if defined(__GLIBC__) || defined(__APPLE__) char** symbols = backtrace_symbols(stackframes, num_frames); ByteCount size = 0; for (int i = 0; i < num_frames; ++i)