Skip to content

Commit

Permalink
Merge pull request verilog-to-routing#2862 from verilog-to-routing/in…
Browse files Browse the repository at this point in the history
…crease_cpp_ver_20

Increase C++ version from 17 to 20
  • Loading branch information
vaughnbetz authored Jan 20, 2025
2 parents bb0005c + f7c8c2d commit 55f1490
Show file tree
Hide file tree
Showing 23 changed files with 53 additions and 49 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,6 @@ jobs:
- { name: 'GCC 11 (Ubuntu Noble - 24.04)', eval: 'CC=gcc-11 && CXX=g++-11', }
- { name: 'GCC 12 (Ubuntu Noble - 24.04)', eval: 'CC=gcc-12 && CXX=g++-12', }
- { name: 'GCC 14 (Ubuntu Noble - 24.04)', eval: 'CC=gcc-14 && CXX=g++-14', }
- { name: 'Clang 15 (Ubuntu Noble - 24.04)', eval: 'CC=clang-15 && CXX=clang++-15', }
- { name: 'Clang 16 (Ubuntu Noble - 24.04)', eval: 'CC=clang-16 && CXX=clang++-16', }
- { name: 'Clang 17 (Ubuntu Noble - 24.04)', eval: 'CC=clang-17 && CXX=clang++-17', }
- { name: 'Clang 18 (Ubuntu Noble - 24.04)', eval: 'CC=clang-18 && CXX=clang++-18', }
Expand Down
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ add_definitions("-DVTR_ASSERT_LEVEL=${VTR_ASSERT_LEVEL}")
include(CheckCXXCompilerFlag)

#
# We require c++17 support
# We require c++20 support
#
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) #No compiler specific extensions

