Skip to content

Commit

Permalink
Drop cpput, C++14, various small fixes and updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
asherikov committed Jan 22, 2025
1 parent 53edb8a commit 76768d3
Show file tree
Hide file tree
Showing 57 changed files with 129 additions and 15,417 deletions.
56 changes: 27 additions & 29 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,58 +1,56 @@
{
"BasedOnStyle": "Google",
"AccessModifierOffset": -4,
"ConstructorInitializerIndentWidth": 2,
"AlignAfterOpenBracket": "AlwaysBreak",
"AlignEscapedNewlinesLeft": false,
"AlignTrailingComments": true,
"AllowAllParametersOfDeclarationOnNextLine": false,
"AllowShortIfStatementsOnASingleLine": false,
"AllowShortLoopsOnASingleLine": false,
"AllowShortFunctionsOnASingleLine": "None",
"AllowShortIfStatementsOnASingleLine": false,
"AllowShortLoopsOnASingleLine": false,
"AlwaysBreakTemplateDeclarations": true,
"AlwaysBreakBeforeMultilineStrings": false,
"AlwaysBreakTemplateDeclarations": true,
"BasedOnStyle": "Google",
"BinPackArguments": false,
"BinPackParameters": false,
"BreakBeforeBinaryOperators": "NonAssignment",
"BreakBeforeBraces": "Allman",
"BreakBeforeTernaryOperators": false,
"BreakConstructorInitializersBeforeComma": true,
"BreakStringLiterals": false,
"BinPackParameters": false,
"BinPackArguments": false,
"ColumnLimit": 120,
"ColumnLimit": 120,
"ConstructorInitializerAllOnOneLineOrOnePerLine": true,
"ConstructorInitializerIndentWidth": 2,
"ContinuationIndentWidth": 8,
"Cpp11BracedListStyle": false,
"DerivePointerAlignment": false,
"DerivePointerBinding": true,
"ExperimentalAutoDetectBinPacking": false,
"FixNamespaceComments": true,
"IndentCaseLabels": true,
"IndentFunctionDeclarationAfterType": false,
"IndentPPDirectives": "AfterHash",
"IndentWidth": 4,
"IndentWrappedFunctionNames": true,
"MaxEmptyLinesToKeep": 3,
"NamespaceIndentation": "All",
"ObjCSpaceBeforeProtocolList": true,
"PenaltyBreakBeforeFirstCallParameter": 19,
"PenaltyBreakComment": 60,
"PenaltyBreakString": 1,
"PenaltyBreakFirstLessLess": 1000,
"PenaltyBreakString": 1,
"PenaltyExcessCharacter": 500,
"PenaltyReturnTypeOnItsOwnLine": 1000,
"PointerAlignment": "Right",
"PointerBindsToType": false,
"SpacesBeforeTrailingComments": 2,
"Cpp11BracedListStyle": false,
"Standard": "Auto",
"IndentWidth": 4,
"TabWidth": 4,
"UseTab": "Never",
"BreakBeforeBraces": "Allman",
"IndentFunctionDeclarationAfterType": false,
"SpacesInParentheses": false,
"SpacesInAngles": false,
"SpaceInEmptyParentheses": false,
"SpacesInCStyleCastParentheses": false,
"SortIncludes": false,
"SpaceAfterControlStatementKeyword": true,
"SpaceBeforeAssignmentOperators": true,
"ContinuationIndentWidth": 8,
"SortIncludes": false,
"IndentPPDirectives": "AfterHash",
"DerivePointerAlignment": false,
"PointerAlignment": "Right",
"FixNamespaceComments": true,
"IndentWrappedFunctionNames": true,
"Standard": "Cpp03",
"SpaceInEmptyParentheses": false,
"SpacesBeforeTrailingComments": 2,
"SpacesInAngles": false,
"SpacesInCStyleCastParentheses": false,
"SpacesInParentheses": false,
"Standard": "c++17",
"TabWidth": 4,
"UseTab": "Never",
}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
build
scanbuild_results
include/qpmad/config.h
include/qpmad/cpput*.h
matlab_octave/make.m
*.mex*
*.o
6 changes: 3 additions & 3 deletions .make/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ APT_INSTALL=sudo apt install -y --no-install-recommends
PIP_INSTALL=sudo python3 -m pip install
GEM_INSTALL=sudo gem install

CLANG_FORMAT?=clang-format13
SCANBUILD?=scan-build-13
CLANG_FORMAT?=clang-format18
SCANBUILD?=scan-build18


help:
Expand Down Expand Up @@ -61,7 +61,7 @@ spell_interactive:
# https://github.com/myint/scspell
spell:
${FIND_SOURCES} \
| xargs ${SPELL_XARGS_ARG} scspell --use-builtin-base-dict --override-dictionary ./qa/scspell.dict
| xargs ${SPELL_XARGS_ARG} scspell --use-builtin-base-dict --override-dictionary ./.make/qa/scspell.dict

