diff options
-rw-r--r-- | .cirrus.yml | 2 | ||||
-rw-r--r-- | 3rdparty/googletest/googletest/include/gtest/internal/gtest-param-util-generated.h | 1 | ||||
-rw-r--r-- | CMakeLists.txt | 12 | ||||
-rw-r--r-- | common/nextpnr.h | 6 | ||||
-rw-r--r-- | common/relptr.h | 4 | ||||
-rw-r--r-- | common/router2.cc | 2 | ||||
-rw-r--r-- | ecp5/archdefs.h | 1 | ||||
-rw-r--r-- | ecp5/lpf.cc | 2 | ||||
-rw-r--r-- | fpga_interchange/dedicated_interconnect.cc | 4 | ||||
-rw-r--r-- | fpga_interchange/fpga_interchange.cpp | 2 | ||||
-rw-r--r-- | gowin/arch.cc | 32 | ||||
-rw-r--r-- | gowin/arch.h | 16 | ||||
-rw-r--r-- | gowin/main.cc | 6 | ||||
-rw-r--r-- | gui/fpgaviewwidget.h | 2 | ||||
-rw-r--r-- | gui/quadtree.h | 2 | ||||
-rw-r--r-- | gui/treemodel.h | 6 | ||||
-rw-r--r-- | machxo2/arch.cc | 1 | ||||
-rw-r--r-- | machxo2/archdefs.h | 1 | ||||
-rw-r--r-- | machxo2/bitstream.cc | 14 | ||||
m--------- | tests | 0 |
20 files changed, 54 insertions, 62 deletions
diff --git a/.cirrus.yml b/.cirrus.yml index b7ff1891..e2d61df2 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -6,7 +6,7 @@ task: dockerfile: .cirrus/Dockerfile.ubuntu20.04 submodule_script: git submodule sync --recursive && git submodule update --init --recursive - build_script: mkdir build && cd build && cmake .. -DARCH=all+alpha -DOXIDE_INSTALL_PREFIX=$HOME/.cargo -DBUILD_TESTS=on -DBUILD_GUI=on && make -j3 + build_script: mkdir build && cd build && cmake .. -DARCH=all+alpha -DOXIDE_INSTALL_PREFIX=$HOME/.cargo -DBUILD_TESTS=on -DBUILD_GUI=on -DWERROR=on && make -j3 test_generic_script: cd build && ./nextpnr-generic-test flow_test_generic_script: export NPNR=$(pwd)/build/nextpnr-generic && cd tests/generic/flow && ./run.sh test_ice40_script: cd build && ./nextpnr-ice40-test diff --git a/3rdparty/googletest/googletest/include/gtest/internal/gtest-param-util-generated.h b/3rdparty/googletest/googletest/include/gtest/internal/gtest-param-util-generated.h index 4d1d81d2..a4cdcc67 100644 --- a/3rdparty/googletest/googletest/include/gtest/internal/gtest-param-util-generated.h +++ b/3rdparty/googletest/googletest/include/gtest/internal/gtest-param-util-generated.h @@ -95,6 +95,7 @@ template <typename T1, typename T2> class ValueArray2 { public: ValueArray2(T1 v1, T2 v2) : v1_(v1), v2_(v2) {} + ValueArray2(const ValueArray2& other) = default; template <typename T> operator ParamGenerator<T>() const { diff --git a/CMakeLists.txt b/CMakeLists.txt index 87f2e9b0..05b0cce7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ option(USE_OPENMP "Use OpenMP to accelerate analytic placer" OFF) option(COVERAGE "Add code coverage info" OFF) option(STATIC_BUILD "Create static build" OFF) option(EXTERNAL_CHIPDB "Create build with pre-built chipdb binaries" OFF) +option(WERROR "pass -Werror to compiler (used for CI)" OFF) if(WIN32 OR EXTERNAL_CHIPDB) set(BBASM_MODE "binary") @@ -105,11 +106,16 @@ if (MSVC) 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 /wd4127") else() - set(CMAKE_CXX_FLAGS_DEBUG "-Wall -fPIC -ggdb -pipe") + # N.B. the -Wno-array-bounds is to work around a false positive in GCC 9 + set(WARN_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-array-bounds -Werror=sign-compare -Werror=return-type") + if (WERROR) + set(WARN_FLAGS "${WARN_FLAGS} -Werror") + endif() + set(CMAKE_CXX_FLAGS_DEBUG "${WARN_FLAGS} -fPIC -ggdb -pipe") if (USE_OPENMP) - set(CMAKE_CXX_FLAGS_RELEASE "-Wall -fPIC -O3 -g -pipe -fopenmp") + set(CMAKE_CXX_FLAGS_RELEASE "${WARN_FLAGS} -fPIC -O3 -g -pipe -fopenmp") else() - set(CMAKE_CXX_FLAGS_RELEASE "-Wall -fPIC -O3 -g -pipe") + set(CMAKE_CXX_FLAGS_RELEASE "${WARN_FLAGS} -fPIC -O3 -g -pipe") endif() endif() diff --git a/common/nextpnr.h b/common/nextpnr.h index 59198d6d..549e8e35 100644 --- a/common/nextpnr.h +++ b/common/nextpnr.h @@ -99,7 +99,7 @@ inline void assert_fail_impl_str(std::string message, const char *expr_str, cons #define NPNR_ASSERT_FALSE(msg) (assert_fail_impl(msg, "false", __FILE__, __LINE__)) #define NPNR_ASSERT_FALSE_STR(msg) (assert_fail_impl_str(msg, "false", __FILE__, __LINE__)) -#define STRINGIFY(x) #x +#define NPNR_STRINGIFY(x) #x struct BaseCtx; struct Context; @@ -541,7 +541,7 @@ struct Property ret.is_string = false; ret.str.reserve(len); for (int i = offset; i < offset + len; i++) - ret.str.push_back(i < int(str.size()) ? str[i] : padding); + ret.str.push_back(i < int(str.size()) ? str[i] : char(padding)); ret.update_intval(); return ret; } @@ -1255,7 +1255,7 @@ template <typename R> struct BaseArch : ArchAPI<R> // Default, trivial, implementations of Arch API functions for arches that don't need complex behaviours // Basic config - virtual IdString archId() const override { return this->id(STRINGIFY(ARCHNAME)); } + virtual IdString archId() const override { return this->id(NPNR_STRINGIFY(ARCHNAME)); } virtual IdString archArgsToId(typename R::ArchArgsT args) const override { return IdString(); } virtual int getTilePipDimZ(int x, int y) const override { return 1; } virtual char getNameDelimiter() const override { return ' '; } diff --git a/common/relptr.h b/common/relptr.h index d45912ab..76850bc9 100644 --- a/common/relptr.h +++ b/common/relptr.h @@ -31,8 +31,8 @@ NPNR_PACKED_STRUCT(template <typename T> struct RelSlice { const T *begin() const { return get(); } const T *end() const { return get() + length; } - const size_t size() const { return length; } - const ptrdiff_t ssize() const { return length; } + size_t size() const { return length; } + ptrdiff_t ssize() const { return length; } const T &operator*() const { return *(get()); } diff --git a/common/router2.cc b/common/router2.cc index a2023f47..f5779356 100644 --- a/common/router2.cc +++ b/common/router2.cc @@ -1211,7 +1211,7 @@ Router2Cfg::Router2Cfg(Context *ctx) hist_cong_weight = ctx->setting<float>("router2/histCongWeight", 1.0f); curr_cong_mult = ctx->setting<float>("router2/currCongWeightMult", 2.0f); estimate_weight = ctx->setting<float>("router2/estimateWeight", 1.75f); - perf_profile = ctx->setting<float>("router2/perfProfile", false); + perf_profile = ctx->setting<bool>("router2/perfProfile", false); } NEXTPNR_NAMESPACE_END diff --git a/ecp5/archdefs.h b/ecp5/archdefs.h index 732ea99a..cf6902d3 100644 --- a/ecp5/archdefs.h +++ b/ecp5/archdefs.h @@ -56,7 +56,6 @@ struct Location Location() : x(-1), y(-1){}; Location(int16_t x, int16_t y) : x(x), y(y){}; Location(const LocationPOD &pod) : x(pod.x), y(pod.y){}; - Location(const Location &loc) : x(loc.x), y(loc.y){}; bool operator==(const Location &other) const { return x == other.x && y == other.y; } bool operator!=(const Location &other) const { return x != other.x || y != other.y; } diff --git a/ecp5/lpf.cc b/ecp5/lpf.cc index c12b65c4..22859783 100644 --- a/ecp5/lpf.cc +++ b/ecp5/lpf.cc @@ -77,7 +77,7 @@ bool Arch::apply_lpf(std::string filename, std::istream &in) std::string tmp; while (ss >> tmp) words.push_back(tmp); - if (words.size() >= 0) { + if (words.size() > 0) { std::string verb = words.at(0); if (verb == "BLOCK") { if (words.size() != 2 || (words.at(1) != "ASYNCPATHS" && words.at(1) != "RESETPATHS")) diff --git a/fpga_interchange/dedicated_interconnect.cc b/fpga_interchange/dedicated_interconnect.cc index 820896a3..988b13ab 100644 --- a/fpga_interchange/dedicated_interconnect.cc +++ b/fpga_interchange/dedicated_interconnect.cc @@ -441,7 +441,7 @@ void DedicatedInterconnect::find_dedicated_interconnect() continue; } - for (size_t i = 0; i < bel_data.num_bel_wires; ++i) { + for (int i = 0; i < bel_data.num_bel_wires; ++i) { if (bel_data.types[i] != PORT_IN) { continue; } @@ -470,7 +470,7 @@ void DedicatedInterconnect::find_dedicated_interconnect() continue; } - for (size_t i = 0; i < bel_data.num_bel_wires; ++i) { + for (int i = 0; i < bel_data.num_bel_wires; ++i) { if (bel_data.types[i] != PORT_OUT) { continue; } diff --git a/fpga_interchange/fpga_interchange.cpp b/fpga_interchange/fpga_interchange.cpp index a1642789..9410b117 100644 --- a/fpga_interchange/fpga_interchange.cpp +++ b/fpga_interchange/fpga_interchange.cpp @@ -1018,7 +1018,7 @@ size_t ModuleReader::translate_port_index(LogicalNetlist::Netlist::PortInstance: NPNR_ASSERT(port.isBus()); uint32_t idx = port_inst.getBusIdx().getIdx(); size_t width = get_port_width(port); - NPNR_ASSERT(idx >= 0 && idx < width); + NPNR_ASSERT(idx < width); return width - 1 - idx; } } diff --git a/gowin/arch.cc b/gowin/arch.cc index 7e947341..72051b3f 100644 --- a/gowin/arch.cc +++ b/gowin/arch.cc @@ -613,20 +613,20 @@ Arch::Arch(ArchArgs args) : args(args) // fall through the ++ case ID_LUT7: z++; - dff = false; + dff = false; /* fall-through*/ case ID_LUT6: z++; - dff = false; + dff = false; /* fall-through*/ case ID_LUT5: - z++; + z++; /* fall-through*/ case ID_LUT4: - z++; + z++; /* fall-through*/ case ID_LUT3: - z++; + z++; /* fall-through*/ case ID_LUT2: - z++; + z++; /* fall-through*/ case ID_LUT1: - z++; + z++; /* fall-through*/ case ID_LUT0: // common LUT+DFF code snprintf(buf, 32, "R%dC%d_SLICE%d", row + 1, col + 1, z); @@ -654,23 +654,23 @@ Arch::Arch(ArchArgs args) : args(args) } break; case ID_IOBJ: - z++; + z++; /* fall-through*/ case ID_IOBI: - z++; + z++; /* fall-through*/ case ID_IOBH: - z++; + z++; /* fall-through*/ case ID_IOBG: - z++; + z++; /* fall-through*/ case ID_IOBF: - z++; + z++; /* fall-through*/ case ID_IOBE: - z++; + z++; /* fall-through*/ case ID_IOBD: - z++; + z++; /* fall-through*/ case ID_IOBC: - z++; + z++; /* fall-through*/ case ID_IOBB: - z++; + z++; /* fall-through*/ case ID_IOBA: snprintf(buf, 32, "R%dC%d_IOB%c", row + 1, col + 1, 'A' + z); belname = id(buf); diff --git a/gowin/arch.h b/gowin/arch.h index 052c1545..e0686d1c 100644 --- a/gowin/arch.h +++ b/gowin/arch.h @@ -348,9 +348,9 @@ struct Arch : BaseArch<ArchRanges> int getGridDimX() const override { return gridDimX; } int getGridDimY() const override { return gridDimY; } - int getTileBelDimZ(int x, int y) const { return tileBelDimZ[x][y]; } - int getTilePipDimZ(int x, int y) const { return tilePipDimZ[x][y]; } - char getNameDelimiter() const + int getTileBelDimZ(int x, int y) const override { return tileBelDimZ[x][y]; } + int getTilePipDimZ(int x, int y) const override { return tilePipDimZ[x][y]; } + char getNameDelimiter() const override { return ' '; /* use a non-existent delimiter as we aren't using IdStringLists yet */ } @@ -431,13 +431,13 @@ struct Arch : BaseArch<ArchRanges> bool place() override; bool route() override; - bool getCellDelay(const CellInfo *cell, IdString fromPort, IdString toPort, DelayQuad &delay) const; + bool getCellDelay(const CellInfo *cell, IdString fromPort, IdString toPort, DelayQuad &delay) const override; // Get the port class, also setting clockInfoCount to the number of TimingClockingInfos associated with a port - TimingPortClass getPortTimingClass(const CellInfo *cell, IdString port, int &clockInfoCount) const; + TimingPortClass getPortTimingClass(const CellInfo *cell, IdString port, int &clockInfoCount) const override; // Get the TimingClockingInfo of a port - TimingClockingInfo getPortClockingInfo(const CellInfo *cell, IdString port, int index) const; + TimingClockingInfo getPortClockingInfo(const CellInfo *cell, IdString port, int index) const override; - bool isBelLocationValid(BelId bel) const; + bool isBelLocationValid(BelId bel) const override; static const std::string defaultPlacer; static const std::vector<std::string> availablePlacers; @@ -446,7 +446,7 @@ struct Arch : BaseArch<ArchRanges> // --------------------------------------------------------------- // Internal usage - void assignArchInfo(); + void assignArchInfo() override; bool cellsCompatible(const CellInfo **cells, int count) const; std::vector<IdString> cell_types; diff --git a/gowin/main.cc b/gowin/main.cc index 308be4d3..674eac03 100644 --- a/gowin/main.cc +++ b/gowin/main.cc @@ -61,10 +61,10 @@ std::unique_ptr<Context> GowinCommandHandler::createContext(std::unordered_map<s log_error("Invalid device %s\n", device.c_str()); } ArchArgs chipArgs; - char buf[32]; - snprintf(buf, 32, "GW1N%s-%s", match[1].str().c_str(), match[3].str().c_str()); + char buf[36]; + snprintf(buf, 36, "GW1N%s-%s", match[1].str().c_str(), match[3].str().c_str()); chipArgs.device = buf; - snprintf(buf, 32, "GW1N-%s", match[3].str().c_str()); + snprintf(buf, 36, "GW1N-%s", match[3].str().c_str()); chipArgs.family = buf; chipArgs.package = match[4]; chipArgs.speed = match[5]; diff --git a/gui/fpgaviewwidget.h b/gui/fpgaviewwidget.h index 9f670cb0..7a2994f6 100644 --- a/gui/fpgaviewwidget.h +++ b/gui/fpgaviewwidget.h @@ -202,6 +202,8 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions } } + PickedElement &operator=(const PickedElement &other) = default; + DecalXY decal(Context *ctx) const { DecalXY decal; diff --git a/gui/quadtree.h b/gui/quadtree.h index 5bbd2ebb..49749a68 100644 --- a/gui/quadtree.h +++ b/gui/quadtree.h @@ -52,8 +52,6 @@ template <typename CoordinateT, typename ElementT> class QuadTreeNode BoundingBox() : x0_(pinf), y0_(pinf), x1_(ninf), y1_(ninf) {} - BoundingBox(const BoundingBox &other) : x0_(other.x0_), y0_(other.y0_), x1_(other.x1_), y1_(other.y1_) {} - // Whether a bounding box contains a given points. // A point is defined to be in a bounding box when it's not lesser than // the lower coordinate or greater than the higher coordinate, eg: diff --git a/gui/treemodel.h b/gui/treemodel.h index 7b599e65..e9c42a0f 100644 --- a/gui/treemodel.h +++ b/gui/treemodel.h @@ -218,7 +218,7 @@ template <typename ElementT> class ElementList : public Item name.remove(0, prefix.size()); auto item = new IdStringItem(ctx_, idstring, this, child_type_); - managed_[idstring] = std::move(std::unique_ptr<Item>(item)); + managed_[idstring] = std::unique_ptr<Item>(item); } } @@ -306,7 +306,7 @@ template <typename ElementT> class ElementXYRoot : public Item // Create X list Item. auto item = new Item(QString("X%1").arg(i), this); - managed_labels_.push_back(std::move(std::unique_ptr<Item>(item))); + managed_labels_.push_back(std::unique_ptr<Item>(item)); for (auto j : y_present) { // Create Y list ElementList. @@ -314,7 +314,7 @@ template <typename ElementT> class ElementXYRoot : public Item new ElementList<ElementT>(ctx_, QString("Y%1").arg(j), item, &map_, i, j, getter_, child_type_); // Pre-populate list with one element, other Qt will never ask for more. item2->fetchMore(1); - managed_lists_.push_back(std::move(std::unique_ptr<ElementList<ElementT>>(item2))); + managed_lists_.push_back(std::unique_ptr<ElementList<ElementT>>(item2)); } } } diff --git a/machxo2/arch.cc b/machxo2/arch.cc index 74bfc598..6a29dbb1 100644 --- a/machxo2/arch.cc +++ b/machxo2/arch.cc @@ -153,6 +153,7 @@ std::string Arch::get_full_chip_name() const break; case ArchArgs::SPEED_3: name += "3"; + break; case ArchArgs::SPEED_4: name += "4"; break; diff --git a/machxo2/archdefs.h b/machxo2/archdefs.h index f822b907..433b1b6b 100644 --- a/machxo2/archdefs.h +++ b/machxo2/archdefs.h @@ -48,7 +48,6 @@ struct Location Location() : x(-1), y(-1){}; Location(int16_t x, int16_t y) : x(x), y(y){}; Location(const LocationPOD &pod) : x(pod.x), y(pod.y){}; - Location(const Location &loc) : x(loc.x), y(loc.y){}; bool operator==(const Location &other) const { return x == other.x && y == other.y; } bool operator!=(const Location &other) const { return x != other.x || y != other.y; } diff --git a/machxo2/bitstream.cc b/machxo2/bitstream.cc index 37363b09..d695b094 100644 --- a/machxo2/bitstream.cc +++ b/machxo2/bitstream.cc @@ -114,20 +114,6 @@ static std::vector<bool> int_to_bitvector(int val, int size) return bv; } -static std::vector<bool> str_to_bitvector(std::string str, int size) -{ - std::vector<bool> bv; - bv.resize(size, 0); - if (str.substr(0, 2) != "0b") - log_error("error parsing value '%s', expected 0b prefix\n", str.c_str()); - for (int i = 0; i < int(str.size()) - 2; i++) { - char c = str.at((str.size() - i) - 1); - NPNR_ASSERT(c == '0' || c == '1'); - bv.at(i) = (c == '1'); - } - return bv; -} - std::string intstr_or_default(const std::unordered_map<IdString, Property> &ct, const IdString &key, std::string def = "0") { diff --git a/tests b/tests -Subproject 32db04a11077e7a32adc6f3d473e5cbefe83ff0 +Subproject 34c511444eff51291fa732369e434ff687de310 |