Makefile: add -Wall to CXXFLAGS

This commit is contained in:
Maxime Coste 2012-10-11 01:17:29 +02:00
parent 0ce6bd9bf5
commit c92077762c
6 changed files with 19 additions and 15 deletions

View File

@ -2,7 +2,7 @@ sources := $(wildcard *.cc)
objects := $(sources:.cc=.o) objects := $(sources:.cc=.o)
deps := $(addprefix ., $(sources:.cc=.d)) deps := $(addprefix ., $(sources:.cc=.d))
CXXFLAGS += -std=c++0x -g CXXFLAGS += -std=c++0x -g -Wall -Wno-reorder -Wno-sign-compare
LDFLAGS += -lmenu -lncurses -lboost_regex LDFLAGS += -lmenu -lncurses -lboost_regex
kak : $(objects) kak : $(objects)

View File

@ -344,17 +344,15 @@ void Buffer::apply_modification(const Modification& modification)
{ {
case Modification::Insert: case Modification::Insert:
{ {
BufferIterator pos = modification.position < end() ? do_insert(pos < end() ? pos : end(), content);
modification.position : end();
do_insert(pos, modification.content);
break; break;
} }
case Modification::Erase: case Modification::Erase:
{ {
ByteCount count = modification.content.length(); ByteCount count = content.length();
BufferIterator end = modification.position + count; BufferIterator end = pos + count;
assert(string(modification.position, end) == modification.content); assert(string(pos, end) == content);
do_erase(modification.position, end); do_erase(pos, end);
break; break;
} }
default: default:

View File

@ -486,6 +486,8 @@ public:
break; break;
} }
break; break;
default:
break;
} }
if (reset_completer) if (reset_completer)
m_completer.reset(context); m_completer.reset(context);

View File

@ -32,7 +32,7 @@ const ColorPair& ColorRegistry::operator[](const String& colordesc)
parse_color(String(it+1, colordesc.end())) parse_color(String(it+1, colordesc.end()))
: Color::Default }; : Color::Default };
m_aliases[colordesc] = colpair; return (m_aliases[colordesc] = colpair);
} }
void ColorRegistry::register_alias(const String& name, const String& colordesc, void ColorRegistry::register_alias(const String& name, const String& colordesc,

View File

@ -54,6 +54,8 @@ public:
case ReplacedBufferRange: case ReplacedBufferRange:
return m_text; return m_text;
} }
assert(false);
return 0;
} }
CharCount length() const CharCount length() const
@ -66,6 +68,8 @@ public:
case ReplacedBufferRange: case ReplacedBufferRange:
return m_text.char_length(); return m_text.char_length();
} }
assert(false);
return 0;
} }
const BufferIterator& begin() const const BufferIterator& begin() const

View File

@ -170,9 +170,9 @@ SelectionAndCaptures select_line(const Selection& selection)
SelectionAndCaptures select_matching(const Selection& selection) SelectionAndCaptures select_matching(const Selection& selection)
{ {
std::vector<char> matching_pairs = { '(', ')', '{', '}', '[', ']', '<', '>' }; std::vector<Codepoint> matching_pairs = { '(', ')', '{', '}', '[', ']', '<', '>' };
Utf8Iterator it = selection.last(); Utf8Iterator it = selection.last();
std::vector<char>::iterator match = matching_pairs.end(); std::vector<Codepoint>::iterator match = matching_pairs.end();
while (not is_eol(*it)) while (not is_eol(*it))
{ {
match = std::find(matching_pairs.begin(), matching_pairs.end(), *it); match = std::find(matching_pairs.begin(), matching_pairs.end(), *it);
@ -188,8 +188,8 @@ SelectionAndCaptures select_matching(const Selection& selection)
if (((match - matching_pairs.begin()) % 2) == 0) if (((match - matching_pairs.begin()) % 2) == 0)
{ {
int level = 0; int level = 0;
const char opening = *match; const Codepoint opening = *match;
const char closing = *(match+1); const Codepoint closing = *(match+1);
while (not is_end(it)) while (not is_end(it))
{ {
if (*it == opening) if (*it == opening)
@ -203,8 +203,8 @@ SelectionAndCaptures select_matching(const Selection& selection)
else else
{ {
int level = 0; int level = 0;
const char opening = *(match-1); const Codepoint opening = *(match-1);
const char closing = *match; const Codepoint closing = *match;
while (not is_begin(it)) while (not is_begin(it))
{ {
if (*it == closing) if (*it == closing)