summaryrefslogtreecommitdiff
path: root/tools/preproc
diff options
context:
space:
mode:
Diffstat (limited to 'tools/preproc')
-rw-r--r--tools/preproc/Makefile7
-rw-r--r--tools/preproc/asm_file.cpp7
-rw-r--r--tools/preproc/c_file.cpp1
3 files changed, 11 insertions, 4 deletions
diff --git a/tools/preproc/Makefile b/tools/preproc/Makefile
index 3d32758..8c48afe 100644
--- a/tools/preproc/Makefile
+++ b/tools/preproc/Makefile
@@ -1,4 +1,4 @@
-CXX := g++
+CXX ?= g++
CXXFLAGS := -std=c++11 -O2 -Wall -Wno-switch -Werror
@@ -8,7 +8,10 @@ SRCS := asm_file.cpp c_file.cpp charmap.cpp preproc.cpp string_parser.cpp \
HEADERS := asm_file.h c_file.h char_util.h charmap.h preproc.h string_parser.h \
utf8.h
-.PHONY: clean
+.PHONY: all clean
+
+all: preproc
+ @:
preproc: $(SRCS) $(HEADERS)
$(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS)
diff --git a/tools/preproc/asm_file.cpp b/tools/preproc/asm_file.cpp
index 383010a..7756cad 100644
--- a/tools/preproc/asm_file.cpp
+++ b/tools/preproc/asm_file.cpp
@@ -20,6 +20,7 @@
#include <cstdio>
#include <cstdarg>
+#include <stdexcept>
#include "preproc.h"
#include "asm_file.h"
#include "char_util.h"
@@ -475,9 +476,11 @@ void AsmFile::ExpectEmptyRestOfLine()
m_lineStart = m_pos;
m_lineNum++;
}
- else if (m_buffer[m_pos] == '\r')
+ else if (m_buffer[m_pos] == '\r' && m_buffer[m_pos + 1] == '\n')
{
- RaiseError("only Unix-style LF newlines are supported");
+ m_pos += 2;
+ m_lineStart = m_pos;
+ m_lineNum++;
}
else
{
diff --git a/tools/preproc/c_file.cpp b/tools/preproc/c_file.cpp
index 229f568..b996a04 100644
--- a/tools/preproc/c_file.cpp
+++ b/tools/preproc/c_file.cpp
@@ -20,6 +20,7 @@
#include <cstdio>
#include <cstdarg>
+#include <stdexcept>
#include <string>
#include <memory>
#include "preproc.h"