Replace () with (void) in function prototypes 55/256755/3
authorMateusz Majewski <m.majewski2@samsung.com>
Mon, 12 Apr 2021 09:17:32 +0000 (11:17 +0200)
committerMichal Bloch <m.bloch@samsung.com>
Mon, 12 Apr 2021 17:07:35 +0000 (19:07 +0200)
In C, argumentless functions are declared as receiving (void). It is,
however, more natural to declare them as receiving (). But this means
that the function can receive any number of arguments. This is bad.
We don't want this. We could miss some calls when adding arguments in
a refactor, leading to stack garbage/corruption.

Change-Id: I94732497663937fd3f9d30cea71a2eb966d6f439

66 files changed:
include/dynamic_config.h
include/libdlog.h
include/loglimiter.h
include/logprint.h
include/metrics.h
src/libdlog/deduplicate.c
src/libdlog/deduplicate.h
src/libdlog/dynamic_config.c
src/libdlog/log.c
src/libdlog/log_android.c
src/libdlog/log_pipe.c
src/logger/logger.c
src/logger/logger_privileges.c
src/logger/logger_privileges.h
src/logger/reader_logger.c
src/logger/socket.c
src/logger/socket.h
src/shared/loglimiter.c
src/shared/metrics.c
src/tests/config.c
src/tests/critical_log.c
src/tests/deduplicate_test.c
src/tests/dynamic_config.c
src/tests/fd_info_neg.c
src/tests/fd_info_pos.c
src/tests/fdi_logger_neg.c
src/tests/fdi_logger_pos.c
src/tests/fdi_pipe_neg.c
src/tests/fdi_pipe_pos.c
src/tests/filters.c
src/tests/hash_test.c
src/tests/kmsg_parser_neg.c
src/tests/kmsg_parser_pos.c
src/tests/libdlog_android_neg.c
src/tests/libdlog_android_pos.c
src/tests/libdlog_android_wrapper.c
src/tests/libdlog_base_neg.c
src/tests/libdlog_base_pos.c
src/tests/libdlog_base_wrap.c
src/tests/libdlog_pipe.c
src/tests/libdlog_prio_filter_pos.c
src/tests/limiter_neg.c
src/tests/limiter_pos.c
src/tests/limiter_wrap.c
src/tests/log_file.c
src/tests/logctl.c
src/tests/logger.c
src/tests/logprint.c
src/tests/logutil.c
src/tests/logutil_neg.c
src/tests/logutil_pos.c
src/tests/metrics.c
src/tests/pid_limiter.c
src/tests/pipe_message.c
src/tests/qos_distributions.c
src/tests/queued_entry_neg.c
src/tests/queued_entry_pos.c
src/tests/salvage_pipe_entry.c
src/tests/sort_vector_neg.c
src/tests/sort_vector_pos.c
src/tests/syslog_parser_neg.c
src/tests/syslog_parser_pos.c
src/tests/test_logger_log_storage.c
src/tests/test_ptrs_list_neg.c
src/tests/test_ptrs_list_pos.c
tests/test_libdlogutil.c

index e35dcaf..3027056 100644 (file)
@@ -34,8 +34,8 @@ extern "C" {
 #define DYNAMIC_CONFIG_FILENAME "05-logctl.conf"
 
 bool __dynamic_config_create(struct log_config *config);
-void __dynamic_config_destroy();
-void __dynamic_config_update();
+void __dynamic_config_destroy(void);
+void __dynamic_config_update(void);
 
 #ifdef __cplusplus
 }
index 9c47f9b..66878fe 100644 (file)
@@ -12,7 +12,7 @@
 struct log_config;
 
 extern int (*write_to_log)(log_id_t, log_priority, const char *tag, const char *msg, struct timespec *tp_mono);
-extern void (*destroy_backend)();
+extern void (*destroy_backend)(void);
 
 extern pthread_rwlock_t log_limiter_lock;
 extern bool limiter;
index dab3055..bb41008 100644 (file)
@@ -75,7 +75,7 @@ void __log_limiter_update(const struct log_config *config);
 int __log_limiter_dump_rule(struct rule **, char *, const size_t);
 
 // Note: result only valid until next __log_limiter_{update,destroy}
-list_head __log_limiter_get_pid_limits();
+list_head __log_limiter_get_pid_limits(void);
 
 #ifdef __cplusplus
 }
index 150679f..14eb215 100644 (file)
@@ -62,7 +62,7 @@ struct log_write_buffer {
        size_t size;
        struct timespec oldest_log;
 };
-struct log_filter *log_filter_new();
+struct log_filter *log_filter_new(void);
 
 void log_filter_free(struct log_filter *p_filter);
 struct log_filter {
@@ -74,7 +74,7 @@ struct log_filter {
 
 void log_filter_init(struct log_filter *p_filter);
 
-struct log_write_buffer log_write_buffer_new();
+struct log_write_buffer log_write_buffer_new(void);
 
 void log_write_buffer_free(struct log_write_buffer *buf);
 
index 7a1daf4..2d7142d 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <dlogutil.h>
 
-struct metrics *metrics_create();
+struct metrics *metrics_create(void);
 void metrics_destroy(struct metrics *);
 
 bool metrics_add_log(struct metrics *, const dlogutil_entry_s *);
index 5feda7f..d2bb13b 100644 (file)
@@ -50,7 +50,7 @@ static int warning_size;
 static char warning_content[WARNING_MAX];
 static deduplicate_log basic_log;
 
-static void refresh_deduplication_limits()
+static void refresh_deduplication_limits(void)
 {
        known_hashes_size = 0;
 }
@@ -179,7 +179,7 @@ void __configure_deduplicate(struct log_config *config)
        }
 }
 