clangcheck:
${SCANBUILD} \
Expand Down
1 change: 1 addition & 0 deletions qa/scspell.dict → .make/qa/scspell.dict
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cholesky
copysign
cpput
decltype
dndebug
downdate
eigenut
fstream
Expand Down
9 changes: 2 additions & 7 deletions .make/qpmad.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FIND_SOURCES=find ./matlab_octave ./test/ ./include/ -iname "*.h" -or -iname "*.cpp" | grep -v "cpput_"
FIND_SOURCES=find ./matlab_octave ./test/ ./include/ -iname "*.h" -or -iname "*.cpp"

OPTIONS?=default
ROOT_DIR=../../
Expand Down Expand Up @@ -48,20 +48,17 @@ install_latest_eigen:


format:
${FIND_SOURCES} | grep -v "cpput" | grep -v "eigenut" | xargs ${CLANG_FORMAT} -verbose -i
${FIND_SOURCES} | xargs ${CLANG_FORMAT} -verbose -i


# utils
#----------------------------------------------

addutils:
-git remote add cmakeut https://github.com/asherikov/cmakeut --no-tags
-git remote add cpput https://github.com/asherikov/cpput --no-tags

updateutils:
git fetch --all
git rm --ignore-unmatch -rf cpput
git read-tree --prefix=cpput -u cpput/master
git show remotes/cmakeut/master:cmake/FindEigen3.cmake > cmake/FindEigen3.cmake
git show remotes/cmakeut/master:cmake/cmakeut_compiler_flags.cmake > cmake/cmakeut_compiler_flags.cmake
git show remotes/cmakeut/master:cmake/cmakeut_detect_func_macro.cmake > cmake/cmakeut_detect_func_macro.cmake
Expand Down Expand Up @@ -89,10 +86,8 @@ deb-cloudsmith: deb

clean: clean_common
rm -Rf include/qpmad/config.h
rm -Rf include/qpmad/cpput*.h
rm -Rf debian/ obj-*/
cd matlab_octave; ${MAKE} clean
cd cpput; ${MAKE} clean

forceclean: clean
cd matlab_octave; ${MAKE} forceclean
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
Changelog for package ariles_ros
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

next
----

* Added QPMAD_PEDANTIC_LICENSE cmake option to address
https://github.com/asherikov/qpmad/issues/9
* Require C++14.
* Drop cpput dependency and code generation.


1.3.0 (2022-12-10)
------------------

Expand Down
18 changes: 1 addition & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ set (CMAKEUT_CLANG_TIDY ${QPMAD_CLANG_TIDY})
set (CMAKEUT_CLANG_TIDY_EXTRA_IGNORES "-cert-err58-cpp,-cppcoreguidelines-avoid-non-const-global-variables")
# Eigen issues
set (CMAKEUT_CLANG_TIDY_EXTRA_IGNORES "${CMAKEUT_CLANG_TIDY_EXTRA_IGNORES},-clang-analyzer-core.uninitialized.Assign")
if ("${EIGEN3_VERSION}" VERSION_GREATER "3.4.0")
cmakeut_compiler_flags("c++14")
else()
cmakeut_compiler_flags("c++11")
endif()
cmakeut_compiler_flags("c++14")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKEUT_CXX_FLAGS}")
# --------------

Expand All @@ -85,18 +81,6 @@ write_basic_package_version_file(
# --------------


# --------------
# Dependencies
# --------------
# cpput
set(CPPUT_EMBEDDED ON CACHE BOOL "" FORCE)
set(CPPUT_EMBEDDED_ID "QPMAD_UTILS" CACHE STRING "" FORCE)
set(CPPUT_EMBEDDED_COPY_TO_DIR "${QPMAD_SOURCE_DIR}/${PROJECT_NAME}" CACHE STRING "" FORCE)
set(CPPUT_SELECT_HEADERS "config.h;exception.h" CACHE STRING "" FORCE)
add_subdirectory(cpput)
# --------------


# --------------
# Configure headers
# --------------
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Features:
<a name="dependencies"></a>
Dependencies:
=============
- C++11 compatible compiler
- C++14 compatible compiler
- cmake >= 3.0
- Eigen >= 3.3.0
- Boost (for C++ tests)
Expand Down
63 changes: 22 additions & 41 deletions cmake/cmakeut_compiler_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ function(cmakeut_compiler_flags STANDARD)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")

# using Visual Studio C++
set (CXX_WARNINGS "")
set (CXX_OTHER "/bigobj")

endif()

Expand Down Expand Up @@ -61,66 +59,49 @@ function(cmakeut_compiler_flags STANDARD)


if (CMAKEUT_CLANG_TIDY)
find_program(CLANG_TIDY_EXECUTABLE NAMES clang-tidy clang-tidy13 clang-tidy11 clang-tidy-10 clang-tidy-9 clang-tidy-8 REQUIRED)
find_program(CLANG_TIDY_EXECUTABLE NAMES clang-tidy clang-tidy18 clang-tidy15 clang-tidy-14 clang-tidy-12 REQUIRED)

set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE};-warnings-as-errors=*;-checks=*")

