aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2018-07-05 10:14:19 +0200
committerMiodrag Milanovic <mmicko@gmail.com>2018-07-05 10:14:19 +0200
commit2fe13e7a079eb5df30f23b0e4da33d8d8067a9b1 (patch)
tree54cb0d8d42fedbeaaf73313a017d114244b3cece
parentfcff203c23ccd4ced76dafe1496b8c83adb88ddc (diff)
downloadnextpnr-2fe13e7a079eb5df30f23b0e4da33d8d8067a9b1.tar.gz
nextpnr-2fe13e7a079eb5df30f23b0e4da33d8d8067a9b1.tar.bz2
nextpnr-2fe13e7a079eb5df30f23b0e4da33d8d8067a9b1.zip
make GUI compile on MSVC
-rw-r--r--3rdparty/python-console/ParseHelper.h4
-rw-r--r--3rdparty/python-console/modified/pyconsole.cc2
-rw-r--r--3rdparty/python-console/modified/pyinterpreter.cc4
-rw-r--r--CMakeLists.txt8
-rw-r--r--gui/fpgaviewwidget.h8
5 files changed, 15 insertions, 11 deletions
diff --git a/3rdparty/python-console/ParseHelper.h b/3rdparty/python-console/ParseHelper.h
index d01e2627..e0fe9550 100644
--- a/3rdparty/python-console/ParseHelper.h
+++ b/3rdparty/python-console/ParseHelper.h
@@ -28,7 +28,7 @@ THE SOFTWARE.
#include <memory>
#include "ParseMessage.h"
-class ParseListener;
+struct ParseListener;
/**
Helps chunk lines of Python code into compilable statements.
@@ -94,7 +94,7 @@ public:
// return if there was an error
bool initializeIndent(const std::string& str);
};
- friend class BlockParseState;
+ friend struct BlockParseState;
struct BracketParseState : public ParseState
{
diff --git a/3rdparty/python-console/modified/pyconsole.cc b/3rdparty/python-console/modified/pyconsole.cc
index 186d74d2..d724553b 100644
--- a/3rdparty/python-console/modified/pyconsole.cc
+++ b/3rdparty/python-console/modified/pyconsole.cc
@@ -95,7 +95,7 @@ void PythonConsole::parseEvent( const ParseMessage& message )
}
// interpret valid user input
- int errorCode;
+ int errorCode = 0;
std::string res;
if ( message.message.size() )
res = pyinterpreter_execute( message.message, &errorCode );
diff --git a/3rdparty/python-console/modified/pyinterpreter.cc b/3rdparty/python-console/modified/pyinterpreter.cc
index ee8c4aa8..f53207ad 100644
--- a/3rdparty/python-console/modified/pyinterpreter.cc
+++ b/3rdparty/python-console/modified/pyinterpreter.cc
@@ -38,9 +38,9 @@ static std::list<std::string> m_suggestions;
template <typename... Args> std::string string_format(const std::string &format, Args... args)
{
- size_t size = std::snprintf(nullptr, 0, format.c_str(), args...) + 1; // Extra space for '\0'
+ size_t size = snprintf(nullptr, 0, format.c_str(), args...) + 1; // Extra space for '\0'
std::unique_ptr<char[]> buf(new char[size]);
- std::snprintf(buf.get(), size, format.c_str(), args...);
+ snprintf(buf.get(), size, format.c_str(), args...);
return std::string(buf.get(), buf.get() + size - 1); // We don't want the '\0' inside
}
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c3650a05..93ef6ada 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,8 +11,8 @@ set(FAMILIES generic ice40)
set(CMAKE_CXX_STANDARD 11)
if (MSVC)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
-set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /W4 /wd4100 /wd4244 /wd4125 /wd4800 /wd4456 /wd4458 /wd4305 /wd4459 /wd4121")
-set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W4 /wd4100 /wd4244 /wd4125 /wd4800 /wd4456 /wd4458 /wd4305 /wd4459 /wd4121")
+set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /W4 /wd4100 /wd4244 /wd4125 /wd4800 /wd4456 /wd4458 /wd4305 /wd4459 /wd4121 /wd4996")
+set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W4 /wd4100 /wd4244 /wd4125 /wd4800 /wd4456 /wd4458 /wd4305 /wd4459 /wd4121 /wd4996")
else()
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -fPIC -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -fPIC -O3 -g")
@@ -21,6 +21,10 @@ set(CMAKE_DEFIN)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/3rdparty/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH})
+if(NOT DEFINED CMAKE_SUPPRESS_DEVELOPER_WARNINGS)
+ set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings")
+endif()
+
find_package(Sanitizers)
# List of Boost libraries to include
diff --git a/gui/fpgaviewwidget.h b/gui/fpgaviewwidget.h
index 0cd84c9c..0342bb8a 100644
--- a/gui/fpgaviewwidget.h
+++ b/gui/fpgaviewwidget.h
@@ -34,17 +34,17 @@ NEXTPNR_NAMESPACE_BEGIN
// Vertex2DPOD is a structure of X, Y coordinates that can be passed to OpenGL
// directly.
-struct Vertex2DPOD
+NPNR_PACKED_STRUCT(struct Vertex2DPOD
{
GLfloat x;
GLfloat y;
Vertex2DPOD(GLfloat X, GLfloat Y) : x(X), y(Y) {}
-} __attribute__((packed));
+});
// Vertex2DPOD is a structure of R, G, B, A values that can be passed to OpenGL
// directly.
-struct ColorPOD
+NPNR_PACKED_STRUCT(struct ColorPOD
{
GLfloat r;
GLfloat g;
@@ -53,7 +53,7 @@ struct ColorPOD
ColorPOD(GLfloat R, GLfloat G, GLfloat B, GLfloat A) : r(R), g(G), b(B), a(A) {}
ColorPOD(const QColor &color) : r(color.redF()), g(color.greenF()), b(color.blueF()), a(color.alphaF()) {}
-} __attribute__((packed));
+});
// LineShaderData is a built set of vertices that can be rendered by the
// LineShader.