-void __deduplicate_destroy()
+void __deduplicate_destroy(void)
 {
        known_hashes_size = 0;
        free(known_hashes_vector);
index a4b3b8a..57d6529 100644 (file)
@@ -39,7 +39,7 @@ typedef enum dlog_deduplicate_e {
 
 void deduplicate_warn(char *buf, size_t size, size_t len);
 void __configure_deduplicate(struct log_config *config);
-void __deduplicate_destroy();
+void __deduplicate_destroy(void);
 extern dlog_deduplicate_e (*deduplicate_func)(const char *, size_t, struct timespec *);
 
 #endif /* _DEDUPLICATE_H_ */
index 4e9bf97..c17471b 100644 (file)
@@ -67,7 +67,7 @@ static bool __setup_runtime_watch(char const *path)
        return true;
 }
 
-static void __apply_update()
+static void __apply_update(void)
 {
        assert(inotify_path);
 
@@ -116,7 +116,7 @@ bool __dynamic_config_create(struct log_config *config)
 }
 
 /// caller has to guarantee exclusive access
-void __dynamic_config_destroy()
+void __dynamic_config_destroy(void)
 {
        assert(inotify_fd <  0 ||  inotify_path);
        assert(inotify_fd >= 0 || !inotify_path);
@@ -141,7 +141,7 @@ void __dynamic_config_destroy()
        inotify_fd = -1;
 }
 
-void __dynamic_config_update()
+void __dynamic_config_update(void)
 {
        if (inotify_fd < 0)
                return;
index d628c7c..903600a 100644 (file)
@@ -58,7 +58,7 @@
  * @see __dlog_init_backend
  */
 int (*write_to_log)(log_id_t log_id, log_priority prio, const char *tag, const char *msg, struct timespec *tp_mono) = NULL;
-void (*destroy_backend)();
+void (*destroy_backend)(void);
 
 int (*stash_failed_log)(log_id_t log_id, log_priority prio, const char *tag, const char *msg) = NULL;
 #ifndef UNIT_TEST
@@ -112,7 +112,7 @@ static int __configure_backend(struct log_config *config)
        return 1;
 }
 
-static void __set_plog_default_values()
+static void __set_plog_default_values(void)
 {
        for (size_t i = 0; i < NELEMS(plog); ++i)
                plog_default_values[i] = plog[i];
@@ -251,7 +251,7 @@ static void __attribute__((constructor(102))) __set_output_buffering(void)
 }
 
 static bool first = true;
-static bool initialize()
+static bool initialize(void)
 {
        if (is_initialized)
                return true;
index 4ca940a..ab1ee18 100644 (file)
@@ -109,7 +109,7 @@ static int __write_to_log_android(log_id_t log_id, log_priority prio, const char
        return ret;
 }
 
-static void __destroy_androidlogger()
+static void __destroy_androidlogger(void)
 {
        /* No need for an explicit lock here; this should only be called
         * by the library destructor which has its own lock */
index a7a2107..baed671 100644 (file)
@@ -170,7 +170,7 @@ static int __write_to_log_pipe(log_id_t log_id, log_priority prio, const char *t
        return ret;
 }
 
-static void __destroy_pipe()
+static void __destroy_pipe(void)
 {
        /* No need for an explicit lock here; this should only be called
         * by the library destructor which has its own lock */
index ecc3ae3..941b014 100644 (file)
@@ -1166,7 +1166,7 @@ void parse_logfile_config(void *value, void *userdata)
  * @brief Print help
  * @details Prints basic usage tips
  */
-static void help()
+static void help(void)
 {
        printf("Usage: %s [options]\n"
               "\t-h    Show this help\n"
index c5b1265..43ef95b 100644 (file)
@@ -111,7 +111,7 @@ int usergr2id(const char *user, const char *group, uid_t *uid, gid_t *gid)
  * @details Resets privileges to those specified at build-time
  * @return 0 on success, else -errno
  */
-int reset_self_privileges()
+int reset_self_privileges(void)
 {
        uid_t uid;
        gid_t gid;
index 45dcd43..074158d 100644 (file)
@@ -17,6 +17,6 @@
 #include <sys/types.h>
 
 int parse_permissions(const char *str);
-int reset_self_privileges();
+int reset_self_privileges(void);
 int usergr2id(const char *user, const char *group, uid_t *uid, gid_t *gid);
 
index 9442bff..8f26042 100644 (file)
@@ -157,7 +157,7 @@ int service_reader_logger(struct reader_logger *reader, struct now_t time)
        return 0;
 }
 
-static struct reader_logger *reader_logger_alloc()
+static struct reader_logger *reader_logger_alloc(void)
 {
        struct reader_logger *const ret = calloc(1, sizeof *ret);
        if (!ret)
index 704db4b..e4ee17c 100644 (file)
@@ -140,12 +140,12 @@ int systemd_sock_get(const char *path, int type)
 static const char dev_log_sock[] = "/run/dlog/dev-log";
 static const char dev_log_link[] = "/dev/log";
 
-int dev_log_sock_get()
+int dev_log_sock_get(void)
 {
        return systemd_sock_get(dev_log_sock, SOCK_DGRAM);
 }
 
-int dev_log_sock_create()
+int dev_log_sock_create(void)
 {
        int fd = bind_fd_create(dev_log_sock, SOCK_DGRAM);
        if (fd >= 0) {
index 6e09c73..909824c 100644 (file)
@@ -32,8 +32,8 @@ struct socket_config_data {
 int socket_initialize(struct sock_data *sock, struct log_buffer *buffer, service_socket_t service_socket, struct socket_config_data *data);
 void socket_close(struct sock_data *sock);
 
-int dev_log_sock_get();
-int dev_log_sock_create();
+int dev_log_sock_get(void);
+int dev_log_sock_create(void);
 
 #ifdef UNIT_TEST
 int bind_fd_create(const char *path, int type);
index 541cafc..460ea12 100644 (file)
@@ -80,7 +80,7 @@ void find_my_rule(elem_value value, void *userdata)
                cached_pid_rule = p;
 }
 
-static struct pass_log_result block_by_pid()
+static struct pass_log_result block_by_pid(void)
 {
        pid_t my_pid = getpid();
 
@@ -344,7 +344,7 @@ int __log_limiter_initialize(struct rule *rules_table)
        return 0;
 }
 
-static void destroy_hashmap_etc()
+static void destroy_hashmap_etc(void)
 {
        hashmap_destroy(&rules_hashmap);
        rules_destroy(&original_rules_table);
@@ -639,7 +639,7 @@ int __log_limiter_dump_rule(struct rule **r, char *buf, const size_t size)
        return 0;
 }
 
-list_head __log_limiter_get_pid_limits()
+list_head __log_limiter_get_pid_limits(void)
 {
        return pid_rules;
 }
index 8c8f1e9..de2f7b8 100644 (file)
@@ -34,7 +34,7 @@ struct metrics {
        int capacity;
 };
 
-struct metrics *metrics_create()
+struct metrics *metrics_create(void)
 {
        return calloc(1, sizeof(struct metrics));
 }
index a9d3196..53c5371 100644 (file)
@@ -76,7 +76,7 @@ void *__wrap_calloc(size_t nmemb, size_t size)
        return fail_calloc ? NULL : __real_calloc(nmemb, size);
 }
 
-int main()
+int main(void)
 {
        const char * get;
        struct log_config config;
index d834127..c16915e 100644 (file)
@@ -69,7 +69,7 @@ void atexit_f(void)
        called_atexit = true;
 }
 
-int main()
+int main(void)
 {
        called_atexit = false;
        assert(!atexit(atexit_f));
index 0c3abfb..00820b6 100644 (file)
@@ -95,7 +95,7 @@ void check_assertion(const char *fmt, int ret)
        assert(dlog_print(DLOG_INFO, "tag", fmt) == ret);
 }
 
-void test_basic_1ms_interval()
+void test_basic_1ms_interval(void)
 {
        local_advanced = "only_identical_neighbours";
        local_time_ms = "1";
@@ -119,7 +119,7 @@ void test_basic_1ms_interval()
        __dlog_fini();
 }
 
-void test_basic_10ms_interval()
+void test_basic_10ms_interval(void)
 {
        local_advanced = "only_identical_neighbours";
        local_time_ms = "10";
@@ -151,7 +151,7 @@ void test_basic_10ms_interval()
        __dlog_fini();
 }
 
-void test_basic_1ms_interval_warning()
+void test_basic_1ms_interval_warning(void)
 {
        local_advanced = "only_identical_neighbours";
        local_time_ms = "10";
@@ -173,7 +173,7 @@ void test_basic_1ms_interval_warning()
        __dlog_fini();
 }
 
-void test_advanced_1ms_interval()
+void test_advanced_1ms_interval(void)
 {
        local_advanced = "all_identical_logs";
        local_time_ms = "1";
@@ -197,7 +197,7 @@ void test_advanced_1ms_interval()
        __dlog_fini();
 }
 
-void test_advanced_10ms_interval()
+void test_advanced_10ms_interval(void)
 {
        local_advanced = "all_identical_logs";
        local_time_ms = "10";
@@ -237,7 +237,7 @@ void test_advanced_10ms_interval()
        __dlog_fini();
 }
 
-void test_advanced_10ms_interval_warning()
+void test_advanced_10ms_interval_warning(void)
 {
        local_advanced = "all_identical_logs";
        local_time_ms = "10";
@@ -295,7 +295,7 @@ void test_advanced_10ms_interval_warning()
        __dlog_fini();
 }
 
-void test_advanced_many_hashes()
+void test_advanced_many_hashes(void)
 {
        local_advanced = "all_identical_logs";
        local_time_ms = "1";
@@ -314,7 +314,7 @@ void test_advanced_many_hashes()
        __dlog_fini();
 }
 
-void test_advanced_many_millisec()
+void test_advanced_many_millisec(void)
 {
        local_advanced = "all_identical_logs";
        local_time_ms = "1";
@@ -333,7 +333,7 @@ void test_advanced_many_millisec()
        __dlog_fini();
 }
 
-void test_deduplicate_warn()
+void test_deduplicate_warn(void)
 {
        use_real_deduplicate_warn = true;
        local_warn_quantity = "11";
@@ -394,7 +394,7 @@ void test_deduplicate_warn()
        __dlog_fini();
 }
 
-void test_deduplicate_warn_random()
+void test_deduplicate_warn_random(void)
 {
        use_real_deduplicate_warn = false;
        local_advanced = "only_identical_neighbours";
@@ -425,7 +425,7 @@ void test_deduplicate_warn_random()
        __dlog_fini();
 }
 
-int main()
+int main(void)
 {
        test_basic_1ms_interval();
        test_basic_10ms_interval();
index 5ac3108..4c84526 100644 (file)
@@ -125,7 +125,7 @@ int __wrap_pthread_mutex_trylock(pthread_mutex_t *mutex)
        return pretend_the_mutex_is_locked ? -1 : __real_pthread_mutex_trylock(mutex);
 }
 
-int main()
+int main(void)
 {
        // check whether these blow up when called before init
        __dynamic_config_update();
index 08e586d..3726b40 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "fd_info_wrap.c"
 
-int main()
+int main(void)
 {
        struct fd_ops fops = {
                .destroy = test_destroy,
index dcc5bd5..2e34385 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "fd_info_wrap.c"
 
-int main()
+int main(void)
 {
        struct fd_ops fops = {
                .destroy = test_destroy,
index 5ed1bb6..36a684a 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "fdi_logger_wrap.c"
 
-int main()
+int main(void)
 {
        struct fd_info fdi = {
                .fd = -1,
index 5172df7..815c899 100644 (file)
@@ -30,7 +30,7 @@ static void monitor_more_reads(size_t N, struct fd_info *fdi)
        assert(READS[N] == ops_logger.read(fdi));
 }
 
-int main()
+int main(void)
 {
        struct fd_info fdi = {
                .fd = -1,
index a30f8f8..71dea29 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "fdi_pipe_wrap.c"
 
-int main()
+int main(void)
 {
        struct fd_info info = {
                .ops = &ops_pipe,
index 96428b3..d4f97be 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "fdi_pipe_wrap.c"
 
-int main()
+int main(void)
 {
        struct fd_info info = {
                .ops = &ops_pipe,
index 465ec39..692e9b3 100644 (file)
@@ -164,7 +164,7 @@ int check_print_line_tag(int line, struct log_filter *p_filter, char *tag, int p
        return result;
 }
 
-int check_colons()
+int check_colons(void)
 {
        struct log_filter *const f = log_filter_new();
        assert(f);
@@ -186,7 +186,7 @@ int check_colons()
        return result;
 }
 
-int main()
+int main(void)
 {
        int err;
        int result = 0;
index edceda6..5dd2269 100644 (file)
@@ -46,7 +46,7 @@ static void add_hash(const char *msg, size_t msg_size)
        index++;
 }
 
-static void validate_hash()
+static void validate_hash(void)
 {
        static const size_t BUCKET_SIZE = UINT32_MAX / NUM_BUCKETS + 1;
        static const size_t BUCKET_AVG_COUNT = NELEMS(hash_values) / NUM_BUCKETS;
@@ -67,7 +67,7 @@ static void validate_hash()
        }
 }
 
-static void test_permutations()
+static void test_permutations(void)
 {
        char hash[3];
 
@@ -91,7 +91,7 @@ static void test_random(size_t size)
        add_hash(hash, sizeof hash);
 }
 
-int main()
+int main(void)
 {
        srand(SEED);
 
index a625bc2..59f9f3b 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "kmsg_assert.c"
 
-int main()
+int main(void)
 {
        assert_result(""             , -EINVAL);
        assert_result("invalid"      , -EINVAL);
index b05d1b4..541186d 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "kmsg_assert.c"
 
-int main()
+int main(void)
 {
        struct dlogutil_entry_with_msg lem;
 
index c276bdf..2cdf7e5 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "libdlog_android_wrapper.c"
 
-int main()
+int main(void)
 {
        fail_open = true;
        __dlog_init_android(&CONF);
index db88f7e..e88afa8 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "libdlog_android_wrapper.c"
 
-int main()
+int main(void)
 {
        fail_open = false;
        __dlog_init_android(&CONF);
index 5e26742..98c8e42 100644 (file)
@@ -29,7 +29,7 @@
 #endif /* USE_ANDROID_MONOTONIC */
 
 int (*write_to_log)(log_id_t, log_priority, const char *tag, const char *msg, struct timespec *tp_mono) = NULL;
-void (*destroy_backend)() = NULL;
+void (*destroy_backend)(void) = NULL;
 extern void __dlog_init_android(const struct log_config *conf);
 
 static struct log_config CONF;
index 40b7a93..2844784 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "libdlog_base_wrap.c"
 
-int main()
+int main(void)
 {
        fail_conf_read = true;
        __configure();
index a045a56..7ac140a 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "libdlog_base_wrap.c"
 
-int main()
+int main(void)
 {
        log_config_set(&CONFIG, "backend", "pipe");
        log_config_set(&CONFIG, "limiter", "0");
index b7795b9..8978656 100644 (file)
 
 void __log_limiter_update(const struct log_config *config) { }
 void __log_limiter_destroy(void) { }
-void __dynamic_config_destroy() { }
+void __dynamic_config_destroy(void) { }
 
 static bool destroyed;
-void destroy()
+void destroy(void)
 {
        destroyed = true;
 }
@@ -75,7 +75,7 @@ static bool use_dynamic_conf;
 bool __dynamic_config_create(struct log_config *config) { return use_dynamic_conf; }
 
 static bool dynamic_config_called;
-void __dynamic_config_update() { dynamic_config_called = true; }
+void __dynamic_config_update(void) { dynamic_config_called = true; }
 
 bool fail_snprintf;
 int __wrap_snprintf(char *str, size_t size, const char *format, ...)
@@ -103,7 +103,7 @@ int dlog_vprint_wrap_va_list(log_priority pri, const char *tag, const char *msg,
        return ret;
 }
 
-void tct_tests()
+void tct_tests(void)
 {
        /* These are a copy of TCT tests:
         * repository: test/tct/native/api on tizen.org
index fa8a350..0341a7b 100644 (file)
@@ -11,7 +11,7 @@
 #include <logconfig.h>
 
 int (*write_to_log)(log_id_t, log_priority, const char *tag, const char *msg) = NULL;
-void (*destroy_backend)() = NULL;
+void (*destroy_backend)(void) = NULL;
 
 extern void __dlog_init_pipe(const struct log_config *conf);
 
@@ -88,7 +88,7 @@ int __wrap_close(int fd)
        return 0;
 }
 
-int main()
+int main(void)
 {
        struct log_config conf = {NULL, NULL};
 
index 877c736..e564943 100644 (file)
@@ -38,15 +38,15 @@ int __wrap_log_config_read(struct log_config *config)
 // lobotomize various mechanisms I don't want to deal with
 void __log_limiter_update(const struct log_config *config) { }
 void __log_limiter_destroy(void) { }
-void __dynamic_config_destroy() { }
+void __dynamic_config_destroy(void) { }
 struct pass_log_result __log_limiter_pass_log(const char *tag, int prio) { return (struct pass_log_result) { .decision = DECISION_ALLOWED }; }
 int __log_limiter_create(const struct log_config *config) { return 1; }
 bool __dynamic_config_create(struct log_config *config) { return false; }
-void __dynamic_config_update() { }
+void __dynamic_config_update(void) { }
 void __dlog_init_android(const struct log_config *conf) { }
 
 
-int main()
+int main(void)
 {
 #define   VALID_FILTER(x) assert(dlog_set_minimum_priority(x) == DLOG_ERROR_NONE)
 #define INVALID_FILTER(x) assert(dlog_set_minimum_priority(x) == DLOG_ERROR_INVALID_PARAMETER)
index 41afa66..8edeb71 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "limiter_wrap.c"
 
-int main()
+int main(void)
 {
        __log_limiter_destroy(); // check whether it explodes if called before init
 
index 26ed02c..9b616a2 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "limiter_wrap.c"
 
-int main()
+int main(void)
 {
        struct log_config conf = {NULL, NULL};
        assert(!__log_limiter_create(&conf));
index 2ae1e85..45f71b7 100644 (file)
@@ -26,7 +26,7 @@
 #include <loglimiter.h>
 #include <loglimiter-internal.h>
 
-static size_t get_rulecount()
+static size_t get_rulecount(void)
 {
        size_t cnt = 0;
        struct rule *r = NULL;
index 18ef992..98a6c1e 100644 (file)
@@ -123,7 +123,7 @@ int __wrap_isatty(int fd)
        // We should also set errno, but we won't
 }
 
-int main()
+int main(void)
 {
        struct log_file lf;
        logfile_init(&lf);
index 56b23c1..5c463d2 100644 (file)
@@ -107,7 +107,7 @@ void _compare_file(const char *const *lines, size_t lines_cnt)
 }
 #define COMPARE_FILE(lines) _compare_file(lines, NELEMS(lines))
 
-void test_copy_file_with_exceptions()
+void test_copy_file_with_exceptions(void)
 {
        static const char *const lines_in[] = {
                "FOO=BAR",
@@ -168,7 +168,7 @@ void test_copy_file_with_exceptions()
        free(kv.values);
 }
 
-void test_handle_clear()
+void test_handle_clear(void)
 {
        static const char *const lines_in[] = {
                "limiter|x|y=BAR",
@@ -192,7 +192,7 @@ void test_handle_clear()
        COMPARE_FILE(lines_out);
 }
 
-void test_handle_set()
+void test_handle_set(void)
 {
        static const char *const lines_in[] = {
                "QWER=QWER",
@@ -237,7 +237,7 @@ void test_handle_set()
        assert(EXIT_SUCCESS == handle_set(&pp, TMPFILE_PATH, NULL));
 }
 
-void test_handle_plog()
+void test_handle_plog(void)
 {
        static const char *const lines_in[] = {
                "QWER=QWER",
@@ -333,7 +333,7 @@ void check_option_set(size_t argc, const char **argv, const struct expected_opts
        assert(!pp.tag || !strcmp(exp->pp.tag, pp.tag));
 }
 
-void test_parse_options()
+void test_parse_options(void)
 {
        /* These are primarily covered by integration tests but there's some value
         * in running this at build time as well to detect any breakage ASAP. */
@@ -389,7 +389,7 @@ void test_parse_options()
 #undef CHECK_OPTION_SET
 }
 
-int main()
+int main(void)
 {
        test_copy_file_with_exceptions();
        test_parse_options();
index dc1a0fa..a49b07c 100644 (file)
@@ -13,8 +13,8 @@
 int bind_fd_create(const char *path, int type);
 int listen_fd_create(const char *path, int permissions);
 int systemd_sock_get(const char *path, int type);
-int dev_log_sock_get();
-int dev_log_sock_create();
+int dev_log_sock_get(void);
+int dev_log_sock_create(void);
 int create_kmsg_writer(struct writer **writer, struct log_buffer *log_buffer);
 int service_writer_kmsg(struct logger *server, struct writer *wr, struct epoll_event *event);
 int create_syslog_writer(struct writer **writer, struct log_buffer *log_buffer);
@@ -435,7 +435,7 @@ log_storage_reader *__wrap_log_storage_new_reader(log_storage *storage,
        return new_reader_fail ? NULL : (log_storage_reader *)0x600D;
 }
 
-int main()
+int main(void)
 {
        assert(parse_permissions(NULL) == (S_IWUSR | S_IWGRP | S_IWOTH));
        assert(parse_permissions("All the permissions") == 0);
index 27b9cb7..6a87407 100644 (file)
@@ -189,7 +189,7 @@ void check_logprint_testcases_invalid(const char *msg, size_t msg_len, const str
 #define CHECK_LOGPRINT_TESTCASES(MSG, TESTS) check_logprint_testcases_standard(MSG, sizeof MSG, TESTS, NELEMS(TESTS))
 #define CHECK_LOGPRINT_TESTCASES_INVALID(MSG, TESTS) check_logprint_testcases_invalid(MSG, sizeof MSG, TESTS, NELEMS(TESTS))
 
-void check_log_print_log_line()
+void check_log_print_log_line(void)
 {
        static const struct logprint_test_case tests_basic[] = {
                // formats using the SENT timestamp
@@ -550,7 +550,7 @@ void check_log_print_log_line()
        CHECK_LOGPRINT_TESTCASES_INVALID("BASIC TAG\0Basic message.", tests_fixup_pipe);
 }
 
-void check_log_print_log_line_buffer()
+void check_log_print_log_line_buffer(void)
 {
        struct dlogutil_entry_with_msg entry;
        const char tag_msg[] = "tag\0msg";
@@ -603,7 +603,7 @@ enum ts_type {
 const char *json_priority_name(log_priority prio);
 struct timespec entry_get_ts(const dlogutil_entry_s *entry, bool sent, bool mono);
 char *log_format_json(char *default_buffer, size_t default_buffer_size, const dlogutil_entry_s *entry, size_t *p_outLength, char *tag, char *msg);
-void check_json()
+void check_json(void)
 {
        // TODO: Failure testing
        check_json_escape_string_testcase("abc/def", "abc/def");
@@ -748,7 +748,7 @@ void check_json()
        free(ent);
 }
 
-void check_utf8_correctness()
+void check_utf8_correctness(void)
 {
        /* Â© is two bytes */
        static const struct logprint_test_case test_2_bytes_0_shift[] = {
@@ -820,7 +820,7 @@ void check_utf8_correctness()
        CHECK_LOGPRINT_TESTCASES("123💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯💯\0foo1", test_4_bytes_3_shift);
 }
 
-void check_syscall_failure_handling()
+void check_syscall_failure_handling(void)
 {
        struct log_filter *const filter = log_filter_new();
        assert(filter);
@@ -888,7 +888,7 @@ void check_syscall_failure_handling()
        log_filter_free(filter);
 }
 
-void check_invalid_input()
+void check_invalid_input(void)
 {
        const dlogutil_entry_s entry = { .len = 1 };
        const char *data;
@@ -905,7 +905,7 @@ void check_invalid_input()
        log_filter_free(filter);
 }
 
-void check_log_format_from_string()
+void check_log_format_from_string(void)
 {
        static const struct {
                char const *string;
@@ -927,7 +927,7 @@ void check_log_format_from_string()
                assert(log_format_from_string(expected_formats[i].string) == expected_formats[i].format);
 }
 
-void check_get_format_sorting()
+void check_get_format_sorting(void)
 {
        static const struct {
                log_print_format format;
@@ -951,7 +951,7 @@ void check_get_format_sorting()
        }
 }
 
-void check_filter_pri_to_char()
+void check_filter_pri_to_char(void)
 {
        static const struct {
                log_priority pri;
@@ -1009,7 +1009,7 @@ void check_filter_pri_to_char()
                assert(filter_pri_to_char(expected_chars[i].pri) == expected_chars[i].c);
 }
 
-void log_filter_default()
+void log_filter_default(void)
 {
        struct log_filter *const filter = log_filter_new();
        bool ret = log_filter_need_apply_default(filter);
@@ -1017,7 +1017,7 @@ void log_filter_default()
        log_filter_free(filter);
 }
 
-int main()
+int main(void)
 {
        check_log_format_from_string();
        check_get_format_sorting();
index 991ff49..61847fd 100644 (file)
@@ -65,7 +65,7 @@ int __wrap_fdi_push_log(struct fd_info *fdi, struct sort_vector *logs, bool limi
        return 0;
 }
 
-int main()
+int main(void)
 {
        struct sort_vector sv;
        sort_vector_init(&sv);
index 832dcdd..832e47a 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "logutil_wrap.c"
 
-int main()
+int main(void)
 {
        struct sort_vector sv;
        sort_vector_init(&sv);
index 1284727..deb272f 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "logutil_wrap.c"
 
-int main()
+int main(void)
 {
        struct sort_vector sv;
        sort_vector_init(&sv);
index 04f6edf..acc6b01 100644 (file)
@@ -99,7 +99,7 @@ char *__wrap_strdup(const char *s)
        return tmp;
 }
 
-int main()
+int main(void)
 {
        struct metrics *m = metrics_create();
        assert(m);
index 6c28cce..b258c65 100644 (file)
@@ -11,7 +11,7 @@
 #include <loglimiter-internal.h>
 
 time_t time_ret = 0;
-void advance_clock()
+void advance_clock(void)
 {
        time_ret += 61;
 }
@@ -21,12 +21,12 @@ time_t __wrap_time(time_t *t)
 }
 
 pid_t pid_ret = 0;
-pid_t __wrap_getpid()
+pid_t __wrap_getpid(void)
 {
        return pid_ret;
 }
 
-int main()
+int main(void)
 {
        struct log_config conf = {NULL, NULL};
        log_config_set(&conf, "pidlimit|77", "7");
index 35b32c2..85f91fe 100644 (file)
@@ -16,7 +16,7 @@ int time_cmp(struct timespec x, int sec, int nsec)
        return 0;
 }
 
-int main()
+int main(void)
 {
        int prio = 5;
        char tag[] = "TEST_TAG";
index aa0e7ef..1c0ed58 100644 (file)
@@ -11,7 +11,7 @@ int metrics_get_total(const struct metrics *m)
        return total_logs;
 }
 
-void test_proportional_raw()
+void test_proportional_raw(void)
 {
        struct metrics_pid_aggr_info i1 [] =
                {{ .count =  8, }
@@ -28,7 +28,7 @@ void test_proportional_raw()
        assert(i1[3].count == 80);
 }
 
-void test_equal()
+void test_equal(void)
 {
        struct metrics_pid_aggr_info i1 [] =
                {{ .count =  1, }
@@ -45,7 +45,7 @@ void test_equal()
        assert(i1[3].count == 50);
 }
 
-void test_equal_dual()
+void test_equal_dual(void)
 {
        struct metrics_pid_aggr_info i1 [] =
                {{ .count =  20, }
@@ -60,7 +60,7 @@ void test_equal_dual()
        assert(i1[2].count == 90); // 120 >= 200/3, 90 == (200-20)/2
 }
 
-void test_equal_multi()
+void test_equal_multi(void)
 {
        struct metrics_pid_aggr_info i1 [] =
                {{ .count =  30, }
@@ -88,7 +88,7 @@ void test_equal_multi()
        assert(i2[2].count == 95); // 120 >= 200/3, and 120 >= (200-20)/2, and 120 >= (200-20-85)/1
 }
 
-void test_proportional_talmud()
+void test_proportional_talmud(void)
 {
        struct metrics_pid_aggr_info i1 [] =
                {{ .count =  50, }
@@ -187,7 +187,7 @@ void test_proportional_talmud()
        assert(i8[3].count == 317);
 }
 
-int main()
+int main(void)
 {
        test_proportional_raw();
        test_equal();
index 8321a75..3b3095d 100644 (file)
@@ -27,7 +27,7 @@
 #include <queued_entry.h>
 #include <queued_entry_timestamp.h>
 
-int main()
+int main(void)
 {
        struct log_config conf = {NULL, NULL};
        const struct {
index 80a730d..6df3ac5 100644 (file)
@@ -27,7 +27,7 @@
 #include <queued_entry.h>
 #include <queued_entry_timestamp.h>
 
-int main()
+int main(void)
 {
        assert(get_proper_clock(DLOGUTIL_SORT_SENT_MONO) == CLOCK_MONOTONIC);
        assert(get_proper_clock(DLOGUTIL_SORT_SENT_REAL) == CLOCK_REALTIME);
index a6f36cb..dbc282e 100644 (file)
@@ -7,7 +7,7 @@
 #include <logcommon.h>
 #include <queued_entry.h>
 
-void test_negative()
+void test_negative(void)
 {
        struct dlogutil_entry_with_msg dewm;
 
@@ -32,7 +32,7 @@ void test_negative()
        assert(dewm.header.nsec_sent_mono == -1);
 }
 
-void test_positive()
+void test_positive(void)
 {
        struct dlogutil_entry_with_msg dewm;
 
@@ -61,7 +61,7 @@ void test_positive()
        assert(dewm.header.nsec_sent_real == 666666666);
 }
 
-int main()
+int main(void)
 {
        test_negative();
        test_positive();
index 18fe3ba..2468412 100644 (file)
@@ -30,7 +30,7 @@ void *__wrap_calloc(size_t nmemb, size_t size)
        return fail_calloc ? NULL : __real_calloc(nmemb, size);
 }
 
-void fail_calloc_test()
+void fail_calloc_test(void)
 {
        struct sort_vector sv;
        sort_vector_init(&sv);
@@ -45,7 +45,7 @@ void fail_calloc_test()
        fail_calloc = false;
 }
 
-void empty_timestamp()
+void empty_timestamp(void)
 {
        struct sort_vector sv;
        sort_vector_init(&sv);
@@ -65,7 +65,7 @@ void empty_timestamp()
        assert(sort_vector_time_span(&sv, (struct timespec) { .tv_nsec = -1, }) == -1);
 }
 
-void logs_order_empty()
+void logs_order_empty(void)
 {
        struct sort_vector sv;
        sort_vector_init(&sv);
@@ -108,7 +108,7 @@ void logs_order_empty()
        assert(third->pid == 789);
 }
 
-void logs_order_mix()
+void logs_order_mix(void)
 {
        struct sort_vector sv;
        sort_vector_init(&sv);
@@ -160,7 +160,7 @@ void logs_order_mix()
        assert(fourth->pid == 789);
 }
 
-int main()
+int main(void)
 {
        fail_calloc_test();
        empty_timestamp();
index 6ce0fcc..fa40d0d 100644 (file)
@@ -79,7 +79,7 @@ int __wrap_clock_gettime(clockid_t clk_id, struct timespec *tp)
        return 0;
 }
 
-void complex_test()
+void complex_test(void)
 {
        struct sort_vector sv;
        sort_vector_init(&sv);
@@ -188,12 +188,12 @@ void complex_test()
        use_real_free = true;
 }
 
-time_t get_time_t_max()
+time_t get_time_t_max(void)
 {
        return ~(1UL << (sizeof(time_t) * CHAR_BIT - 1));
 }
 
-time_t get_time_t_min()
+time_t get_time_t_min(void)
 {
        return 1UL << (sizeof(time_t) * CHAR_BIT - 1);
 }
@@ -224,7 +224,7 @@ void time_span_test(int32_t fir, time_t sec, long time_span)
        assert((unsigned long) (sort_vector_time_span(&sv, (struct timespec) { .tv_nsec = -1 })) == time_span);
 }
 
-void call_time_span_test()
+void call_time_span_test(void)
 {
        time_span_test(5, 7, 2000);
        time_span_test(7, 5, (unsigned long) -2000);
@@ -264,7 +264,7 @@ void call_time_span_test()
 #endif
 }
 
-int main()
+int main(void)
 {
        complex_test();
        call_time_span_test();
index 0ea3a26..8136c36 100644 (file)
@@ -19,7 +19,7 @@
 #include <stdio.h>
 #include <assert.h>
 
-int main()
+int main(void)
 {
        char buffer[1024];
        int len;
index 0c8ccae..72b9c1c 100644 (file)
@@ -19,7 +19,7 @@
 #include <stdio.h>
 #include <assert.h>
 
-int main()
+int main(void)
 {
        char buffer[1024];
        int len;
index 9f55e16..91f9762 100644 (file)
@@ -140,7 +140,7 @@ void test_reader_get_new_entries(log_storage_reader *r, unsigned cnt, unsigned c
                test_reader_get_new_entry(r, check_base+i+1);
 }
 
-int main()
+int main(void)
 {
        /************* TEST 1 ***************/
        /* Small storage, calling callbacks on removing log entries */
index b2a73cf..8e6b59e 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "test_ptrs_list_wrap.c"
 
-int main()
+int main(void)
 {
        list_head head = NULL;
        assert(list_count(head) == 0);
index 6399aef..f7c0e5f 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "test_ptrs_list_wrap.c"
 
-int main()
+int main(void)
 {
        list_head head = NULL;
        assert(list_count(head) == 0);
index 352cb10..d14ec48 100644 (file)
@@ -372,7 +372,7 @@ void traits_main(bool pipe)
        dlogutil_state_destroy(state);
 }
 
-void clear_main()
+void clear_main(void)
 {
 
        dlogutil_config_s *c = dlogutil_config_create();
@@ -482,7 +482,7 @@ void alias_main(bool pipe)
        dlogutil_state_destroy(state);
 }
 
-void negative_main()
+void negative_main(void)
 {
        dlogutil_config_s *config = dlogutil_config_create();
        assert(config);