Expand Down Expand Up @@ -160,7 +160,7 @@ else()
"-Wcast-align" #Warn if a cast causes memory alignment changes
"-Wshadow" #Warn if local variable shadows another variable
"-Wformat=2" #Sanity checks for printf-like formatting
"-Wno-format-nonliteral" # But don't worry about non-literal formtting (i.e. run-time printf format strings)
"-Wno-format-nonliteral" # But don't worry about non-literal formatting (i.e. run-time printf format strings)
"-Wlogical-op" #Checks for logical op when bit-wise expected
"-Wmissing-declarations" #Warn if a global function is defined with no declaration
"-Wmissing-include-dirs" #Warn if a user include directory is missing
Expand All @@ -178,10 +178,10 @@ else()
"-Wduplicated-cond" #Warn about identical conditions in if-else chains
"-Wduplicated-branches" #Warn when different branches of an if-else chain are equivalent
"-Wnull-dereference" #Warn about null pointer dereference execution paths
"-Wuninitialized" #Warn about unitialized values
"-Wuninitialized" #Warn about uninitialized values
"-Winit-self" #Warn about self-initialization
"-Wcatch-value=3" #Warn when catch statements don't catch by reference
"-Wextra-semi" #Warn about redudnant semicolons
"-Wextra-semi" #Warn about redundant semicolons
"-Wimplicit-fallthrough=3" #Warn about case fallthroughs, but allow 'fallthrough' comments to suppress warnings
#GCC-like optional
#"-Wsuggest-final-types" #Suggest where 'final' would help if specified on a type methods
Expand Down
2 changes: 1 addition & 1 deletion libs/EXTERNAL/libezgl/include/ezgl/point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class point2d {
/**
* Create a point at the given x and y position.
*/
point2d(double x_coord, double y_coord) : x(x_coord), y(y_coord)
point2d(double x_coord, double y_coord) noexcept : x(x_coord), y(y_coord)
{
}

Expand Down
2 changes: 1 addition & 1 deletion libs/EXTERNAL/libezgl/include/ezgl/rectangle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class rectangle {
/**
* Default constructor: Create a zero-sized rectangle at {0,0}.
*/
rectangle() : m_first({0, 0}), m_second({0, 0})
rectangle() noexcept : m_first({0, 0}), m_second({0, 0})
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ template<typename tag, typename T, T sentinel>
bool operator!=(const StrongId<tag,T,sentinel>& lhs, const StrongId<tag,T,sentinel>& rhs);

template<typename tag, typename T, T sentinel>
bool operator<(const StrongId<tag,T,sentinel>& lhs, const StrongId<tag,T,sentinel>& rhs);
bool operator<(const StrongId<tag,T,sentinel>& lhs, const StrongId<tag,T,sentinel>& rhs) noexcept;


//Class template definition with default template parameters
Expand Down Expand Up @@ -198,7 +198,7 @@ class StrongId {
// after the function name (i.e. <>)
friend bool operator== <>(const StrongId<tag,T,sentinel>& lhs, const StrongId<tag,T,sentinel>& rhs);
friend bool operator!= <>(const StrongId<tag,T,sentinel>& lhs, const StrongId<tag,T,sentinel>& rhs);
friend bool operator< <>(const StrongId<tag,T,sentinel>& lhs, const StrongId<tag,T,sentinel>& rhs);
friend bool operator< <>(const StrongId<tag,T,sentinel>& lhs, const StrongId<tag,T,sentinel>& rhs) noexcept;
private:
T id_;
};
Expand All @@ -215,7 +215,7 @@ bool operator!=(const StrongId<tag,T,sentinel>& lhs, const StrongId<tag,T,sentin

//Needed for std::map-like containers
template<typename tag, typename T, T sentinel>
bool operator<(const StrongId<tag,T,sentinel>& lhs, const StrongId<tag,T,sentinel>& rhs) {
bool operator<(const StrongId<tag,T,sentinel>& lhs, const StrongId<tag,T,sentinel>& rhs) noexcept {
return lhs.id_ < rhs.id_;
}

Expand Down
2 changes: 2 additions & 0 deletions libs/libarchfpga/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ target_link_libraries(libarchfpga

if(${VTR_ENABLE_CAPNPROTO})
target_link_libraries(libarchfpga libvtrcapnproto)
find_package(ZLIB REQUIRED)
target_link_libraries(libarchfpga ZLIB::ZLIB)
target_compile_definitions(libarchfpga PRIVATE VTR_ENABLE_CAPNPROTO)
endif()

Expand Down
2 changes: 1 addition & 1 deletion libs/libarchfpga/src/cad_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ struct t_pack_patterns {
std::vector<std::vector<t_pb_graph_pin*>> chain_root_pins;

// default constructor initializing to an invalid pack pattern
t_pack_patterns() {
t_pack_patterns() noexcept {
name = nullptr;
index = -1;
root_block = nullptr;
Expand Down
10 changes: 2 additions & 8 deletions libs/libarchfpga/src/parse_switchblocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,15 @@
*
*
* A large chunk of this file is dedicated to helping parse the initial switchblock
* specificaiton in the XML arch file, providing error checking, etc.
* specification in the XML arch file, providing error checking, etc.
*
* Another large chunk of this file is dedicated to parsing the actual formulas
* specified by the switch block permutation functions into their numeric counterparts.
*/

#include <string.h>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <stack>
#include <utility>
#include <algorithm>

#include "vtr_assert.h"
#include "vtr_util.h"
Expand All @@ -26,9 +22,7 @@

#include "arch_error.h"

#include "read_xml_util.h"
#include "arch_util.h"
#include "arch_types.h"
#include "physical_types.h"
#include "parse_switchblocks.h"

Expand Down
2 changes: 1 addition & 1 deletion libs/libarchfpga/src/physical_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ enum class e_sb_type;
// Metadata value storage.
class t_metadata_value {
public:
explicit t_metadata_value(vtr::interned_string v)
explicit t_metadata_value(vtr::interned_string v) noexcept
: value_(v) {}
explicit t_metadata_value(const t_metadata_value& o) noexcept
: value_(o.value_) {}
Expand Down
2 changes: 1 addition & 1 deletion libs/librrgraph/src/base/rr_graph_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct t_pin_chain_node {
int nxt_node_idx = OPEN;

t_pin_chain_node() = default;
t_pin_chain_node(int pin_num, int nxt_idx)
t_pin_chain_node(int pin_num, int nxt_idx) noexcept
: pin_physical_num(pin_num)
, nxt_node_idx(nxt_idx) {}
};
Expand Down
4 changes: 2 additions & 2 deletions libs/libvtrutil/src/vtr_flat_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class flat_map2;
* @brief A function to create a flat map
*
* Helper function to create a flat map from a vector of pairs
* without haveing to explicity specify the key and value types
* without having to explicitly specify the key and value types
*/
template<class K, class V>
flat_map<K, V> make_flat_map(std::vector<std::pair<K, V>>&& vec) {
Expand Down Expand Up @@ -435,7 +435,7 @@ template<class K, class T, class Compare, class Storage>
class flat_map2 : public flat_map<K, T, Compare, Storage> {
public:
///@brief Constructor
flat_map2() {}
flat_map2() noexcept {}
explicit flat_map2(std::vector<typename flat_map2<K, T, Compare, Storage>::value_type>&& values)
: flat_map<K, T, Compare>(std::move(values)) {}

Expand Down
2 changes: 1 addition & 1 deletion libs/libvtrutil/src/vtr_geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ template<class T>
class Rect {
public: //Constructors
///@brief default constructor
Rect();
Rect() noexcept;

///@brief construct using 4 vertex
Rect(T left_val, T bottom_val, T right_val, T top_val);
Expand Down
2 changes: 1 addition & 1 deletion libs/libvtrutil/src/vtr_geometry.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Point<T>& Point<T>::operator-=(const Point<T>& rhs) {
* Rect
*/
template<class T>
Rect<T>::Rect()
Rect<T>::Rect() noexcept
: Rect<T>(Point<T>(0, 0), Point<T>(0, 0)) {
//pass
}
Expand Down
4 changes: 2 additions & 2 deletions libs/libvtrutil/src/vtr_ndoffsetmatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class NdOffsetMatrixProxy {
* dim_stride: The stride of this dimension (i.e. how many element in memory between indicies of this dimension)
* start: Pointer to the start of the sub-matrix this proxy represents
*/
NdOffsetMatrixProxy<T, N>(const DimRange* dim_ranges, size_t idim, size_t dim_stride, T* start)
NdOffsetMatrixProxy(const DimRange* dim_ranges, size_t idim, size_t dim_stride, T* start)
: dim_ranges_(dim_ranges)
, idim_(idim)
, dim_stride_(dim_stride)
Expand Down Expand Up @@ -116,7 +116,7 @@ class NdOffsetMatrixProxy<T, 1> {
* - dim_stride: The stride of this dimension (i.e. how many element in memory between indicies of this dimension)
* - start: Pointer to the start of the sub-matrix this proxy represents
*/
NdOffsetMatrixProxy<T, 1>(const DimRange* dim_ranges, size_t idim, size_t dim_stride, T* start)
NdOffsetMatrixProxy(const DimRange* dim_ranges, size_t idim, size_t dim_stride, T* start)
: dim_ranges_(dim_ranges)
, idim_(idim)
, dim_stride_(dim_stride)
Expand Down
10 changes: 5 additions & 5 deletions libs/libvtrutil/src/vtr_strong_id.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ template<typename tag, typename T, T sentinel>
constexpr bool operator!=(const StrongId<tag, T, sentinel>& lhs, const StrongId<tag, T, sentinel>& rhs);

template<typename tag, typename T, T sentinel>
constexpr bool operator<(const StrongId<tag, T, sentinel>& lhs, const StrongId<tag, T, sentinel>& rhs);
constexpr bool operator<(const StrongId<tag, T, sentinel>& lhs, const StrongId<tag, T, sentinel>& rhs) noexcept;

template<typename tag, typename T, T sentinel>
std::ostream& operator<<(std::ostream& out, const StrongId<tag, T, sentinel>& rhs);
Expand All @@ -182,11 +182,11 @@ class StrongId {
static constexpr StrongId INVALID() noexcept { return StrongId(); }

///@brief Default to the sentinel value
constexpr StrongId()
constexpr StrongId() noexcept
: id_(sentinel) {}

///@brief Only allow explicit constructions from a raw Id (no automatic conversions)
explicit constexpr StrongId(T id)
explicit constexpr StrongId(T id) noexcept
: id_(id) {}

// Allow some explicit conversion to useful types:
Expand Down Expand Up @@ -216,7 +216,7 @@ class StrongId {
///@brief != operator
friend constexpr bool operator!= <>(const StrongId<tag, T, sentinel>& lhs, const StrongId<tag, T, sentinel>& rhs);
///@brief < operator
friend constexpr bool operator< <>(const StrongId<tag, T, sentinel>& lhs, const StrongId<tag, T, sentinel>& rhs);
friend constexpr bool operator< <>(const StrongId<tag, T, sentinel>& lhs, const StrongId<tag, T, sentinel>& rhs) noexcept;

/**
* @brief to be able to print them out
Expand All @@ -241,7 +241,7 @@ constexpr bool operator!=(const StrongId<tag, T, sentinel>& lhs, const StrongId<

///@brief operator < Needed for std::map-like containers
template<typename tag, typename T, T sentinel>
constexpr bool operator<(const StrongId<tag, T, sentinel>& lhs, const StrongId<tag, T, sentinel>& rhs) {
constexpr bool operator<(const StrongId<tag, T, sentinel>& lhs, const StrongId<tag, T, sentinel>& rhs) noexcept {
return lhs.id_ < rhs.id_;
}

Expand Down
12 changes: 10 additions & 2 deletions libs/libvtrutil/src/vtr_strong_id_range.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ class StrongIdIterator {
using difference_type = ssize_t;

///@brief Dereference operator (*)
StrongId& operator*() {
StrongId operator*() const {
VTR_ASSERT_SAFE(bool(id_));
return this->id_;
return id_;
}

///@brief += operator
Expand All @@ -75,6 +75,14 @@ class StrongIdIterator {
return *this;
}

///@brief Post-increment operator
StrongIdIterator operator++(int) {
VTR_ASSERT_SAFE(bool(id_));
StrongIdIterator temp = *this; // Create a copy of the current object
++(*this); // Use the pre-increment operator to increment
return temp; // Return the copy
}

///@brief Decremment operator
StrongIdIterator& operator--() {
VTR_ASSERT_SAFE(bool(id_));
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/base/setup_noc.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

// a data structure to store the position information of a noc router in the FPGA device
struct t_noc_router_tile_position {
t_noc_router_tile_position(int x, int y, int layer_num, float centroid_x, float centroid_y)
t_noc_router_tile_position(int x, int y, int layer_num, float centroid_x, float centroid_y) noexcept
: grid_width_position(x)
, grid_height_position(y)
, layer_position(layer_num)
Expand Down
8 changes: 7 additions & 1 deletion vpr/src/noc/noc_traffic_flows.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ struct t_noc_traffic_flow {
int traffic_flow_priority;

/** Constructor initializes all variables*/
t_noc_traffic_flow(std::string source_router_name, std::string sink_router_name, ClusterBlockId source_router_id, ClusterBlockId sink_router_id, double flow_bandwidth, double max_flow_latency, int flow_priority)
t_noc_traffic_flow(std::string source_router_name,
std::string sink_router_name,
ClusterBlockId source_router_id,
ClusterBlockId sink_router_id,
double flow_bandwidth,
double max_flow_latency,
int flow_priority) noexcept
: source_router_module_name(std::move(source_router_name))
, sink_router_module_name(std::move(sink_router_name))
, source_router_cluster_id(source_router_id)
Expand Down
4 changes: 2 additions & 2 deletions vpr/src/pack/pack_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct t_lb_type_rr_node {
t_pb_graph_pin* pb_graph_pin; /* pb_graph_pin associated with this lb_rr_node if exists, NULL otherwise */
float intrinsic_cost; /* cost of this node */

t_lb_type_rr_node() {
t_lb_type_rr_node() noexcept {
capacity = 0;
num_modes = 0;
num_fanout = nullptr;
Expand Down Expand Up @@ -130,7 +130,7 @@ struct t_intra_lb_net {
std::vector<bool> fixed_terminals; /* Marks a terminal as having a fixed target (i.e. a pin not a sink) */
t_lb_trace* rt_tree; /* Route tree head */

t_intra_lb_net() {
t_intra_lb_net() noexcept {
atom_net_id = AtomNetId::INVALID();
rt_tree = nullptr;
}
Expand Down
6 changes: 2 additions & 4 deletions vpr/src/place/grid_tile_lookup.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#include "grid_tile_lookup.h"

GridTileLookup::GridTileLookup() {
GridTileLookup::GridTileLookup()
: max_placement_locations(g_vpr_ctx.device().logical_block_types.size()) {
const auto& device_ctx = g_vpr_ctx.device();
const int num_layers = device_ctx.grid.get_num_layers();

//Will store the max number of tile locations for each logical block type
max_placement_locations.resize(device_ctx.logical_block_types.size());

for (const auto& type : device_ctx.logical_block_types) {
vtr::NdMatrix<int, 3> type_count({static_cast<unsigned long>(num_layers), device_ctx.grid.width(), device_ctx.grid.height()});
fill_type_matrix(&type, type_count);
Expand Down
3 changes: 1 addition & 2 deletions vpr/src/route/route_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,12 +601,11 @@ static vtr::vector<ParentBlockId, std::vector<RRNodeId>> load_rr_clb_sources(con

static vtr::vector<ParentNetId, uint8_t> load_is_clock_net(const Netlist<>& net_list,
bool is_flat) {
vtr::vector<ParentNetId, uint8_t> is_clock_net;
vtr::vector<ParentNetId, uint8_t> is_clock_net(net_list.nets().size());

auto& atom_ctx = g_vpr_ctx.atom();
std::set<AtomNetId> clock_nets = find_netlist_physical_clock_nets(atom_ctx.nlist);

is_clock_net.resize(net_list.nets().size());
for (auto net_id : net_list.nets()) {
std::size_t net_id_num = std::size_t(net_id);
if (is_flat) {
Expand Down
4 changes: 1 addition & 3 deletions vpr/src/route/router_lookahead_map_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1219,9 +1219,7 @@ static void run_intra_tile_dijkstra(const RRGraphView& rr_graph,
node_expanded.resize(rr_graph.num_nodes());
std::fill(node_expanded.begin(), node_expanded.end(), false);

vtr::vector<RRNodeId, float> node_seen_cost;
node_seen_cost.resize(rr_graph.num_nodes());
std::fill(node_seen_cost.begin(), node_seen_cost.end(), -1.);
vtr::vector<RRNodeId, float> node_seen_cost(rr_graph.num_nodes(), -1.f);

struct t_pq_entry {
float delay;
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/timing/PreClusterDelayCalculator.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PreClusterDelayCalculator : public tatum::DelayCalculator {
PreClusterDelayCalculator(const AtomNetlist& netlist,
const AtomLookup& netlist_lookup,
float intercluster_net_delay,
const Prepacker& prepacker)
const Prepacker& prepacker) noexcept
: netlist_(netlist)
, netlist_lookup_(netlist_lookup)
, inter_cluster_net_delay_(intercluster_net_delay)
Expand Down

0 comments on commit 55f1490

Please sign in to comment.