diff --git a/meson.build b/meson.build index 1e5665459b..d28c14051d 100644 --- a/meson.build +++ b/meson.build @@ -35,7 +35,7 @@ project( 'HelenOS', [ 'c', 'cpp' ], default_options : ['buildtype=plain', 'c_std=gnu11', 'cpp_std=c++17', 'warning_level=2', 'werror=false', 'b_staticpic=false', 'prefix=/' ], - meson_version: '>=0.50.1', + meson_version: '>=0.55.0', ) debug_options = false diff --git a/meson/part/compiler_args/meson.build b/meson/part/compiler_args/meson.build index 0e9b6453a2..82691caa31 100644 --- a/meson/part/compiler_args/meson.build +++ b/meson/part/compiler_args/meson.build @@ -59,7 +59,6 @@ extra_common_flags = [ '-Wall', '-Wextra', - '-Werror-implicit-function-declaration', '-Wwrite-strings', '-Wunknown-pragmas', @@ -91,6 +90,7 @@ endif extra_cflags = extra_common_flags + [ '-Wmissing-prototypes', + '-Werror-implicit-function-declaration', '-Wno-missing-braces', '-Wno-missing-field-initializers', diff --git a/meson/part/extra_targets/meson.build b/meson/part/extra_targets/meson.build index f3c0616ad5..a7fd5d2467 100644 --- a/meson/part/extra_targets/meson.build +++ b/meson/part/extra_targets/meson.build @@ -33,7 +33,7 @@ run_target('config', '-c', 'cd $1 && $2 $3 $4 $5', '--', meson.build_root(), - config_py.path(), + config_py.full_path(), meson.source_root() / 'HelenOS.config', meson.source_root() / 'defaults', '--mask-platform', @@ -50,7 +50,7 @@ if false '-c', 'cd $1 && $2 $3 $4 random', '--', meson.build_root(), - config_py.path(), + config_py.full_path(), meson.source_root() / 'HelenOS.config', meson.source_root() / 'defaults', ] @@ -76,7 +76,7 @@ if doxygen.found() '-c', 'cd $1 && $2 $3', '--', meson.source_root() / 'doxygen', - doxygen.path(), + doxygen.full_path(), _dox_cfg, ]) endif diff --git a/uspace/app/wifi_supplicant/wifi_supplicant.c b/uspace/app/wifi_supplicant/wifi_supplicant.c index 8b3f74a551..a9f240f550 100644 --- a/uspace/app/wifi_supplicant/wifi_supplicant.c +++ b/uspace/app/wifi_supplicant/wifi_supplicant.c @@ -74,17 +74,11 @@ static void print_syntax(void) printf("\tdisconnect - disconnect from network\n"); } -static char *nic_addr_format(nic_address_t *addr) +static void nic_addr_format(nic_address_t *addr, char *out, size_t out_size) { - char *str; - int rc = asprintf(&str, "%02x:%02x:%02x:%02x:%02x:%02x", + snprintf(out, out_size, "%02x:%02x:%02x:%02x:%02x:%02x", addr->address[0], addr->address[1], addr->address[2], addr->address[3], addr->address[4], addr->address[5]); - - if (rc < 0) - return NULL; - - return str; } static errno_t get_wifi_list(service_id_t **wifis, size_t *count) @@ -262,9 +256,11 @@ static errno_t wifi_scan(uint32_t index, bool now) for (uint8_t i = 0; i < scan_results.length; i++) { ieee80211_scan_result_t result = scan_results.results[i]; + char mac_addr_hex[18]; + nic_addr_format(&result.bssid, mac_addr_hex, 18); printf("%16.16s %17s %4d %5s %5s %7s %7s\n", - result.ssid, nic_addr_format(&result.bssid), + result.ssid, mac_addr_hex, result.channel, enum_name(ieee80211_security_type_strs, result.security.type), enum_name(ieee80211_security_auth_strs, result.security.auth), diff --git a/uspace/drv/nic/ar9271/wmi.c b/uspace/drv/nic/ar9271/wmi.c index 4a5cdba70b..b595f06af5 100644 --- a/uspace/drv/nic/ar9271/wmi.c +++ b/uspace/drv/nic/ar9271/wmi.c @@ -229,6 +229,10 @@ errno_t wmi_send_command(htc_device_t *htc_device, wmi_command_t command_id, sizeof(htc_frame_header_t); size_t buffer_size = header_size + command_length; void *buffer = malloc(buffer_size); + if (buffer == NULL) { + usb_log_error("Failed to allocate WMI message buffer (out of memory).\n"); + return ENOMEM; + } if (command_buffer != NULL) memcpy(buffer + header_size, command_buffer, command_length); @@ -240,17 +244,15 @@ errno_t wmi_send_command(htc_device_t *htc_device, wmi_command_t command_id, wmi_header->sequence_number = host2uint16_t_be(++htc_device->sequence_number); - /* Send message. */ + /* Send message (buffer will not be needed afterwards regardless of result). */ errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size, htc_device->endpoints.wmi_endpoint); + free(buffer); if (rc != EOK) { - free(buffer); usb_log_error("Failed to send WMI message. Error: %s\n", str_error_name(rc)); return rc; } - free(buffer); - bool clean_resp_buffer = false; size_t response_buffer_size = htc_device->ath_device->ctrl_response_length; @@ -266,7 +268,6 @@ errno_t wmi_send_command(htc_device_t *htc_device, wmi_command_t command_id, rc = htc_read_control_message(htc_device, response_buffer, response_buffer_size, NULL); if (rc != EOK) { - free(buffer); usb_log_error("Failed to receive WMI message response. " "Error: %s\n", str_error_name(rc)); return rc; @@ -274,7 +275,6 @@ errno_t wmi_send_command(htc_device_t *htc_device, wmi_command_t command_id, if (response_buffer_size < sizeof(htc_frame_header_t) + sizeof(wmi_command_header_t)) { - free(buffer); usb_log_error("Corrupted response received.\n"); return EINVAL; } diff --git a/uspace/lib/cpp/include/__bits/adt/hash_table.hpp b/uspace/lib/cpp/include/__bits/adt/hash_table.hpp index a81f94b416..173c116a11 100644 --- a/uspace/lib/cpp/include/__bits/adt/hash_table.hpp +++ b/uspace/lib/cpp/include/__bits/adt/hash_table.hpp @@ -251,8 +251,8 @@ namespace std::aux void swap(hash_table& other) noexcept(allocator_traits::is_always_equal::value && - noexcept(swap(declval(), declval())) && - noexcept(swap(declval(), declval()))) + noexcept(std::swap(declval(), declval())) && + noexcept(std::swap(declval(), declval()))) { std::swap(table_, other.table_); std::swap(bucket_count_, other.bucket_count_); diff --git a/uspace/lib/cpp/include/__bits/adt/rbtree.hpp b/uspace/lib/cpp/include/__bits/adt/rbtree.hpp index 325b36b868..0c21f08602 100644 --- a/uspace/lib/cpp/include/__bits/adt/rbtree.hpp +++ b/uspace/lib/cpp/include/__bits/adt/rbtree.hpp @@ -232,7 +232,7 @@ namespace std::aux void swap(rbtree& other) noexcept(allocator_traits::is_always_equal::value && - noexcept(swap(declval(), declval()))) + noexcept(std::swap(declval(), declval()))) { std::swap(root_, other.root_); std::swap(size_, other.size_); diff --git a/uspace/lib/cpp/include/__bits/string/string.hpp b/uspace/lib/cpp/include/__bits/string/string.hpp index 5040806305..3e7cca1a9e 100644 --- a/uspace/lib/cpp/include/__bits/string/string.hpp +++ b/uspace/lib/cpp/include/__bits/string/string.hpp @@ -520,7 +520,7 @@ namespace std } basic_string(size_type n, value_type c, const allocator_type& alloc = allocator_type{}) - : data_{}, size_{n}, capacity_{n}, allocator_{alloc} + : data_{}, size_{n}, capacity_{n + 1}, allocator_{alloc} { data_ = allocator_.allocate(capacity_); for (size_type i = 0; i < size_; ++i) @@ -907,7 +907,7 @@ namespace std basic_string& assign(const value_type* str, size_type n) { // TODO: if (n > max_size()) throw length_error. - resize_without_copy_(n); + resize_without_copy_(n + 1); traits_type::copy(begin(), str, n); size_ = n; ensure_null_terminator_(); diff --git a/uspace/lib/cpp/src/__bits/unwind.cpp b/uspace/lib/cpp/src/__bits/unwind.cpp index f093864256..8a76ca2639 100644 --- a/uspace/lib/cpp/src/__bits/unwind.cpp +++ b/uspace/lib/cpp/src/__bits/unwind.cpp @@ -29,6 +29,7 @@ #include #include #include +#include namespace __cxxabiv1 { diff --git a/uspace/lib/cpp/src/future.cpp b/uspace/lib/cpp/src/future.cpp index bb23ee2d52..0c1c62a007 100644 --- a/uspace/lib/cpp/src/future.cpp +++ b/uspace/lib/cpp/src/future.cpp @@ -83,6 +83,15 @@ namespace std const char* future_error::what() const noexcept { - return code().message().c_str(); + /* + * FIXME + * Following code would be optimal but the message string is + * actually destroyed before the function returns so we would + * be returning a dangling pointer. No simple fix available, hence + * we use the ugly hack. + */ + //return code().message().c_str(); +#define QUOTE_ARG(arg) #arg + return "future_error, see " __FILE__ ":" QUOTE_ARG(__LINE__); } } diff --git a/uspace/lib/ui/test/window.c b/uspace/lib/ui/test/window.c index 1b3e02517a..5f3d148930 100644 --- a/uspace/lib/ui/test/window.c +++ b/uspace/lib/ui/test/window.c @@ -786,7 +786,7 @@ PCUT_TEST(send_kbd) PCUT_ASSERT_ERRNO_VAL(EOK, rc); PCUT_ASSERT_NOT_NULL(window); - kbd_event.type = POS_PRESS; + kbd_event.type = KEY_PRESS; kbd_event.key = KC_X; kbd_event.mods = 0; kbd_event.c = 'x'; diff --git a/uspace/lib/usbdev/include/usb/dev/device.h b/uspace/lib/usbdev/include/usb/dev/device.h index 20086ff5dd..73689d4889 100644 --- a/uspace/lib/usbdev/include/usb/dev/device.h +++ b/uspace/lib/usbdev/include/usb/dev/device.h @@ -90,7 +90,7 @@ usb_endpoint_mapping_t *usb_device_get_mapped_ep_desc(usb_device_t *, int usb_device_unmap_ep(usb_endpoint_mapping_t *); usb_address_t usb_device_get_address(const usb_device_t *); -usb_speed_t usb_device_get_depth(const usb_device_t *); +unsigned usb_device_get_depth(const usb_device_t *); usb_speed_t usb_device_get_speed(const usb_device_t *); int usb_device_get_iface_number(const usb_device_t *); devman_handle_t usb_device_get_devman_handle(const usb_device_t *); diff --git a/uspace/srv/hid/output/proto/vt100.c b/uspace/srv/hid/output/proto/vt100.c index b4db83b27c..7350330d2c 100644 --- a/uspace/srv/hid/output/proto/vt100.c +++ b/uspace/srv/hid/output/proto/vt100.c @@ -40,7 +40,16 @@ #include #include "vt100.h" -#define MAX_CONTROL 20 +/** Buffer size when creating actual VT100 commands. + * + * This is absurdly large but since we accept numbers via sysarg_t, + * we make it big enough for the largest value to be on the safe side + * (and to silence compiler too). + * + * TODO: find out if VT100 has some hard limits or perhaps simply cut-out + * values larger than 16 bits or something. + */ +#define MAX_CONTROL 64 typedef enum { CI_BLACK = 0,