Skip to content

Commit 6794c8e

Browse files
authored
Merge pull request #2407 from elBoberido/iox-846-reduce-undefs-in-platform-correction-header
iox-#846 Reduce undefs in platform correction header
2 parents 8d4afc5 + 34f7c36 commit 6794c8e

File tree

57 files changed

+370
-379
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+370
-379
lines changed

doc/website/FAQ.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ SharedMemory still there, doing an unlink of /root
8383
Reserving 27902400 bytes in the shared memory [/root]
8484
While setting the acquired shared memory to zero a fatal SIGBUS signal appeared
8585
caused by memset. The shared memory object with the following properties
86-
[ name = /root, sizeInBytes = 27902400, access mode = AccessMode::READ_WRITE,
86+
[ name = /root, sizeInBytes = 27902400, access mode = AccessMode::ReadWrite,
8787
ownership = OwnerShip::MINE, baseAddressHint = (nil), permissions = 0 ] maybe
8888
requires more memory than it is currently available in the system.
8989
```

doc/website/release-notes/iceoryx-unreleased.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@
309309
iox::optional<iox::NamedSemaphore> semaphore;
310310
auto result = iox::NamedSemaphoreBuilder()
311311
.name("mySemaphoreName")
312-
.openMode(iox::OpenMode::OPEN_OR_CREATE)
312+
.openMode(iox::OpenMode::OpenOrCreate)
313313
.permissions(iox::perms::owner_all)
314314
.initialValue(0U)
315315
.create(semaphore);

iceoryx_hoofs/cli/include/iox/cli/option.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ struct OptionWithDetails : public Option // can this be melt together
9090
struct
9191
{
9292
OptionDescription_t description;
93-
OptionType type = OptionType::SWITCH;
93+
OptionType type = OptionType::Switch;
9494
TypeName_t typeName;
9595
} details;
9696
};

iceoryx_hoofs/cli/include/iox/cli/option_manager.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ inline bool OptionManager::extractOptionArgumentValue(const Arguments& arguments
4040
const OptionName_t& name,
4141
const OptionType optionType)
4242
{
43-
if (optionType == OptionType::SWITCH)
43+
if (optionType == OptionType::Switch)
4444
{
4545
return arguments.isSwitchSet(getLookupName(shortName, name));
4646
}

iceoryx_hoofs/cli/include/iox/cli/types.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ namespace cli
3030
enum class OptionType : uint8_t
3131
{
3232
/// @brief option when provided is true
33-
SWITCH,
33+
Switch,
3434
/// @brief option with value which has to be provided
35-
REQUIRED,
35+
Required,
3636
/// @brief option with value which can be provided
37-
OPTIONAL
37+
Optional
3838
};
3939

4040
static constexpr uint64_t MAX_OPTION_NAME_LENGTH = 32;

iceoryx_hoofs/cli/include/iox/cli_definition.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
/// @param[in] description a description of the optional value
4747
#define IOX_CLI_OPTIONAL(type, memberName, defaultValue, shortName, longName, description) \
4848
IOX_INTERNAL_CMD_LINE_VALUE( \
49-
type, memberName, defaultValue, shortName, longName, description, iox::cli::OptionType::OPTIONAL)
49+
type, memberName, defaultValue, shortName, longName, description, iox::cli::OptionType::Optional)
5050

5151
/// @brief Adds a required value to the command line, if it is not provided the program will print the help and
5252
/// terminate
@@ -57,15 +57,15 @@
5757
/// @param[in] description a description of the required value
5858
#define IOX_CLI_REQUIRED(type, memberName, shortName, longName, description) \
5959
IOX_INTERNAL_CMD_LINE_VALUE( \
60-
type, memberName, type(), shortName, longName, description, iox::cli::OptionType::REQUIRED)
60+
type, memberName, type(), shortName, longName, description, iox::cli::OptionType::Required)
6161

6262
/// @brief Adds a switch to the command line
6363
/// @param[in] memberName the name under which the switch is accessible
6464
/// @param[in] shortName a single character for the short option like '-s' for instance
6565
/// @param[in] longName a long option name under which this can be accessed like '--some-name' for instance
6666
/// @param[in] description a description of the switch
6767
#define IOX_CLI_SWITCH(memberName, shortName, longName, description) \
68-
IOX_INTERNAL_CMD_LINE_VALUE(bool, memberName, false, shortName, longName, description, iox::cli::OptionType::SWITCH)
68+
IOX_INTERNAL_CMD_LINE_VALUE(bool, memberName, false, shortName, longName, description, iox::cli::OptionType::Switch)
6969

7070
/// @brief Helper macro to create a struct with full command line parsing from argc, argv.
7171
/// @param[in] Name the name of the class/struct

iceoryx_hoofs/cli/source/command_line_parser.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ CommandLineParser::parse(const OptionDefinition& optionSet, int argc, char** arg
217217
return m_optionValue;
218218
}
219219

220-
if (optionEntry->details.type == OptionType::SWITCH)
220+
if (optionEntry->details.type == OptionType::Switch)
221221
{
222222
m_optionValue.m_arguments.emplace_back(*optionEntry);
223223
m_optionValue.m_arguments.back().value.clear();
@@ -271,7 +271,7 @@ void CommandLineParser::setDefaultValuesToUnsetOptions() noexcept // rename
271271
{
272272
for (const auto& availableOption : m_optionSet->m_availableOptions)
273273
{
274-
if (availableOption.details.type != OptionType::OPTIONAL)
274+
if (availableOption.details.type != OptionType::Optional)
275275
{
276276
continue;
277277
}
@@ -298,7 +298,7 @@ bool CommandLineParser::areAllRequiredValuesPresent() const noexcept
298298
bool areAllRequiredValuesPresent = true;
299299
for (const auto& availableOption : m_optionSet->m_availableOptions)
300300
{
301-
if (availableOption.details.type == OptionType::REQUIRED)
301+
if (availableOption.details.type == OptionType::Required)
302302
{
303303
bool isValuePresent = false;
304304
for (const auto& option : m_optionValue.m_arguments)
@@ -359,7 +359,7 @@ void CommandLineParser::printHelpAndExit() const noexcept
359359
outLength += 2 + option.longOption.size();
360360
}
361361

362-
if (option.details.type == OptionType::REQUIRED || option.details.type == OptionType::OPTIONAL)
362+
if (option.details.type == OptionType::Required || option.details.type == OptionType::Optional)
363363
{
364364
std::cout << " [" << option.details.typeName << "]";
365365
outLength += 3 + option.details.typeName.size();
@@ -373,7 +373,7 @@ void CommandLineParser::printHelpAndExit() const noexcept
373373
}
374374
std::cout << option.details.description << std::endl;
375375

376-
if (option.details.type == OptionType::OPTIONAL)
376+
if (option.details.type == OptionType::Optional)
377377
{
378378
for (uint64_t i = 0; i < OPTION_OUTPUT_WIDTH; ++i)
379379
{

iceoryx_hoofs/cli/source/option_definition.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ OptionDefinition::OptionDefinition(const OptionDescription_t& programDescription
2727
, m_onFailureCallback{onFailureCallback}
2828
{
2929
constexpr bool IS_SWITCH = true;
30-
std::move(*this).addOption({{'h', IS_SWITCH, {"help"}, {""}}, {"Display help."}, OptionType::SWITCH, {""}});
30+
std::move(*this).addOption({{'h', IS_SWITCH, {"help"}, {""}}, {"Display help."}, OptionType::Switch, {""}});
3131
}
3232

3333
optional<OptionWithDetails> OptionDefinition::getOption(const OptionName_t& name) const noexcept
@@ -100,7 +100,7 @@ OptionDefinition& OptionDefinition::addSwitch(const char shortOption,
100100
const OptionDescription_t& description) noexcept
101101
{
102102
constexpr bool IS_SWITCH = true;
103-
return addOption({{shortOption, IS_SWITCH, longOption, {""}}, description, OptionType::SWITCH, {""}});
103+
return addOption({{shortOption, IS_SWITCH, longOption, {""}}, description, OptionType::Switch, {""}});
104104
}
105105

106106
// NOLINTJUSTIFICATION this is not a user facing API but hidden in a macro
@@ -113,15 +113,15 @@ OptionDefinition& OptionDefinition::addOptional(const char shortOption,
113113
{
114114
constexpr bool IS_NO_SWITCH = false;
115115
return addOption(
116-
{{shortOption, IS_NO_SWITCH, longOption, defaultValue}, description, OptionType::OPTIONAL, typeName});
116+
{{shortOption, IS_NO_SWITCH, longOption, defaultValue}, description, OptionType::Optional, typeName});
117117
}
118118
OptionDefinition& OptionDefinition::addRequired(const char shortOption,
119119
const OptionName_t& longOption,
120120
const OptionDescription_t& description,
121121
const TypeName_t& typeName) noexcept
122122
{
123123
constexpr bool IS_NO_SWITCH = false;
124-
return addOption({{shortOption, IS_NO_SWITCH, longOption, {""}}, description, OptionType::REQUIRED, typeName});
124+
return addOption({{shortOption, IS_NO_SWITCH, longOption, {""}}, description, OptionType::Required, typeName});
125125
}
126126

127127
std::ostream& operator<<(std::ostream& stream, const OptionWithDetails& option) noexcept

iceoryx_hoofs/filesystem/include/iox/detail/filesystem.inl

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ inline bool isValidPathEntry(const iox::string<StringCapacity>& name,
2929

3030
if ((name == currentDirectory) || (name == parentDirectory))
3131
{
32-
return relativePathComponents == RelativePathComponents::ACCEPT;
32+
return relativePathComponents == RelativePathComponents::Accept;
3333
}
3434

3535
const auto nameSize = name.size();
@@ -75,7 +75,7 @@ inline bool isValidFileName(const iox::string<StringCapacity>& name) noexcept
7575
}
7676

7777
// check if the file contains only valid characters
78-
return isValidPathEntry(name, RelativePathComponents::REJECT);
78+
return isValidPathEntry(name, RelativePathComponents::Reject);
7979
}
8080

8181
template <uint64_t StringCapacity>
@@ -160,7 +160,7 @@ inline bool isValidPathToDirectory(const iox::string<StringCapacity>& name) noex
160160
}
161161
else // we reached the last entry, if its a valid file name the path is valid
162162
{
163-
return isValidPathEntry(remaining, RelativePathComponents::ACCEPT);
163+
return isValidPathEntry(remaining, RelativePathComponents::Accept);
164164
}
165165
}
166166

@@ -191,32 +191,32 @@ inline constexpr const char* asStringLiteral(const OpenMode mode) noexcept
191191
{
192192
switch (mode)
193193
{
194-
case OpenMode::EXCLUSIVE_CREATE:
195-
return "OpenMode::EXCLUSIVE_CREATE";
196-
case OpenMode::PURGE_AND_CREATE:
197-
return "OpenMode::PURGE_AND_CREATE";
198-
case OpenMode::OPEN_OR_CREATE:
199-
return "OpenMode::OPEN_OR_CREATE";
200-
case OpenMode::OPEN_EXISTING:
201-
return "OpenMode::OPEN_EXISTING";
194+
case OpenMode::ExclusiveCreate:
195+
return "OpenMode::ExclusiveCreate";
196+
case OpenMode::PurgeAndCreate:
197+
return "OpenMode::PurgeAndCreate";
198+
case OpenMode::OpenOrCreate:
199+
return "OpenMode::OpenOrCreate";
200+
case OpenMode::OpenExisting:
201+
return "OpenMode::OpenExisting";
202202
}
203203

204-
return "OpenMode::UNDEFINED_VALUE";
204+
return "OpenMode::UndefinedValue";
205205
}
206206

207207
inline constexpr const char* asStringLiteral(const AccessMode mode) noexcept
208208
{
209209
switch (mode)
210210
{
211-
case AccessMode::READ_ONLY:
212-
return "AccessMode::READ_ONLY";
213-
case AccessMode::READ_WRITE:
214-
return "AccessMode::READ_WRITE";
215-
case AccessMode::WRITE_ONLY:
216-
return "AccessMode::WRITE_ONLY";
211+
case AccessMode::ReadOnly:
212+
return "AccessMode::ReadOnly";
213+
case AccessMode::ReadWrite:
214+
return "AccessMode::ReadWrite";
215+
case AccessMode::WriteOnly:
216+
return "AccessMode::WriteOnly";
217217
}
218218

219-
return "AccessMode::UNDEFINED_VALUE";
219+
return "AccessMode::UndefinedValue";
220220
}
221221

222222

iceoryx_hoofs/filesystem/include/iox/filesystem.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ constexpr char ASCII_UNDERSCORE{'_'};
4242

4343
enum class RelativePathComponents : uint8_t
4444
{
45-
REJECT,
46-
ACCEPT
45+
Reject,
46+
Accept
4747
};
4848

4949
/// @brief checks if the given string is a valid path entry. A path entry is the string between
@@ -93,22 +93,22 @@ bool doesEndWithPathSeparator(const string<StringCapacity>& name) noexcept;
9393

9494
enum class AccessMode : uint8_t
9595
{
96-
READ_ONLY = 0U,
97-
READ_WRITE = 1U,
98-
WRITE_ONLY = 2U
96+
ReadOnly = 0U,
97+
ReadWrite = 1U,
98+
WriteOnly = 2U
9999
};
100100

101101
/// @brief describes how the shared memory is opened or created
102102
enum class OpenMode : uint8_t
103103
{
104104
/// @brief creates the shared memory, if it exists already the construction will fail
105-
EXCLUSIVE_CREATE = 0U,
105+
ExclusiveCreate = 0U,
106106
/// @brief creates the shared memory, if it exists it will be deleted and recreated
107-
PURGE_AND_CREATE = 1U,
107+
PurgeAndCreate = 1U,
108108
/// @brief creates the shared memory, if it does not exist otherwise it opens it
109-
OPEN_OR_CREATE = 2U,
109+
OpenOrCreate = 2U,
110110
/// @brief opens the shared memory, if it does not exist it will fail
111-
OPEN_EXISTING = 3U
111+
OpenExisting = 3U
112112
};
113113

114114
/// @brief converts OpenMode into a string literal

0 commit comments

Comments
 (0)