Skip to content

Commit

Permalink
Use small_vector implementation ubsan is happy with
Browse files Browse the repository at this point in the history
LLVM's SmallVector threw maybe-uninitialized warnings in GCC 14.
  • Loading branch information
calcmogul committed Jun 16, 2024
1 parent b699579 commit 55dba78
Show file tree
Hide file tree
Showing 17 changed files with 4,416 additions and 181 deletions.
4 changes: 4 additions & 0 deletions include/.styleguide
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ cppSrcFileInclude {
\.cpp$
}

licenseUpdateExclude {
include/sleipnir/util/small_vector\.hpp$
}

includeOtherLibs {
^Eigen/
}
2 changes: 1 addition & 1 deletion include/sleipnir/autodiff/Expression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include "sleipnir/autodiff/ExpressionType.hpp"
#include "sleipnir/util/IntrusiveSharedPtr.hpp"
#include "sleipnir/util/Pool.hpp"
#include "sleipnir/util/SmallVector.hpp"
#include "sleipnir/util/SymbolExports.hpp"
#include "sleipnir/util/small_vector.hpp"

namespace sleipnir::detail {

Expand Down
2 changes: 1 addition & 1 deletion include/sleipnir/autodiff/ExpressionGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

#include "sleipnir/autodiff/Expression.hpp"
#include "sleipnir/util/FunctionRef.hpp"
#include "sleipnir/util/SmallVector.hpp"
#include "sleipnir/util/SymbolExports.hpp"
#include "sleipnir/util/small_vector.hpp"

namespace sleipnir::detail {

Expand Down
2 changes: 1 addition & 1 deletion include/sleipnir/autodiff/Hessian.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include "sleipnir/autodiff/Profiler.hpp"
#include "sleipnir/autodiff/Variable.hpp"
#include "sleipnir/autodiff/VariableMatrix.hpp"
#include "sleipnir/util/SmallVector.hpp"
#include "sleipnir/util/SymbolExports.hpp"
#include "sleipnir/util/small_vector.hpp"

namespace sleipnir {

Expand Down
2 changes: 1 addition & 1 deletion include/sleipnir/autodiff/Jacobian.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include "sleipnir/autodiff/Profiler.hpp"
#include "sleipnir/autodiff/Variable.hpp"
#include "sleipnir/autodiff/VariableMatrix.hpp"
#include "sleipnir/util/SmallVector.hpp"
#include "sleipnir/util/SymbolExports.hpp"
#include "sleipnir/util/small_vector.hpp"

namespace sleipnir {

Expand Down
12 changes: 6 additions & 6 deletions include/sleipnir/autodiff/VariableBlock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ class VariableBlock {
* @param row The scalar subblock's row.
* @param col The scalar subblock's column.
*/
template <typename Mat2 = Mat>
requires(!std::is_const_v<Mat2>)
Variable& operator()(int row, int col) {
Variable& operator()(int row, int col)
requires(!std::is_const_v<Mat>)
{
Assert(row >= 0 && row < Rows());
Assert(col >= 0 && col < Cols());
return (*m_mat)(m_rowOffset + row, m_colOffset + col);
Expand All @@ -243,9 +243,9 @@ class VariableBlock {
*
* @param row The scalar subblock's row.
*/
template <typename Mat2 = Mat>
requires(!std::is_const_v<Mat2>)
Variable& operator()(int row) {
Variable& operator()(int row)
requires(!std::is_const_v<Mat>)
{
Assert(row >= 0 && row < Rows() * Cols());
return (*this)(row / Cols(), row % Cols());
}
Expand Down
2 changes: 1 addition & 1 deletion include/sleipnir/autodiff/VariableMatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#include "sleipnir/autodiff/VariableBlock.hpp"
#include "sleipnir/util/Assert.hpp"
#include "sleipnir/util/FunctionRef.hpp"
#include "sleipnir/util/SmallVector.hpp"
#include "sleipnir/util/SymbolExports.hpp"
#include "sleipnir/util/small_vector.hpp"

namespace sleipnir {

Expand Down
2 changes: 1 addition & 1 deletion include/sleipnir/optimization/Constraints.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include "sleipnir/autodiff/Variable.hpp"
#include "sleipnir/util/Assert.hpp"
#include "sleipnir/util/Concepts.hpp"
#include "sleipnir/util/SmallVector.hpp"
#include "sleipnir/util/SymbolExports.hpp"
#include "sleipnir/util/small_vector.hpp"

namespace sleipnir {

Expand Down
2 changes: 1 addition & 1 deletion include/sleipnir/optimization/Multistart.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "sleipnir/optimization/SolverStatus.hpp"
#include "sleipnir/util/FunctionRef.hpp"
#include "sleipnir/util/SmallVector.hpp"
#include "sleipnir/util/small_vector.hpp"

namespace sleipnir {

Expand Down
2 changes: 1 addition & 1 deletion include/sleipnir/optimization/OptimizationProblem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include "sleipnir/optimization/SolverStatus.hpp"
#include "sleipnir/optimization/solver/InteriorPoint.hpp"
#include "sleipnir/util/Print.hpp"
#include "sleipnir/util/SmallVector.hpp"
#include "sleipnir/util/SymbolExports.hpp"
#include "sleipnir/util/small_vector.hpp"

namespace sleipnir {

Expand Down
2 changes: 1 addition & 1 deletion include/sleipnir/util/Pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <cstddef>
#include <memory>

#include "sleipnir/util/SmallVector.hpp"
#include "sleipnir/util/SymbolExports.hpp"
#include "sleipnir/util/small_vector.hpp"

namespace sleipnir {

Expand Down
163 changes: 0 additions & 163 deletions include/sleipnir/util/SmallVector.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion include/sleipnir/util/Spy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

#include <Eigen/SparseCore>

#include "sleipnir/util/SmallVector.hpp"
#include "sleipnir/util/SymbolExports.hpp"
#include "sleipnir/util/small_vector.hpp"

namespace sleipnir {

Expand Down
Loading

0 comments on commit 55dba78

Please sign in to comment.