Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply static analysis suggestions #1201

Merged
merged 27 commits into from
Dec 12, 2024
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a7ec8b3
Constexpr inline is redundant.
jcoupey Dec 10, 2024
35338e6
Do not use alternative operators.
jcoupey Dec 10, 2024
8b460d2
Do not use size to check for emptyness.
jcoupey Dec 10, 2024
925c3ee
Use std::format in a couple places.
jcoupey Dec 10, 2024
b8325fd
Use default operator== whenever possible.
jcoupey Dec 10, 2024
1c9c105
Remove nested if statements.
jcoupey Dec 10, 2024
88711dc
Use raw string literal.
jcoupey Dec 10, 2024
7ffe35a
Use a lambda instead of taking the address of library functions.
jcoupey Dec 10, 2024
42b59cd
Make sure to use operator |= with bool variables.
jcoupey Dec 10, 2024
1f9cf28
Use transparent equality and hasher with std::unordered_set<std::stri…
jcoupey Dec 10, 2024
7869819
Handle part of the send_then_receive work in functions.
jcoupey Dec 10, 2024
b7574a4
Reduce duplication in ssl_send_then_receive.
jcoupey Dec 10, 2024
499ba86
Apply some readability fixes.
jcoupey Dec 10, 2024
de07144
Add pointer qualification to auto-typed variable deduced to pointer.
jcoupey Dec 10, 2024
91f5e38
Use small underlying type for enums.
jcoupey Dec 10, 2024
6a30fb4
Remove some headers.
jcoupey Dec 10, 2024
d1700d3
Replace iterator-based loop with some range stuff.
jcoupey Dec 11, 2024
5c43145
Update tidy rules.
jcoupey Dec 11, 2024
0ca4451
Const all the things!
jcoupey Dec 11, 2024
aca2d5a
Explicit lambda capture.
jcoupey Dec 11, 2024
9870e04
Avoid superfluous const param in function declarations.
jcoupey Dec 11, 2024
7328ff9
Missing commas in clang-tidy config.
jcoupey Dec 11, 2024
e7ebca3
Remove unused function.
jcoupey Dec 11, 2024
4909481
Remove some magic numbers.
jcoupey Dec 11, 2024
94a0dd3
Consistent parameter naming.
jcoupey Dec 11, 2024
16faa6c
Remove some more magic numbers.
jcoupey Dec 12, 2024
485ee2b
Mention tidying round in changelog.
jcoupey Dec 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use small underlying type for enums.
  • Loading branch information
jcoupey committed Dec 10, 2024
commit 91f5e38382edb6b714a3febada15b938bff5dcab
22 changes: 14 additions & 8 deletions src/structures/typedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ constexpr auto DEFAULT_MAX_TRAVEL_TIME = std::numeric_limits<Duration>::max();
constexpr auto DEFAULT_MAX_DISTANCE = std::numeric_limits<Distance>::max();

// Available routing engines.
enum class ROUTER { OSRM, LIBOSRM, ORS, VALHALLA };
enum class ROUTER : std::uint8_t { OSRM, LIBOSRM, ORS, VALHALLA };

// Used to describe a routing server.
struct Server {
Expand All @@ -107,15 +107,21 @@ struct Server {

// 'Single' job is a regular one-stop job without precedence
// constraints.
enum class JOB_TYPE { SINGLE, PICKUP, DELIVERY };
enum class JOB_TYPE : std::uint8_t { SINGLE, PICKUP, DELIVERY };

// Available location status.
enum class STEP_TYPE { START, JOB, BREAK, END };
enum class STEP_TYPE : std::uint8_t { START, JOB, BREAK, END };

// Heuristic options.
enum class HEURISTIC { BASIC, DYNAMIC };
enum class INIT { NONE, HIGHER_AMOUNT, NEAREST, FURTHEST, EARLIEST_DEADLINE };
enum class SORT { AVAILABILITY, COST };
enum class HEURISTIC : std::uint8_t { BASIC, DYNAMIC };
enum class INIT : std::uint8_t {
NONE,
HIGHER_AMOUNT,
NEAREST,
FURTHEST,
EARLIEST_DEADLINE
};
enum class SORT : std::uint8_t { AVAILABILITY, COST };

struct HeuristicParameters {
HEURISTIC heuristic;
Expand All @@ -132,7 +138,7 @@ struct HeuristicParameters {
};

// Possible violations.
enum class VIOLATION {
enum class VIOLATION : std::uint8_t {
LEAD_TIME,
DELAY,
LOAD,
Expand All @@ -145,7 +151,7 @@ enum class VIOLATION {
MAX_DISTANCE
};

enum OperatorName {
enum OperatorName : std::uint8_t {
UnassignedExchange,
CrossExchange,
MixedExchange,
Expand Down