# too annoying
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-llvm-include-order,-google-readability-todo,-readability-static-accessed-through-instance")
# do not enforce auto
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-modernize-use-trailing-return-type,-hicpp-use-auto,-modernize-use-auto")
# do not enforce capitalization of literal suffix, e.g., x = 1u -> x = 1U.
# see ccws scan_build profile
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-llvm-include-order,-google-readability-todo,-readability-static-accessed-through-instance,-google-default-arguments,-readability-identifier-length")
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-modernize-use-trailing-return-type,-hicpp-use-auto,-modernize-use-auto,-modernize-use-trailing-return-type")
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-readability-uppercase-literal-suffix,-hicpp-uppercase-literal-suffix")
# allow function arguments with default values
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-fuchsia-default-arguments,-fuchsia-default-arguments-calls,-fuchsia-default-arguments-declarations")
# member variables can be public/protected
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-cppcoreguidelines-non-private-member-variables-in-classes,-misc-non-private-member-variables-in-classes")
# member initialization in constructors -- false positives
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-cppcoreguidelines-pro-type-member-init,-hicpp-member-init")
# default member initialization scatters initializations -- initialization must be done via constructors
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-modernize-use-default-member-init,-cppcoreguidelines-prefer-member-initializer")
# calling virtual functions from desctructors is well defined and generally safe
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-cppcoreguidelines-pro-type-member-init,-hicpp-member-init,-cppcoreguidelines-prefer-member-initializer")
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-modernize-use-default-member-init")
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-clang-analyzer-optin.cplusplus.VirtualCall")
# these checks require values to be assigned to const variables, which is inconvenient
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers")
# I use access specifiers (public/protected/private) to group members
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-readability-redundant-access-specifiers")
# issues on many macro
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-cppcoreguidelines-pro-type-vararg,-hicpp-vararg")
# there is no from_string
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-boost-use-to-string")
# too common
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-hicpp-no-array-decay")
# long functions are ok
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-google-readability-function-size,-readability-function-size,-hicpp-function-size")


# overly restrictive fuchsia stuff
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-google-runtime-references,-readability-convert-member-functions-to-static")
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-fuchsia-overloaded-operator,-fuchsia-multiple-inheritance,-fuchsia-statically-constructed-objects")
# overly restrictive cppcoreguidelines stuff
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-cppcoreguidelines-macro-usage")
# llvmlibc stuff
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-llvmlibc-*")
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-hicpp-special-member-functions,-cppcoreguidelines-special-member-functions,-bugprone-suspicious-include")
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-cppcoreguidelines-owning-memory")
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-cert-err58-cpp")
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-readability-function-cognitive-complexity")
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-misc-no-recursion")
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-llvm-header-guard")
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-readability-avoid-const-params-in-decls")
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-altera-unroll-loops,-altera-struct-pack-align,-altera-id-dependent-backward-branch")
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-modernize-avoid-bind")
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-cppcoreguidelines-explicit-virtual-functions,-hicpp-use-override,-modernize-use-override")
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-bugprone-reserved-identifier,-bugprone-infinite-loop,-cert-dcl51-cpp,-cert-dcl37-c,-readability-identifier-naming")
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-abseil-*")

set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},${CMAKEUT_CLANG_TIDY_EXTRA_IGNORES}")

#altera- Checks related to OpenCL programming for FPGAs.
set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY},-altera-*")

# might be useful too
#,-cert-env33-c
#,-modernize-avoid-c-arrays
#,-cppcoreguidelines-pro-type-union-access
#,-readability-simplify-boolean-expr

set(CMAKE_CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY}" PARENT_SCOPE)
endif()


if (NOT "${STANDARD}" STREQUAL "")
else()
set (CMAKE_CXX_STANDARD "${STANDARD}" PARENT_SCOPE)
endif()
set(CXX_GENERIC "-std=${STANDARD} ${CXX_WARNINGS} ${CXX_OTHER} ${CXX_SANITIZERS}")


set (CMAKEUT_CXX_FLAGS "${CXX_WARNINGS} ${CXX_OTHER} ${CXX_SANITIZERS}" PARENT_SCOPE)
set (CMAKEUT_CXX_FLAGS "${CXX_GENERIC}" PARENT_SCOPE)
endfunction()
27 changes: 0 additions & 27 deletions cpput/.gitignore

This file was deleted.

Empty file removed cpput/.gitmodules
Empty file.
26 changes: 0 additions & 26 deletions cpput/.travis.yml

This file was deleted.

Loading

0 comments on commit 76768d3

Please sign in to comment.