Skip to content

Commit

Permalink
Removed obsolete format targets, updated clang-format
Browse files Browse the repository at this point in the history
clang-format has a new option called SpacesInLineCommentPrefix that
allows you to control whether it forcibly adds spaces after the // in
comments. I realized we should use the option to disable that feature,
since we have a lot of comments with different numbers of leading spaces
and we don't want clang-format to cause a bunch of unnecessary changes.
Also, I realized that the "format_x" targets in our CMakeLists.txt files
don't work any more, because they assume the cpp and header files are
all in the same directory (and also that builds happen in the source
directory).
  • Loading branch information
etremel committed Apr 11, 2023
1 parent 478aebd commit f429a79
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 31 deletions.
5 changes: 4 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ AllowShortLoopsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: true
BreakBeforeBinaryOperators: true
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BinPackParameters: true
Expand Down Expand Up @@ -47,6 +47,9 @@ SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: true
SpaceBeforeAssignmentOperators: true
SpacesInLineCommentPrefix:
Minimum: 0
Maximum: -1
ContinuationIndentWidth: 8
CommentPragmas: '^ IWYU pragma:'
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
Expand Down
6 changes: 3 additions & 3 deletions include/derecho/core/external_group.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ class ExternalClientCaller {

/**
* Registers a new notification function that will be called when a server
* sends a notification to this subgroup.
* sends a notification to this subgroup.
* If such a lambda function has been registered, it will be replaced by the new one.
* @param func The notification function
*/
template<typename CopyOfT = T>
template <typename CopyOfT = T>
std::enable_if_t<std::is_base_of_v<derecho::NotificationSupport, CopyOfT>>
register_notification_handler(const notification_handler_t& func);
/**
* Unregister the notification function
*/
template<typename CopyOfT = T>
template <typename CopyOfT = T>
std::enable_if_t<std::is_base_of_v<derecho::NotificationSupport, CopyOfT>>
unregister_notification();
/** Sets up a P2P connection to the specified node, if one does not yet exist. */
Expand Down
11 changes: 5 additions & 6 deletions include/derecho/core/group.hpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#pragma once

#include "derecho/conf/conf.hpp"
#include "derecho/tcp/tcp.hpp"
#include "derecho_exception.hpp"
#include "detail/derecho_internal.hpp"
#include "detail/persistence_manager.hpp"
#include "detail/rpc_manager.hpp"
#include "detail/view_manager.hpp"
#include "notification.hpp"
#include "replicated.hpp"
#include "subgroup_info.hpp"
#include "notification.hpp"
#include "derecho/conf/conf.hpp"

#include <mutils-containers/KindMap.hpp>
#include <mutils-containers/TypeMap2.hpp>
Expand Down Expand Up @@ -250,14 +250,14 @@ class Group : public virtual _Group, public GroupProjection<ReplicatedTypes>...

/** Base case for new_view_callback_per_type with an empty parameter pack, does nothing */
template <typename... Empty>
std::enable_if_t<0 == sizeof...(Empty)> new_view_callback_per_type(const View&) {};
std::enable_if_t<0 == sizeof...(Empty)> new_view_callback_per_type(const View&){};

/**
* A helper method for new_view_callback that unpacks the Group's template
* parameter pack and uses each type to access replicated_objects. This is
* the only way to iterate through the KindMap.
*/
template<typename FirstType, typename...RestTypes>
template <typename FirstType, typename... RestTypes>
void new_view_callback_per_type(const View& new_view);

/**
Expand Down Expand Up @@ -467,7 +467,6 @@ class Group : public virtual _Group, public GroupProjection<ReplicatedTypes>...
template <typename SubgroupType>
std::vector<std::vector<IpAndPorts>> get_subgroup_member_addresses(uint32_t subgroup_index = 0);


/** @returns the order of this node in the sequence of members of the group */
std::int32_t get_my_rank();

Expand Down Expand Up @@ -495,7 +494,7 @@ class Group : public virtual _Group, public GroupProjection<ReplicatedTypes>...
* @return a vector of subgroup indexes, or an empty vector if this node
* is not a member of any subgroup of type SubgroupType
*/
template<typename SubgroupType>
template <typename SubgroupType>
std::vector<uint32_t> get_my_subgroup_indexes();

/** Reports to the GMS that the given node has failed. */
Expand Down
2 changes: 0 additions & 2 deletions src/conf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@ target_link_libraries(conftst pthread)

install(FILES derecho-sample.cfg
DESTINATION share/derecho/)

add_custom_target(format_conf clang-format -i *.cpp *.hpp)
4 changes: 1 addition & 3 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,4 @@ target_include_directories(core PRIVATE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
)
# OBJECT libraries are not linked, but this command can be used to declare library dependencies
target_link_libraries(core spdlog::spdlog)

add_custom_target(format_core clang-format -i *.cpp *.h)
target_link_libraries(core spdlog::spdlog)
4 changes: 2 additions & 2 deletions src/core/git_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace derecho {
const int MAJOR_VERSION = 2;
const int MINOR_VERSION = 3;
const int PATCH_VERSION = 0;
const int COMMITS_AHEAD_OF_VERSION = 54;
const int COMMITS_AHEAD_OF_VERSION = 60;
const char* VERSION_STRING = "2.3.0";
const char* VERSION_STRING_PLUS_COMMITS = "2.3.0+54";
const char* VERSION_STRING_PLUS_COMMITS = "2.3.0+60";

}
2 changes: 0 additions & 2 deletions src/mutils-serialization/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ target_include_directories(mutils-serialization PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>)

add_custom_target(format_mutils-serialization clang-format-3.8 -i *.cpp *.hpp)

add_executable(test serialization-test.cpp SerializationSupport.cpp)
target_include_directories(test PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
Expand Down
2 changes: 0 additions & 2 deletions src/persistent/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ target_include_directories(persistent_test PRIVATE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
)
target_link_libraries(persistent_test pthread mutils stdc++fs OpenSSL::Crypto spdlog::spdlog)

add_custom_target(format_persistent clang-format -i *.cpp *.hpp)
2 changes: 0 additions & 2 deletions src/rdmc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,3 @@ target_include_directories(rdmc PRIVATE

#ADD_EXECUTABLE(verbs-mcast experiment.cpp)
#TARGET_LINK_LIBRARIES(verbs-mcast rdmc)

add_custom_target(format_rdmc clang-format -i *.cpp *.h)
2 changes: 0 additions & 2 deletions src/sst/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ endif()
target_include_directories(sst PRIVATE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
)

add_custom_target(format_sst clang-format -i *.cpp *.hpp)
4 changes: 1 addition & 3 deletions src/tcp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
ADD_LIBRARY(tcp OBJECT tcp.cpp)
target_include_directories(tcp PRIVATE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
)

add_custom_target(format_tcp clang-format -i *.cpp *.hpp)
)
4 changes: 1 addition & 3 deletions src/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ target_include_directories(utils PRIVATE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
)
# OBJECT libraries are not linked, but this command can be used to declare library dependencies
target_link_libraries(utils spdlog::spdlog)

add_custom_target(format_utils clang-format -i *.cpp *.hpp)
target_link_libraries(utils spdlog::spdlog)

0 comments on commit f429a79

Please sign in to comment.