Skip to contentSkip to conversation

bindings: cxx: examples: consistently use () for functions taking no args

PATCH New Bartosz Golaszewski 1 participant 2 messages Jun 26, 2023 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 bindings: cxx: examples: consistently use () for functions taking no args

From: Bartosz Golaszewski <[email protected]>

While () and (void) are synonymous in C++, we use () everywhere else so stick to that pattern in examples.

---
 bindings/cxx/examples/async_watch_line_value.cpp      | 2 +-
 bindings/cxx/examples/find_line_by_name.cpp           | 2 +-
 bindings/cxx/examples/get_chip_info.cpp               | 2 +-
 bindings/cxx/examples/get_line_info.cpp               | 2 +-
 bindings/cxx/examples/get_line_value.cpp              | 2 +-
 bindings/cxx/examples/get_multiple_line_values.cpp    | 2 +-
 bindings/cxx/examples/reconfigure_input_to_output.cpp | 2 +-
 bindings/cxx/examples/toggle_line_value.cpp           | 2 +-
 bindings/cxx/examples/toggle_multiple_line_values.cpp | 2 +-
 bindings/cxx/examples/watch_line_info.cpp             | 2 +-
 bindings/cxx/examples/watch_line_rising.cpp           | 2 +-
 bindings/cxx/examples/watch_line_value.cpp            | 2 +-
 bindings/cxx/examples/watch_multiple_line_values.cpp  | 2 +-
 13 files changed, 13 insertions(+), 13 deletions(-)
bindings/cxx/examples/async_watch_line_value.cpp +1 -1
index d8317a5..9ea9763 100644
@@ -31,7 +31,7 @@ const char* edge_event_type_str(const ::gpiod::edge_event &event)
 
 } /* namespace */
 
-int main(void)
+int main()
 {
 	/*
 	 * Assume a button connecting the pin to ground, so pull it up and
bindings/cxx/examples/find_line_by_name.cpp +1 -1
index 983251a..7b56e69 100644
@@ -15,7 +15,7 @@ const ::std::string line_name = "GPIO19";
 
 } /* namespace */
 
-int main(void)
+int main()
 {
 	/*
 	 * Names are not guaranteed unique, so this finds the first line with
bindings/cxx/examples/get_chip_info.cpp +1 -1
index 073a6c3..2bf26f0 100644
@@ -15,7 +15,7 @@ const ::std::filesystem::path chip_path("/dev/gpiochip0");
 
 } /* namespace */
 
-int main(void)
+int main()
 {
 	::gpiod::chip chip(chip_path);
 	auto info = chip.get_info();
bindings/cxx/examples/get_line_info.cpp +1 -1
index f2f071e..7d517af 100644
@@ -17,7 +17,7 @@ const ::gpiod::line::offset line_offset = 3;
 
 } /* namespace */
 
-int main(void)
+int main()
 {
 	auto chip = ::gpiod::chip(chip_path);
 	auto info = chip.get_line_info(line_offset);
bindings/cxx/examples/get_line_value.cpp +1 -1
index a14d7e4..fe4f52e 100644
@@ -16,7 +16,7 @@ const ::gpiod::line::offset line_offset = 5;
 
 } /* namespace */
 
-int main(void)
+int main()
 {
 	auto request = ::gpiod::chip(chip_path)
 			       .prepare_request()
bindings/cxx/examples/get_multiple_line_values.cpp +1 -1
index d1f22e7..cbd5395 100644
@@ -15,7 +15,7 @@ const ::gpiod::line::offsets line_offsets = { 5, 3, 7 };
 
 } /* namespace */
 
-int main(void)
+int main()
 {
 	auto request = ::gpiod::chip(chip_path)
 			       .prepare_request()
bindings/cxx/examples/reconfigure_input_to_output.cpp +1 -1
index 896c812..d55eaf5 100644
@@ -19,7 +19,7 @@ const ::gpiod::line::offset line_offset = 5;
 
 } /* namespace */
 
-int main(void)
+int main()
 {
 	/* request the line initially as an input */
 	auto request = ::gpiod::chip(chip_path)
bindings/cxx/examples/toggle_line_value.cpp +1 -1
index a17b43b..3dbdb71 100644
@@ -25,7 +25,7 @@ const ::gpiod::line::offset line_offset = 5;
 
 } /* namespace */
 
-int main(void)
+int main()
 {
 	::gpiod::line::value value = ::gpiod::line::value::ACTIVE;
 
bindings/cxx/examples/toggle_multiple_line_values.cpp +1 -1
index a5b84bf..df55313 100644
@@ -37,7 +37,7 @@ void print_values(::gpiod::line::offsets const &offsets,
 
 } /* namespace */
 
-int main(void)
+int main()
 {
 	::gpiod::line::values values = { ::gpiod::line::value::ACTIVE,
 					 ::gpiod::line::value::ACTIVE,
bindings/cxx/examples/watch_line_info.cpp +1 -1
index 414fb06..6d55500 100644
@@ -30,7 +30,7 @@ const char *event_type(const ::gpiod::info_event &event)
 
 } /* namespace */
 
-int main(void)
+int main()
 {
 	::gpiod::chip chip(chip_path);
 
bindings/cxx/examples/watch_line_rising.cpp +1 -1
index aa3be9c..33e4f01 100644
@@ -29,7 +29,7 @@ const char *edge_event_type_str(const ::gpiod::edge_event &event)
 
 } /* namespace */
 
-int main(void)
+int main()
 {
 	auto request =
 		::gpiod::chip(chip_path)
bindings/cxx/examples/watch_line_value.cpp +1 -1
index 5055789..ebc7fe7 100644
@@ -29,7 +29,7 @@ const char *edge_event_type_str(const ::gpiod::edge_event &event)
 
 } /* namespace */
 
-int main(void)
+int main()
 {
 	/*
 	 * Assume a button connecting the pin to ground, so pull it up and
bindings/cxx/examples/watch_multiple_line_values.cpp +1 -1
index 42b7213..fb71fb2 100644
@@ -28,7 +28,7 @@ const char *edge_event_type_str(const ::gpiod::edge_event &event)
 
 } /* namespace */
 
-int main(void)
+int main()
 {
 	auto request =
 		::gpiod::chip(chip_path)
Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/2 bindings: cxx: use () instead of (void) in line_settings::reset()

From: Bartosz Golaszewski <[email protected]>

While () and (void) are synonymous in C++, we use () everywhere else so fix the only exception. This DOES NOT change the ABI as the generated symbol is the same (at least as verified on gcc and clang).

---
 bindings/cxx/gpiodcxx/line-settings.hpp | 2 +-
 bindings/cxx/line-settings.cpp          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
bindings/cxx/gpiodcxx/line-settings.hpp +1 -1
index b043167..bacf359 100644
@@ -70,7 +70,7 @@ public:
 	 * @brief Reset the line settings to default values.
 	 * @return Reference to self.
 	 */
-	line_settings& reset(void) noexcept;
+	line_settings& reset() noexcept;
 
 	/**
 	 * @brief Set direction.
bindings/cxx/line-settings.cpp +1 -1
index 272a848..30d7899 100644
@@ -179,7 +179,7 @@ GPIOD_CXX_API line_settings& line_settings::operator=(line_settings&& other)
 	return *this;
 }
 
-GPIOD_CXX_API line_settings& line_settings::reset(void) noexcept
+GPIOD_CXX_API line_settings& line_settings::reset() noexcept
 {
 	::gpiod_line_settings_reset(this->_m_priv->settings.get());
 
Signature · 1 line
2.39.2